public static void OnLoad()
 {
     PUtil.InitLibrary();
     PUtil.RegisterPatchClass(typeof(MoreTinkerablePlantsPatches));
     POptions.RegisterOptions(typeof(MoreTinkerablePlantsOptions));
 }
Esempio n. 2
0
 public static void Postfix(WorldGen __instance)
 {
     // init Options
     Options = POptions.ReadSettings <ModOptions>() ?? new ModOptions();
 }
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     PUtil.RegisterPatchClass(typeof(MechanicsStationPatches));
     POptions.RegisterOptions(typeof(MechanicsStationOptions));
 }
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     PUtil.RegisterPatchClass(typeof(BetterPlantTendingPatches));
     POptions.RegisterOptions(typeof(BetterPlantTendingOptions));
 }
Esempio n. 5
0
 public static void Reload()
 {
     instance = POptions.ReadSettings <Options>() ?? new Options();
 }
Esempio n. 6
0
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     POptions.RegisterOptions(typeof(Settings));
     Settings.Init(POptions.ReadSettings <Settings>());
 }
Esempio n. 7
0
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     POptions.RegisterOptions(typeof(ClaustrophobiaOptions));
 }
Esempio n. 8
0
 /// <summary>
 /// Applied to ModsScreen if mod options are registered, after BuildDisplay runs.
 /// </summary>
 private static void BuildDisplay_Postfix(IEnumerable ___displayedMods,
                                          GameObject ___entryPrefab)
 {
     POptions.BuildDisplay(___displayedMods, ___entryPrefab);
 }
Esempio n. 9
0
        /// <summary>
        /// Applies all patches.
        /// </summary>
        /// <param name="instance">The Harmony instance to use when patching.</param>
        private static void PatchAll(HarmonyInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            // ColonyAchievementStatus
            if (ACHIEVEMENT_SERIALIZE != null)
            {
                // TODO Vanilla/DLC code
                instance.Patch(typeof(ColonyAchievementStatus), nameof(ColonyAchievementStatus.
                                                                       Serialize), PatchMethod(nameof(Serialize_Prefix)), null);
            }

            // Db
            instance.Patch(typeof(Db), nameof(Db.Initialize), PatchMethod(nameof(
                                                                              Initialize_Prefix)), PatchMethod(nameof(Initialize_Postfix)));

            // Game
            instance.Patch(typeof(Game), "DestroyInstances", null, PatchMethod(nameof(
                                                                                   Game_DestroyInstances_Postfix)));
            instance.Patch(typeof(Game), "OnPrefabInit", null, PatchMethod(nameof(
                                                                               Game_OnPrefabInit_Postfix)));

            // GameInputMapping
            instance.Patch(typeof(GameInputMapping), nameof(GameInputMapping.
                                                            SetDefaultKeyBindings), null, PatchMethod(nameof(
                                                                                                          SetDefaultKeyBindings_Postfix)));

            // GameUtil
            instance.Patch(typeof(GameUtil), nameof(GameUtil.GetKeycodeLocalized),
                           PatchMethod(nameof(GetKeycodeLocalized_Prefix)), null);

            // KInputController
            instance.PatchConstructor(typeof(KInputController.KeyDef), new Type[] {
                typeof(KKeyCode), typeof(Modifier)
            }, null, PatchMethod(nameof(CKeyDef_Postfix)));
            instance.Patch(typeof(KInputController), nameof(KInputController.IsActive),
                           PatchMethod(nameof(IsActive_Prefix)), null);
            instance.Patch(typeof(KInputController), nameof(KInputController.QueueButtonEvent),
                           PatchMethod(nameof(QueueButtonEvent_Prefix)), null);

            if (PLightManager.InitInstance())
            {
                // DiscreteShadowCaster
                instance.Patch(typeof(DiscreteShadowCaster), nameof(DiscreteShadowCaster.
                                                                    GetVisibleCells), PatchMethod(nameof(GetVisibleCells_Prefix)), null);

                // Light2D
                instance.Patch(typeof(Light2D), "AddToScenePartitioner",
                               PatchMethod(nameof(AddToScenePartitioner_Prefix)), null);
                instance.Patch(typeof(Light2D), nameof(Light2D.RefreshShapeAndPosition), null,
                               PatchMethod(nameof(RefreshShapeAndPosition_Postfix)));

                // LightGridEmitter
                instance.Patch(typeof(LightGridEmitter), nameof(LightGridEmitter.AddToGrid),
                               null, PatchMethod(nameof(AddToGrid_Postfix)));
                instance.Patch(typeof(LightGridEmitter), "ComputeLux",
                               PatchMethod(nameof(ComputeLux_Prefix)), null);
                instance.Patch(typeof(LightGridEmitter), nameof(LightGridEmitter.
                                                                RemoveFromGrid), null, PatchMethod(nameof(RemoveFromGrid_Postfix)));
                instance.Patch(typeof(LightGridEmitter), nameof(LightGridEmitter.
                                                                UpdateLitCells), PatchMethod(nameof(UpdateLitCells_Prefix)), null);

                // LightGridManager
                instance.Patch(typeof(LightGridManager), nameof(LightGridManager.
                                                                CreatePreview), PatchMethod(nameof(CreatePreview_Prefix)), null);

                // LightShapePreview
                instance.Patch(typeof(LightShapePreview), "Update",
                               PatchMethod(nameof(LightShapePreview_Update_Prefix)), null);

                // Rotatable
                instance.Patch(typeof(Rotatable), "OrientVisualizer", null,
                               PatchMethod(nameof(OrientVisualizer_Postfix)));
            }

            // MainMenu
            instance.Patch(typeof(MainMenu), "OnSpawn", null, PatchMethod(
                               nameof(MainMenu_OnSpawn_Postfix)));

            // PBuilding
            instance.Patch(typeof(BuildingTemplates), nameof(BuildingTemplates.
                                                             CreateBuildingDef), null, PatchMethod(nameof(CreateBuildingDef_Postfix)));
            instance.Patch(typeof(EquipmentTemplates), nameof(EquipmentTemplates.
                                                              CreateEquipmentDef), null, PatchMethod(nameof(CreateEquipmentDef_Postfix)));
            if (PBuilding.CheckBuildings())
            {
                instance.Patch(typeof(GeneratedBuildings), nameof(GeneratedBuildings.
                                                                  LoadGeneratedBuildings), PatchMethod(nameof(
                                                                                                           LoadGeneratedBuildings_Prefix)), null);
            }

            // PCodex
            instance.Patch(typeof(CodexCache), nameof(CodexCache.CollectEntries), null,
                           PatchMethod(nameof(CollectEntries_Postfix)));
            instance.Patch(typeof(CodexCache), nameof(CodexCache.CollectSubEntries), null,
                           PatchMethod(nameof(CollectSubEntries_Postfix)));

            // PLocalization
            var locale = Localization.GetLocale();

            if (locale != null)
            {
                PLocalization.LocalizeAll(locale);
                PLocalizationItself.LocalizeItself(locale);
            }

            // ModsScreen
            POptions.Init();
            instance.Patch(typeof(ModsScreen), "BuildDisplay", null, PatchMethod(nameof(
                                                                                     BuildDisplay_Postfix)));

            // SteamUGCService
            var ugc = PPatchTools.GetTypeSafe("SteamUGCService", "Assembly-CSharp");

            if (ugc != null)
            {
                try {
                    instance.PatchTranspile(ugc, "LoadPreviewImage", PatchMethod(nameof(
                                                                                     LoadPreviewImage_Transpile)));
                } catch (Exception e) {
                    PUtil.LogExcWarn(e);
                }
            }

            // TMPro.TMP_InputField
            var tmpType = PPatchTools.GetTypeSafe("TMPro.TMP_InputField");

            if (tmpType != null)
            {
                try {
                    instance.Patch(tmpType, "AssignPositioningIfNeeded",
                                   PatchMethod(nameof(AssignPositioningIfNeeded_Prefix)), null);
                    instance.Patch(tmpType, "OnEnable", null, PatchMethod(
                                       nameof(OnEnable_Postfix)));
                } catch (Exception) {
                    PUtil.LogWarning("Unable to patch TextMeshPro bug, text fields may " +
                                     "display improperly inside scroll areas");
                }
            }

            // Postload, legacy and normal
            PPatchManager.ExecuteLegacyPostload();
            PPatchManager.RunAll(RunAt.AfterModsLoad);
        }
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     options = new DeselectMaterialsOptions();
     POptions.RegisterOptions(typeof(DeselectMaterialsOptions));
 }
