Open HG-Dev opened 2 years ago
Building_AutoPlant's null reference woes occur when it is returning to its home position on startup; the branch to reverse direction makes it unable to spawn its sustainer.
Fix proposal ready. https://github.com/AndroidQuazar/VanillaFactionsExpanded-Mechanoid/pull/17
Building_Autocrane.cs
The autocrane uses any Effecter given by its current target for construction and repair actions. Some Effecters, notably the default ConstructMetal, contain a SubEffector_Sustainer child that with the current implementation require unfailing EffectTicks before TickManager.TicksGame is incremented, less they consider themselves "unsustained" and mark themselves as Ended. This allows for some scenarios, possibly due to performance-enhancing mods, where EffectTick can be called after TickManager.TicksGame is updated, after the Sustainer has already marked itself as ended, resulting in an unending stream of "Tried to maintain ended sustainer" log errors and silence until the Autocrane's next successful action.
Building_AutoPlant.cs
In a similar vein, Building_AutoPlant can potentially fail to spawn a sustainer for its GeothermalPlant_Ambience sound on startup, resulting in an unending stream of null reference errors until one toggles the building's operation gizmo so it can make another attempt.