mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-03-28 23:07:19 +08:00
fix possible crash
This commit is contained in:
Binary file not shown.
@@ -441,12 +441,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.GameTick))]
|
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.FactoryConstructionSystemGameTick))]
|
||||||
private static void ConstructionSystem_GameTick_Prefix(ConstructionSystem __instance, long time)
|
private static void GameLogic_FactoryConstructionSystemGameTick_Prefix(GameLogic __instance)
|
||||||
{
|
{
|
||||||
|
var time = __instance.timei;
|
||||||
if (time % 6 != 0) return;
|
if (time % 6 != 0) return;
|
||||||
var factory = __instance.factory;
|
var factory = GameMain.localPlanet?.factory;
|
||||||
if (factory.prebuildCount <= 0) return;
|
if (factory == null || factory.prebuildCount <= 0) return;
|
||||||
var player = GameMain.mainPlayer;
|
var player = GameMain.mainPlayer;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
var total = factory.prebuildCursor - 1;
|
var total = factory.prebuildCursor - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user