From b6c182168bce9f03be53cbf362c0a6042de74778 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Mon, 19 May 2025 18:17:05 +0800 Subject: [PATCH] CheatEnabler: unlock orbit radius --- CheatEnabler/CHANGELOG.md | 6 + CheatEnabler/CheatEnabler.cs | 4 + CheatEnabler/CheatEnabler.csproj | 2 +- CheatEnabler/Patches/DysonSpherePatch.cs | 69 ++++- CheatEnabler/UIConfigWindow.cs | 347 +++++++++++++---------- CheatEnabler/package/manifest.json | 2 +- 6 files changed, 264 insertions(+), 166 deletions(-) diff --git a/CheatEnabler/CHANGELOG.md b/CheatEnabler/CHANGELOG.md index 61840ce..55c7b5c 100644 --- a/CheatEnabler/CHANGELOG.md +++ b/CheatEnabler/CHANGELOG.md @@ -3,6 +3,9 @@ ## Changlog +* 2.3.31 + + New feature: `Unlock Dyson Sphere max orbit radius` + + `Remove metadata consumption record in current game`: Fix implementation * 2.3.30 + Fix a warning issue while `No condition build` or `No collision` is enabled. + Increase performance for `Finish build immediately` greatly on pasting large blueprints. @@ -153,6 +156,9 @@ ## 更新日志 +* 2.3.31 + + 新功能:`解锁戴森球最大轨道半径` + + `移除当前存档的元数据消耗记录`:修复实现 * 2.3.30 + 修复了启用`无条件建造`或`无碰撞`时的警告问题 + 粘贴大规模蓝图时大幅提升`立即完成建造`的性能表现 diff --git a/CheatEnabler/CheatEnabler.cs b/CheatEnabler/CheatEnabler.cs index 8a57c9c..9764d07 100644 --- a/CheatEnabler/CheatEnabler.cs +++ b/CheatEnabler/CheatEnabler.cs @@ -81,6 +81,10 @@ public class CheatEnabler : BaseUnityPlugin "Overclock ejector"); DysonSpherePatch.OverclockSiloEnabled = Config.Bind("DysonSphere", "OverclockSilo", false, "Overclock silo"); + DysonSpherePatch.UnlockMaxOrbitRadiusEnabled = Config.Bind("DysonSphere", "UnlockMaxOrbitRadius", false, + "Unlock Dyson Sphere max orbit radius"); + DysonSpherePatch.UnlockMaxOrbitRadiusValue = Config.Bind("DysonSphere", "MaxOrbitRadiusValue", 10_000_000f, + "Unlocked Dyson Sphere max orbit radius value"); CombatPatch.MechaInvincibleEnabled = Config.Bind("Battle", "MechaInvincible", false, "Mecha and Drones/Fleets invincible"); CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false, diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj index f64313f..b5356f5 100644 --- a/CheatEnabler/CheatEnabler.csproj +++ b/CheatEnabler/CheatEnabler.csproj @@ -5,7 +5,7 @@ net472 org.soardev.cheatenabler DSP MOD - CheatEnabler - 2.3.30 + 2.3.31 true latest CheatEnabler diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs index 61a47ad..82f147e 100644 --- a/CheatEnabler/Patches/DysonSpherePatch.cs +++ b/CheatEnabler/Patches/DysonSpherePatch.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Reflection.Emit; using BepInEx.Configuration; using HarmonyLib; +using UnityEngine; using UXAssist.Common; namespace CheatEnabler.Patches; -public class DysonSpherePatch: PatchImpl +public class DysonSpherePatch : PatchImpl { public static ConfigEntry SkipBulletEnabled; public static ConfigEntry SkipAbsorbEnabled; @@ -15,6 +16,8 @@ public class DysonSpherePatch: PatchImpl public static ConfigEntry EjectAnywayEnabled; public static ConfigEntry OverclockEjectorEnabled; public static ConfigEntry OverclockSiloEnabled; + public static ConfigEntry UnlockMaxOrbitRadiusEnabled; + public static ConfigEntry UnlockMaxOrbitRadiusValue; private static bool _instantAbsorb; public static void Init() @@ -25,6 +28,7 @@ public class DysonSpherePatch: PatchImpl EjectAnywayEnabled.SettingChanged += (_, _) => EjectAnywayPatch.Enable(EjectAnywayEnabled.Value); OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value); OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value); + UnlockMaxOrbitRadiusEnabled.SettingChanged += (_, _) => UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value); } public static void Start() @@ -35,6 +39,7 @@ public class DysonSpherePatch: PatchImpl EjectAnywayPatch.Enable(EjectAnywayEnabled.Value); OverclockEjector.Enable(OverclockEjectorEnabled.Value); OverclockSilo.Enable(OverclockSiloEnabled.Value); + UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value); Enable(true); } @@ -47,6 +52,7 @@ public class DysonSpherePatch: PatchImpl EjectAnywayPatch.Enable(false); OverclockEjector.Enable(false); OverclockSilo.Enable(false); + UnlockMaxOrbitRadius.Enable(false); } [HarmonyTranspiler] @@ -83,7 +89,7 @@ public class DysonSpherePatch: PatchImpl return matcher.InstructionEnumeration(); } - private class SkipBulletPatch: PatchImpl + private class SkipBulletPatch : PatchImpl { private static long _sailLifeTime; private static DysonSailCache[][] _sailsCache; @@ -281,7 +287,7 @@ public class DysonSpherePatch: PatchImpl } } - private class SkipAbsorbPatch: PatchImpl + private class SkipAbsorbPatch : PatchImpl { protected override void OnEnable() { @@ -333,7 +339,7 @@ public class DysonSpherePatch: PatchImpl } } - private class QuickAbsorbPatch: PatchImpl + private class QuickAbsorbPatch : PatchImpl { protected override void OnEnable() { @@ -384,7 +390,7 @@ public class DysonSpherePatch: PatchImpl } } - private class EjectAnywayPatch: PatchImpl + private class EjectAnywayPatch : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] @@ -414,7 +420,7 @@ public class DysonSpherePatch: PatchImpl } } - private class OverclockEjector: PatchImpl + private class OverclockEjector : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] @@ -467,7 +473,7 @@ public class DysonSpherePatch: PatchImpl } } - private class OverclockSilo: PatchImpl + private class OverclockSilo : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))] @@ -519,4 +525,53 @@ public class DysonSpherePatch: PatchImpl return matcher.InstructionEnumeration(); } } + + private class UnlockMaxOrbitRadius : PatchImpl + { + protected override void OnEnable() + { + OnViewStarChange(null, null); + UnlockMaxOrbitRadiusValue.SettingChanged += OnViewStarChange; + } + + protected override void OnDisable() + { + OnViewStarChange(null, null); + UnlockMaxOrbitRadiusValue.SettingChanged -= OnViewStarChange; + } + + public static void OnViewStarChange(object o, EventArgs e) + { + var dysonEditor = UIRoot.instance?.uiGame?.dysonEditor; + if (dysonEditor == null || !dysonEditor.gameObject.activeSelf) return; + dysonEditor.selection?.onViewStarChange?.Invoke(); + } + + [HarmonyTranspiler] + [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckLayerRadius))] + [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckSwarmRadius))] + [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.QueryLayerRadius))] + [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.QuerySwarmRadius))] + [HarmonyPatch(typeof(UIDEAddLayerDialogue), nameof(UIDEAddLayerDialogue.OnViewStarChange))] + [HarmonyPatch(typeof(UIDEAddSwarmDialogue), nameof(UIDEAddSwarmDialogue.OnViewStarChange))] + [HarmonyPatch(typeof(UIDysonEditor), nameof(UIDysonEditor.OnViewStarChange))] + [HarmonyPatch(typeof(UIDESwarmOrbitInfo), nameof(UIDESwarmOrbitInfo._OnInit))] + [HarmonyPatch(typeof(UIDysonOrbitPreview), nameof(UIDysonOrbitPreview.UpdateAscNodeGizmos))] + private static IEnumerable MaxOrbitRadiusPatch_Transpiler(IEnumerable instructions, ILGenerator generator) + { + var matcher = new CodeMatcher(instructions, generator); + matcher.MatchForward(false, + new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphere), nameof(DysonSphere.maxOrbitRadius))) + ); + matcher.Repeat(m => + { + m.Advance(1).InsertAndAdvance( + new CodeInstruction(OpCodes.Pop), + new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(DysonSpherePatch), nameof(UnlockMaxOrbitRadiusValue))), + new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(ConfigEntry), nameof(ConfigEntry.Value))) + ); + }); + return matcher.InstructionEnumeration(); + } + } } diff --git a/CheatEnabler/UIConfigWindow.cs b/CheatEnabler/UIConfigWindow.cs index d5e41ba..3841c9f 100644 --- a/CheatEnabler/UIConfigWindow.cs +++ b/CheatEnabler/UIConfigWindow.cs @@ -3,6 +3,7 @@ using CheatEnabler.Patches; using UnityEngine; using UXAssist.UI; using UXAssist.Common; +using System; namespace CheatEnabler; @@ -63,6 +64,7 @@ public static class UIConfigWindow I18N.Add("Eject anyway", "Eject anyway", "全球弹射"); I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)"); I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)"); + I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径"); I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造"); I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形"); I18N.Add("Instant hand-craft", "Instant hand-craft", "快速手动制造"); @@ -77,171 +79,202 @@ public static class UIConfigWindow MyConfigWindow.OnUpdateUI += UpdateUI; } - private static void CreateUI(MyConfigWindow wnd, RectTransform trans) + class MaxOrbitRadiusValueMapper : MyWindow.RangeValueMapper { - _windowTrans = trans; - // General tab - var x = 0f; - var y = 10f; - wnd.AddSplitter(trans, 10f); - wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler"); - var tab1 = wnd.AddTab(_windowTrans, "General"); - var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts"); - x += cb.Width + 5f; - y += 6f; - wnd.AddTipsButton2(x, y, tab1, "Dev Shortcuts", "Dev Shortcuts Tips", "dev-shortcuts-tips"); - x = 0; - y += 30f; - wnd.AddCheckBox(x, y, tab1, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks"); - y += 36f; - cb = wnd.AddCheckBox(x, y, tab1, GamePatch.UnlockTechEnabled, "Unlock Tech with Key-Modifiers"); - x += cb.Width + 5f; - y += 6f; - wnd.AddTipsButton2(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips"); - x = 0f; - y += 30f + 36f; - wnd.AddButton(x, y, 400f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions); - y += 36f; - wnd.AddButton(x, y, 400f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions); - y += 36f; - _clearBanBtn = wnd.AddButton(x, y, 400f, tab1, "Clear metadata flag which bans achievements", 16, "button-clear-ban-list", PlayerFunctions.ClearMetadataBanAchievements); - x = 300f; - y = 10f; - _resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; }); - - var tab2 = wnd.AddTab(_windowTrans, "Factory"); - x = 0f; - y = 10f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.ArchitectModeEnabled, "Architect mode"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoConditionEnabled, "Build without condition"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator"); - x += 26f; - y += 26f; - var cb1 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13); - y += 26f; - var cb2 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13); - y += 26f; - var cb3 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13); - y += 26f; - var cb4 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13); - x += cb4.Width + 5f; - y += 6f; - var tip1 = wnd.AddTipsButton2(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips"); - x = 0f; - y += 30f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel"); - - FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += (_, _) => + public MaxOrbitRadiusValueMapper() : base(1, 20) { - OnBeltSignalChanged(); - }; - OnBeltSignalChanged(); - x = 350f; - y = 10f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemovePowerSpaceLimitEnabled, "Remove power space limit"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled, "Wind Turbines do global power coverage"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostWindPowerEnabled, "Boost wind power"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostSolarPowerEnabled, "Boost solar power"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power"); - y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power"); - y += 26f; - wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13); + } - // Planet Tab - var tab3 = wnd.AddTab(_windowTrans, "Planet"); - x = 0f; - y = 10f; - wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources"); - y += 36f; - wnd.AddCheckBox(x, y, tab3, ResourcePatch.FastMiningEnabled, "Fast Mining"); - y += 36f; - wnd.AddCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere"); - y += 36f; - wnd.AddCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles"); - y += 36f; - wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft"); - y += 36f; - wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)"); - x = 400f; - y = 10f; - wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); }); - y += 36f; - wnd.AddButton(x, y, 200f, tab3, "矿物还原标题", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); }); - y += 36f; - wnd.AddButton(x, y, 200f, tab3, "铺满地基提示", 16, "button-reform-all", () => + public override int ValueToIndex(float value) { - var player = GameMain.mainPlayer; - if (player == null) return; - var reformTool = player.controller.actionBuild.reformTool; - var factory = GameMain.localPlanet?.factory; - if (factory == null) return; - GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins); - }); - y += 36f; - wnd.AddButton(x, y, 200f, tab3, "还原地形提示", 16, "button-reform-revert-all", () => + int result = Mathf.FloorToInt(value / 500_000f); + if (result < 1) result = 1; + if (result > 20) result = 20; + return result; + } + + public override float IndexToValue(int index) { - var factory = GameMain.localPlanet?.factory; - if (factory == null) return; - GameMain.localPlanet.factory.PlanetReformRevert(); - }); - - var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere"); - x = 0f; - y = 10f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period"); - y += 36f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period"); - y += 36f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsorbEnabled, "Quick absorb"); - y += 36f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway"); - y += 36f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors"); - y += 36f; - wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos"); - x = 300f; - y = 10f; - wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly); - - var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat"); - x = 0f; - y = 10f; - wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible"); - y += 36f; - wnd.AddCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible"); - y += 36f; - wnd.AddCheckBox(x, y, tab5, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers"); - x = 400f; - y = 10f; - wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace); - y += 36f; - wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical); - return; - - void OnBeltSignalChanged() - { - var on = FactoryPatch.BeltSignalGeneratorEnabled.Value; - cb1.gameObject.SetActive(on); - cb2.gameObject.SetActive(on); - cb3.gameObject.SetActive(on); - cb4.gameObject.SetActive(on); - tip1.gameObject.SetActive(on); + return index * 500_000f; } } + private static void CreateUI(MyConfigWindow wnd, RectTransform trans) + { + _windowTrans = trans; + // General tab + var x = 0f; + var y = 10f; + wnd.AddSplitter(trans, 10f); + wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler"); + var tab1 = wnd.AddTab(_windowTrans, "General"); + var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts"); + x += cb.Width + 5f; + y += 6f; + wnd.AddTipsButton2(x, y, tab1, "Dev Shortcuts", "Dev Shortcuts Tips", "dev-shortcuts-tips"); + x = 0; + y += 30f; + wnd.AddCheckBox(x, y, tab1, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks"); + y += 36f; + cb = wnd.AddCheckBox(x, y, tab1, GamePatch.UnlockTechEnabled, "Unlock Tech with Key-Modifiers"); + x += cb.Width + 5f; + y += 6f; + wnd.AddTipsButton2(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips"); + x = 0f; + y += 30f + 36f; + wnd.AddButton(x, y, 400f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions); + y += 36f; + wnd.AddButton(x, y, 400f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions); + y += 36f; + _clearBanBtn = wnd.AddButton(x, y, 400f, tab1, "Clear metadata flag which bans achievements", 16, "button-clear-ban-list", PlayerFunctions.ClearMetadataBanAchievements); + x = 300f; + y = 10f; + _resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; }); + + var tab2 = wnd.AddTab(_windowTrans, "Factory"); + x = 0f; + y = 10f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.ArchitectModeEnabled, "Architect mode"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoConditionEnabled, "Build without condition"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator"); + x += 26f; + y += 26f; + var cb1 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13); + y += 26f; + var cb2 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13); + y += 26f; + var cb3 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13); + y += 26f; + var cb4 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13); + x += cb4.Width + 5f; + y += 6f; + var tip1 = wnd.AddTipsButton2(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips"); + x = 0f; + y += 30f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel"); + { + FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged; + wnd.OnFree += () => { FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged; }; + OnBeltSignalChanged(null, null); + void OnBeltSignalChanged(object o, EventArgs e) + { + var on = FactoryPatch.BeltSignalGeneratorEnabled.Value; + cb1.gameObject.SetActive(on); + cb2.gameObject.SetActive(on); + cb3.gameObject.SetActive(on); + cb4.gameObject.SetActive(on); + tip1.gameObject.SetActive(on); + } + } + x = 350f; + y = 10f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemovePowerSpaceLimitEnabled, "Remove power space limit"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled, "Wind Turbines do global power coverage"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostWindPowerEnabled, "Boost wind power"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostSolarPowerEnabled, "Boost solar power"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power"); + y += 36f; + wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power"); + y += 26f; + wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13); + + // Planet Tab + var tab3 = wnd.AddTab(_windowTrans, "Planet"); + x = 0f; + y = 10f; + wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources"); + y += 36f; + wnd.AddCheckBox(x, y, tab3, ResourcePatch.FastMiningEnabled, "Fast Mining"); + y += 36f; + wnd.AddCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere"); + y += 36f; + wnd.AddCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles"); + y += 36f; + wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft"); + y += 36f; + wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)"); + x = 400f; + y = 10f; + wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); }); + y += 36f; + wnd.AddButton(x, y, 200f, tab3, "矿物还原标题", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); }); + y += 36f; + wnd.AddButton(x, y, 200f, tab3, "铺满地基提示", 16, "button-reform-all", () => + { + var player = GameMain.mainPlayer; + if (player == null) return; + var reformTool = player.controller.actionBuild.reformTool; + var factory = GameMain.localPlanet?.factory; + if (factory == null) return; + GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins); + }); + y += 36f; + wnd.AddButton(x, y, 200f, tab3, "还原地形提示", 16, "button-reform-revert-all", () => + { + var factory = GameMain.localPlanet?.factory; + if (factory == null) return; + GameMain.localPlanet.factory.PlanetReformRevert(); + }); + + var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere"); + x = 0f; + y = 10f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsorbEnabled, "Quick absorb"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos"); + y += 36f; + wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius"); + y += 30f; + { + var slider = wnd.AddSlider(x + 20, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f); + DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged; + wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; }; + UnlockMaxOrbitRadiusChanged(null, null); + void UnlockMaxOrbitRadiusChanged(object o, EventArgs e) + { + slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value; + } + ; + } + x = 300f; + y = 10f; + wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly); + + var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat"); + x = 0f; + y = 10f; + wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible"); + y += 36f; + wnd.AddCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible"); + y += 36f; + wnd.AddCheckBox(x, y, tab5, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers"); + x = 400f; + y = 10f; + wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace); + y += 36f; + wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical); + } + private static void UpdateUI() { UpdateButtons(); diff --git a/CheatEnabler/package/manifest.json b/CheatEnabler/package/manifest.json index 42a0ae8..2fe5bef 100644 --- a/CheatEnabler/package/manifest.json +++ b/CheatEnabler/package/manifest.json @@ -1,6 +1,6 @@ { "name": "CheatEnabler", - "version_number": "2.3.30", + "version_number": "2.3.31", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler", "description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测", "dependencies": [