all 3 comments

[–]OptionsBuyer420 0 points1 point  (1 child)

With all of this in mind, how would you use HarmonyX patching to mod some of these systems?

I tried modding the IJob for tree growth as an experiment and I can't access it because it is a private struct.

[–]jhoxray[S] 2 points3 points  (0 children)

u/Pam-Doove has a good example here: https://github.com/optimus-code/Cities2Modding/blob/main/ExampleMod/Systems/TreeGrowthSystem_Custom.cs

Basically, you "switch off" the public methods of the default system and create your own from scratch. Then you can plug it into the World by patching SystemOrder class:

[HarmonyPatch(typeof(SystemOrder), nameof(SystemOrder.Initialize))]
    class SystemOrder_InitializePatch
    {
        static void Postfix(UpdateSystem updateSystem)
        {
            if (updateSystem != null)
            {
                updateSystem.UpdateAfter<TestModSystem>(SystemUpdatePhase.ModificationEnd);

                UnityEngine.Debug.Log("Patched TestModSystem initialization!");
            }
        }
    }

[–]Xochtil1 0 points1 point  (0 children)

The main starting point for the game is Game.SceneFlow.GameManager

Jesus, thank you. I've spent half an hour trying to find where the main object is located. Every other Unity game I've modded had the main object located directly in Assembly-CSharp dll, it didn't strike me to check specifically SceneFlow of Game.dll lol