Beispiel #1
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            LanguageHelper.init();

            DayNightSpeedControl.init();
        }
Beispiel #2
0
        public static void patch()
        {
            LanguageHelper.init();

            HarmonyHelper.patchAll();
            CraftHelper.patchAll();
        }
Beispiel #3
0
 public static void init()
 {
     if (!inited && (inited = true))
     {
         patches.forEach(p => HarmonyHelper.patch(p.Item2, transpiler: p.Item1));
     }
 }
Beispiel #4
0
        public static void Patch()
        {
            HarmonyHelper.Patch();
            new HorizontalWallLocker().Patch();

            Logger.Log("Patched");
        }
Beispiel #5
0
        public static void Enable()
        {
            try {
                Log.Debug("Testing StackTrace:\n" + new StackTrace(true).ToString(), copyToGameLog: false);
                KianCommons.UI.TextureUtil.EmbededResources = false;
                HelpersExtensions.VERBOSE = false;
                Loaded       = false;
                Log.Buffered = true;

                HarmonyHelper.EnsureHarmonyInstalled();
                //LoadingManager.instance.m_simulationDataReady += SimulationDataReady; // load/update data
                LoadingManager.instance.m_levelPreLoaded += Preload;
                if (LoadingManager.instance.m_loadingComplete)
                {
                    HotReload();
                }

#if FAST_TEST_HARMONY
                HarmonyHelper.DoOnHarmonyReady(() => {
                    HarmonyUtil.InstallHarmony(HARMONY_ID);
                    Process.GetCurrentProcess().Kill();
                });
#endif
                Test();
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Beispiel #6
0
 public void OnEnabled()
 {
     HarmonyHelper.DoOnHarmonyReady(() => {
         Debug.Log("[Trolleybus Trailer AI] Try Patch...");
         Patcher.PatchAll();
     });
 }
Beispiel #7
0
        public static void patch()
        {
            Mod.init();

            HarmonyHelper.patchAll();
            CraftHelper.patchAll();
        }
Beispiel #8
0
 public static void patchAll()
 {
     if (!patched && (patched = true))
     {
         toPatch.forEach(p => HarmonyHelper.patch(p, transpiler: patch));
     }
 }
Beispiel #9
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            MiscStuff.init();

            PersistentConsoleCommands.register <ConsoleCommands>();
        }
Beispiel #10
0
        public static void LoadMods()
        {
            SecondaryLog($"In {nameof(ModLoader)}.{nameof(LoadMods)}!");
            SecondaryLog("Getting config...");
            var config = GetConfig();

            if (config == null)
            {
                SecondaryLog("Config is null");
                return;
            }
            SecondaryLog("Got config!");
            SecondaryLog("Loading mods...");
            try
            {
                var logger        = new ModLogger(config);
                var console       = new ModConsole(config);
                var harmonyHelper = new HarmonyHelper(logger, console);
                var events        = new ModEvents(harmonyHelper);
                var assets        = new ModAssets(console);
                var helper        = new ModHelper(config, logger, console, events, harmonyHelper, assets);
                var modFinder     = new ModFinder(config);
                var owo           = new Owo(helper, modFinder);
                owo.LoadMods();
                SecondaryLog("Loaded mods");
            }
            catch (Exception ex)
            {
                SecondaryLog("Error while loading mods: " + ex);
            }
        }
        /// <summary>
        /// Called by the game when the mod is enabled.
        /// </summary>
        public void OnEnabled()
        {
            // Apply Harmony patches via Cities Harmony.
            // Called here instead of OnCreated to allow the auto-downloader to do its work prior to launch.
            HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());

            // Load settings file.
            SettingsUtils.LoadSettings();

            // Populate (legacy) Datastore from configuration file.
            // Make sure this happens before loading the new configuration file, which will overwrite any settings here.
            // This establishes the correct priority (new over legacy).
            XMLUtilsWG.ReadFromXML();

            // Attaching options panel event hook - check to see if UIView is ready.
            if (UIView.GetAView() != null)
            {
                // It's ready - attach the hook now.
                OptionsPanel.OptionsEventHook();
            }
            else
            {
                // Otherwise, queue the hook for when the intro's finished loading.
                LoadingManager.instance.m_introLoaded += OptionsPanel.OptionsEventHook;
            }
        }