Esempio n. 11
0
 public static void OnLoad()
 {
     StartLogging();
     PUtil.InitLibrary(false);
     POptions.RegisterOptions(typeof(AdvancedStartOptions));
 }
Esempio n. 12
0
 public static void PLib_Initalize()
 {
     _instance = POptions.ReadSettingsForAssembly <Settings>();
 }
 public static void OnLoad()
 {
     StartLogging();
     PUtil.InitLibrary(false);
     POptions.RegisterOptions(typeof(PrintingPodRefundSettings));
 }
 public static PrintingPodRefundSettings GetSettings()
 {
     return(POptions.ReadSettings <PrintingPodRefundSettings>());
 }
Esempio n. 15
0
 public static void OnLoad()
 {
     PUtil.InitLibrary(true);
     PUtil.RegisterPatchClass(typeof(VaricolouredBalloonsPatches));
     POptions.RegisterOptions(typeof(VaricolouredBalloonsOptions));
 }
Esempio n. 16
0
 /// <summary>
 /// Loads the settings for this mod.
 /// </summary>
 internal static void LoadSettings()
 {
     Settings = POptions.ReadSettingsForAssembly <ModUpdateInfo>() ??
                new ModUpdateInfo();
 }
Esempio n. 17
0
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     POptions.RegisterOptions(typeof(StockBugFixOptions));
 }
Esempio n. 18
0
 public static void OnLoad()
 {
     StartLogging();
     InitLibrary();
     POptions.RegisterOptions(typeof(DrainOptions));
 }
Esempio n. 19
0
		public static void OnLoad() {
			PUtil.InitLibrary();
			POptions.RegisterOptions(typeof(SweepByTypeOptions));
			PLocalization.Register();
			Options = null;
		}
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     PUtil.RegisterPatchClass(typeof(CarouselCentrifugePatches));
     POptions.RegisterOptions(typeof(CarouselCentrifugeOptions));
 }