fix(automation): clear stale routes and guard native navigation

Clear auto-construction orders on teardown and planet changes without

overwriting manual orders, and reject auto-cruise startup while native

autopilot is active. Reduce AGENTS.md to durable project guidance.
This commit is contained in:
soarqin committed 2026-09-16 03:08:11 +08:00
1 parent b5cb9aefb9
commit fe9c771230
3 files changed
+57 -154

No files matched your search

@@ -117,6 +117,7 @@ internal static class FactoryBuildPatches
{
GameLogicProc.OnGameEnd -= ResetNavigation;
GameLogicProc.OnGameEnd -= ResetEnableDiagnostics;
ClearAutoRoute(GameMain.mainPlayer);
ResetNavigation();
Functions.UIFunctions.UpdateToggleAutoConstructCheckButtonVisiblility();
}
@@ -160,6 +161,7 @@ internal static class FactoryBuildPatches
var player = __instance.player;
if (player.planetData != planet)
{
ClearAutoRoute(player);
ResetNavigation();
return;
}
@@ -1192,7 +1194,7 @@ internal static class FactoryBuildPatches
private static void ClearAutoRoute(Player player)
{
if (_autoOrder != null && player.orders.currentOrder == _autoOrder)
if (player != null && _autoOrder != null && player.orders.currentOrder == _autoOrder)
{
player.ClearOrders();
}
+5
View File
@@ -484,6 +484,11 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
{
if (DSPGame.IsMenuDemo || !GameMain.isRunning)
return;
var player = GameMain.mainPlayer;
if (player == null || player.navigation.navigating)
return;
// Without this check the next tick would immediately fail to resolve a target and stop
// again, producing a "started" and a "stopped" popup back to back.
if (!HasNavigationTarget())