Esempio n. 1
0
        public static void Patch(string modDirectory = null)
        {
            Mod.modDirectory = modDirectory ?? "Subnautica_Data\\Managed";
            LoadConfig();

            AddBuildables();

            HarmonyInstance harmony = HarmonyInstance.Create("com.HabitatControlPanel.mod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            ProtobufSerializerPatcher.Patch(harmony);

            Logger.Log("Patched");
        }
    // todo: patch lootdistribution jsonmapper to insert my own loot data, patch entitycell deserializer to insert new entities into new cells, patch worldentityinfo to make loot work correctly, patch PDAData to insert my own pda entries
    public static void Patch()
    {
        if (!Directory.Exists("Mods"))
        {
            Debug.Log("ModLoader: Folder \"Mods\" not found! Creating...");
            Directory.CreateDirectory("Mods");
            return;
        }

        MainThread = Thread.CurrentThread;
        var instance = HarmonyInstance.Create("com.railway.modloader");

        DLLFinder.FindDLLs("Mods");



        Application.runInBackground = true;

        AlternativeSerializer.RegisterCustomSerializer(-5, typeof(ScaleFixer), new ScaleFixerSerializer());

        DLLFinder.PrepatchDLLs();
        AssetBundleLoader.Unload();
        TechTypePatcher.Patch(instance);



        DLLFinder.PatchDLLs();


        CustomResourceManager.Patch(instance);
        ProtobufSerializerPatcher.Patch(instance);
        CustomSpriteManager.Patch(instance);
        CraftDataPatchHelper.Patch();
        LootPatcher.Patch(instance);
        WorldEntityInfoPatcher.Patch(instance);
        DLLFinder.PostPatchDLLs();
    }