Beispiel #12
0
 public static bool Init()
 {
     try
     {
         MethodInfo methodBase;
         MethodInfo methodPatcher;
         {
             Logger.Log("Started patching Farmer");
             methodBase    = typeof(Player).GetMethod("getItemCount", BindingFlags.Instance | BindingFlags.Public);
             methodPatcher = typeof(FarmerPatcher).GetMethod("Prefix", BindingFlags.Static | BindingFlags.NonPublic);
             Logger.Log("Trying to patch...");
             if (!HarmonyHelper.Patch(methodBase, methodPatcher))
             {
                 return(false);
             }
         }
         {
             Logger.Log("Started patching consumeIngredients");
             methodBase    = typeof(CraftingRecipe).GetMethod("consumeIngredients", BindingFlags.Instance | BindingFlags.Public);
             methodPatcher = typeof(ConsumeIngredientsPatcher).GetMethod("Prefix", BindingFlags.Static | BindingFlags.NonPublic);
             Logger.Log("Trying to patch...");
             if (!HarmonyHelper.Patch(methodBase, methodPatcher))
             {
                 return(false);
             }
         }
     }
     catch (Exception e)
     {
         Logger.Error(e.ToString());
         return(false);
     }
     return(true);
 }
Beispiel #13
0
        public static void Patch()
        {
            try
            {
                HarmonyHelper.Patch();

                Logger.Log("Patched successfully!");

                PFC_Config.Enable = PlayerPrefsExtra.GetBool("pfcEnable", true);

                Logger.Log("Obtained values from config");

                OptionsPanelHandler.RegisterModOptions(new Options("Pickup Full Carry-alls"));

                Logger.Log("Registered mod options");

                ItemActionHelper.RegisterAction(MouseButton.Middle, TechType.LuggageBag, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);
                ItemActionHelper.RegisterAction(MouseButton.Middle, TechType.SmallStorage, InventoryOpener.OnMiddleClick, "open storage", InventoryOpener.Condition);

                /*
                 * ItemActionHandler.RegisterMiddleClickAction(TechType.LuggageBag, InventoryOpener.OnMiddleClick, "open storage");
                 * ItemActionHandler.RegisterMiddleClickAction(TechType.SmallStorage, InventoryOpener.OnMiddleClick, "open storage");
                 *
                 * Logger.Log("Registered middle click actions");
                 */
            }
            catch (Exception e)
            {
                Logger.Exception(e, LoggedWhen.Initializing);
            }
        }
Beispiel #14
0
        public static void Patch()
        {
            HarmonyHelper.Patch();
            new ESS().Patch();

            Common.Logger.Log("Patched");
        }
Beispiel #15
0
        public static void LoadMods()
        {
            var owmlGo = new GameObject();

            owmlGo.AddComponent <OwmlBehaviour>();
            var owmlConfig        = JsonHelper.LoadJsonObject <OwmlConfig>(ConfigPath);
            var owmlDefaultConfig = JsonHelper.LoadJsonObject <OwmlConfig>(DefaultConfigPath);
            var owmlManifest      = JsonHelper.LoadJsonObject <ModManifest>(ManifestPath);

            if (owmlConfig == null || owmlManifest == null)
            {
                // Everything is wrong and can't write to console...
                return;
            }
            var logger = new ModLogger(owmlConfig, owmlManifest);

            logger.Log("Got config!");
            var console = OutputFactory.CreateOutput(owmlConfig, logger, owmlManifest);

            console.WriteLine("Mod loader has been initialized.");
            var modSorter     = new ModSorter(console);
            var modFinder     = new ModFinder(owmlConfig, console);
            var harmonyHelper = new HarmonyHelper(logger, console);
            var events        = new ModEvents(logger, console, harmonyHelper);
            var inputHandler  = new ModInputHandler(logger, console, harmonyHelper, owmlConfig, events);
            var menus         = new ModMenus(console, events, inputHandler, owmlManifest, owmlConfig, owmlDefaultConfig);
            var owo           = new Owo(modFinder, logger, console, owmlConfig, menus, harmonyHelper, inputHandler, modSorter);

            owo.LoadMods();
        }
