fix(cheatenabler): defer instant construction until prologue ends

This commit is contained in:
soarqin committed 2026-10-26 23:20:26 +08:00
1 parent ca884fe6af
commit 5f9c6e05cb
4 files changed
+12 -4

No files matched your search

+2
View File
@@ -4,6 +4,7 @@
## Changlog
* 2.4.8 - Unreleased
* `Finish build immediately`: Defer construction until the opening cutscene ends or is skipped to avoid possible errors when starting a new game.
* `Belt signal item generation`: Calculate raw-material, intermediate, and proliferator statistics from the game's current recipe data, counting by-products and consumption separately. If an item's recipe data is incomplete, only its upstream statistics pause, with the reason logged; item generation is unaffected. Fix signal belts built or destroyed on another planet, for example by Battlefield Analysis Base drones or Dark Fog attacks, affecting a belt on the current planet instead of their own; a destroyed belt could also keep generating items on a belt later built in its place.
* 2.4.7
* `Dev Shortcuts`: Work immediately when enabled after loading a save, and process each key press once per frame at accelerated game speeds.
@@ -204,6 +205,7 @@
## 更新日志
* 2.4.8 - Unreleased
* `建造秒完成`:延后到开场动画播放结束或跳过后再处理建造,避免开始新游戏时可能报错。
* `传送带信号物品生成`:原料、中间产物和增产剂的统计改为按游戏当前配方数据计算,并分别计入副产物和消耗。某物品的配方数据不完整时,仅暂停该物品的上游统计并在日志中说明原因,不影响物品生成。修复在其他星球上建造或被摧毁的信号传送带(例如由战场分析基站的无人机建造或被黑雾摧毁)错误影响当前星球上传送带的问题;被摧毁的传送带也可能让之后在原处新建的传送带继续生成物品。
* 2.4.7
* `开发模式快捷键`:修复载入存档后启用时不生效的问题;加速游戏时每次按键仍只执行一次。
+7 -4
View File
@@ -88,14 +88,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
Enable(true);
CargoTrafficPatch.Enable(true);
GameLogicProc.OnGameBegin += OnGameBegin_For_ImmBuild;
GameLogicProc.OnGameBegin += OnGameBeginOrGuideComplete;
GameLogicProc.OnDataLoaded += OnDataLoaded;
}
public static void Uninit()
{
GameLogicProc.OnDataLoaded -= OnDataLoaded;
GameLogicProc.OnGameBegin -= OnGameBegin_For_ImmBuild;
GameLogicProc.OnGameBegin -= OnGameBeginOrGuideComplete;
CargoTrafficPatch.Enable(false);
Enable(false);
ImmediateBuild.Enable(false);
@@ -152,7 +152,8 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
if (factory.prebuildCount <= 0) return;
var imm = ImmediateEnabled.Value;
var architect = ArchitectModeEnabled.Value;
if ((!imm && !architect) || GameMain.gameScenario == null) return;
if ((!imm && !architect) || GameMain.gameScenario == null ||
GameMain.data?.guideComplete != true) return;
var prebuilds = factory.prebuildPool;
if (imm)
{
@@ -193,7 +194,9 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
}
private static void OnGameBegin_For_ImmBuild()
[HarmonyPostfix]
[HarmonyPatch(typeof(GameData), nameof(GameData.EndStandardModeGuide))]
private static void OnGameBeginOrGuideComplete()
{
if (DSPGame.IsMenuDemo) return;
var factory = GameMain.mainPlayer?.factory;
@@ -174,6 +174,7 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.FactoryConstructionSystemGameTick))]
private static void GameLogic_FactoryConstructionSystemGameTick_Prefix(GameLogic __instance)
{
if (GameMain.data?.guideComplete != true || GameMain.gameScenario == null) return;
var time = __instance.timei;
if (time % 6 != 0) return;
var planet = GameMain.localPlanet;
+2
View File
@@ -26,6 +26,7 @@
* Factory:
* Finish build immediately
* Completes pending buildings as soon as their required building items are available
* Starts after the opening cutscene has ended or been skipped
* Architect mode
* Unlimited use of buildings, Logistics Bots, Logistics Drones and Interstellar Logistics Vessels
* Construction and inventory availability checks show at least 999 of each supported item.
@@ -129,6 +130,7 @@ The item icon selects the output; no hotkey is needed.
* 工厂:
* 建造秒完成
* 所需建筑物品齐备后立即完成待建造建筑
* 开场动画播放结束或跳过后生效
* 建筑师模式
* 建筑、配送运输机、物流运输机和星际物流运输船可无限使用
* 建造及库存可用数量检查中,每种受支持物品至少显示 999 个。