/// <summary> /// Starts the automatic version check for all mods. /// </summary> internal void RunVersionCheck() { var allMods = PRegistry.Instance.GetAllComponents(ID); // See if Mod Updater triggered master disable if (!PRegistry.GetData <bool>("PLib.VersionCheck.ModUpdaterActive") && allMods != null) { new AllVersionCheckTask(allMods, this).Run(); } }
public static void Patch(Harmony harmony) { if (!PRegistry.GetData <bool>(PATCH_KEY)) { OnRefreshUserMenuDelegate = Traverse.Create <ManualDeliveryKG>() .Field <EventSystem.IntraObjectHandler <ManualDeliveryKG> >(nameof(OnRefreshUserMenuDelegate)).Value; harmony.Patch(typeof(ManualDeliveryKG), nameof(OnSpawn), postfix: new HarmonyMethod(typeof(ManualDeliveryKGPatch), nameof(OnSpawn))); harmony.Patch(typeof(ManualDeliveryKG), nameof(OnCleanUp), prefix: new HarmonyMethod(typeof(ManualDeliveryKGPatch), nameof(OnCleanUp))); harmony.PatchTranspile(typeof(ManualDeliveryKG), "OnRefreshUserMenu", transpiler: new HarmonyMethod(typeof(ManualDeliveryKGPatch), nameof(Transpiler))); PRegistry.PutData(PATCH_KEY, true); } }
internal static void FixDiggable(Harmony instance) { const string BUG_KEY = "Bugs.DisableNeutroniumDig"; if (!StockBugFixOptions.Instance.AllowNeutroniumDig && !PRegistry.GetData <bool>( BUG_KEY)) { #if DEBUG PUtil.LogDebug("Disabling Neutronium digging"); #endif PRegistry.PutData(BUG_KEY, true); instance.Patch(typeof(Diggable).GetMethodSafe("OnSolidChanged", false, PPatchTools.AnyArguments), prefix: new HarmonyMethod( typeof(StockBugsPatches), nameof(PrefixSolidChanged))); } }
/// <summary> /// Fixes the race condition in Steam.UpdateMods. /// </summary> /// <param name="instance">The Harmony instance to use for patching.</param> private void FixModUpdateRace(Harmony instance) { var steamMod = PPatchTools.GetTypeSafe("KMod.Steam"); const string BUG_KEY = "Bugs.ModUpdateRace"; if (steamMod != null && !PRegistry.GetData <bool>(BUG_KEY)) { // Transpile UpdateMods only for Steam versions (not EGS) #if DEBUG PUtil.LogDebug("Transpiling Steam.UpdateMods()"); #endif PRegistry.PutData(BUG_KEY, true); instance.Patch(steamMod.GetMethodSafe("UpdateMods", false, PPatchTools. AnyArguments), transpiler: new HarmonyMethod(typeof(StockBugsPatches), nameof(TranspileUpdateMods))); instance.Patch(typeof(MainMenu).GetMethodSafe("OnSpawn", false), postfix: new HarmonyMethod(typeof(StockBugsPatches), nameof(PostfixMenuSpawn))); } }
public override void OnAllModsLoaded(Harmony harmony, IReadOnlyList <Mod> mods) { const string ASDF = "Bugs.AutosaveDragFix"; const string PACU_SAYS_NO = "Bugs.TropicalPacuRooms"; var options = FastTrackOptions.Instance; base.OnAllModsLoaded(harmony, mods); if (options.MeshRendererOptions == FastTrackOptions.MeshRendererSettings.All && mods != null) { CheckTileCompat(harmony, mods); } // Die pacu bug die if (options.AllocOpts && !PRegistry.GetData <bool>(PACU_SAYS_NO)) { GamePatches.DecorProviderRefreshFix.ApplyPatch(harmony); PRegistry.PutData(PACU_SAYS_NO, true); } if (options.FastUpdatePickups) { CheckFetchCompat(harmony); } if (!PRegistry.GetData <bool>(ASDF)) { // Fix the annoying autosave bug harmony.Patch(typeof(Timelapser), "SaveScreenshot", postfix: new HarmonyMethod( typeof(FastTrackMod), nameof(FastTrackMod.FixTimeLapseDrag))); PRegistry.PutData(ASDF, true); } if (options.FastReachability) { GamePatches.FastCellChangeMonitor.CreateInstance(); } // Fix those world strings UIPatches.FormatStringPatches.ApplyPatch(harmony); }