Beispiel #16
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            LanguageHelper.init();
            CraftHelper.patchAll();

            PersistentConsoleCommands.register <ConsoleCommands>();
        }
Beispiel #17
0
 /// <summary>
 /// Initializes the needed classes for the mod.
 /// </summary>
 private void InitializeClasses()
 {
     PackHelper    = new ContentPackHelper(this);
     Dresser       = new DresserHandler(this, Config);
     PlayerLoader  = new CharacterLoader(this, PackHelper, Dresser);
     MenuPatcher   = new SaveLoadMenuPatcher(this, PlayerLoader);
     HarmonyHelper = new HarmonyHelper(this);
 }
Beispiel #18
0
        public void OnEnabled()
        {
            IsEnabled = true;
            FileStream fs = File.Create("CSURToolBox.txt");

            fs.Close();
            HarmonyHelper.EnsureHarmonyInstalled();
        }
        public void OnEnabled()
        {
            IsEnabled = true;
            FileStream fs = File.Create("MoreEffectiveTransfer.txt");

            fs.Close();
            HarmonyHelper.EnsureHarmonyInstalled();
        }
        public void OnEnabled()
        {
            IsEnabled = true;
            FileStream fs = File.Create("RealConstruction.txt");

            fs.Close();
            HarmonyHelper.EnsureHarmonyInstalled();
        }
Beispiel #21
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            CraftHelper.patchAll();

            LanguageHelper.init();             // after CraftHelper

            DebrisPatcher.init(Mod.loadConfig <PrefabsConfig>(prefabsConfigName, Config.LoadOptions.ProcessAttributes));
        }
 public void OnEnabled()
 {
     HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());
     Enabled = true;
     if (Loading != null && Loading.loadingComplete)
     {
         SubstituteTextureManager.RegenerateCache();
     }
 }
Beispiel #23
0
        /// <summary>
        /// Called by the game when the mod is enabled.
        /// </summary>
        public void OnEnabled()
        {
            // Apply Harmony patches via Cities Harmony.
            // Called here instead of OnCreated to allow the auto-downloader to do its work prior to launch.
            HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());

            // Load the settings file.
            ZoningModSettingsFile.LoadSettings();
        }
 public void OnEnabled()
 {
     System.IO.File.WriteAllText("mod.debug.log", ""); // restart log.
     HarmonyHelper.DoOnHarmonyReady(() => HarmonyUtil.InstallHarmony(HarmonyId));
     if (HelpersExtensions.InGame)
     {
         LifeCycle.Load();
     }
 }
 public void OnEnabled()
 {
     KianCommons.UI.TextureUtil.EmbededResources = false;
     HarmonyHelper.EnsureHarmonyInstalled();
     if (HelpersExtensions.InGame)
     {
         LifeCycle.Load();
     }
 }
Beispiel #26
0
 public void OnEnabled()
 {
     HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());
     Enabled = true;
     if (Loading != null && Loading.loadingComplete)
     {
         Patches.RefreshNets();
     }
 }
        /// <summary>
        /// Called by the game when the mod is enabled.
        /// </summary>
        public void OnEnabled()
        {
            // Apply Harmony patches via Cities Harmony.
            // Called here instead of OnCreated to allow the auto-downloader to do its work prior to launch.
            HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());

            // Setup translation framework.
            Translations.Setup();
        }
Beispiel #28
0
 public void OnEnabled()
 {
     HarmonyHelper.EnsureHarmonyInstalled();
     if (Extensions.InGame)
     {
         LifeCycle.Load();
     }
     IsEnabled = true;
 }
Beispiel #29
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);

            if (config.addConsoleCommands)
            {
                PersistentConsoleCommands.register <ConsoleCommands>();
            }
        }
Beispiel #30
0
        public static void patch()
        {
            HarmonyHelper.patchAll();

            if (config.armsEnergyUsage.enabled)
            {
                ArmsEnergyUsage.refresh();
            }
        }