1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 18:22:18 +08:00

refactoring UXAssist and CheatEnabler

This commit is contained in:
2024-09-17 01:49:25 +08:00
parent db0a9522da
commit fb916b3813
31 changed files with 858 additions and 1260 deletions

View File

@@ -1,69 +0,0 @@
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
namespace CheatEnabler;
public static class AbnormalDisabler
{
public static ConfigEntry<bool> Enabled;
private static Dictionary<int, AbnormalityDeterminator> _savedDeterminators;
private static Harmony _patch;
public static void Init()
{
_patch ??= Harmony.CreateAndPatchAll(typeof(AbnormalDisabler));
}
public static void Uninit()
{
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")]
private static bool DisableAbnormalLogic()
{
return !Enabled.Value;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")]
private static void DisableAbnormalDeterminators(AbnormalityLogic __instance)
{
_savedDeterminators = __instance.determinators;
Enabled.SettingChanged += (_, _) =>
{
if (Enabled.Value)
{
_savedDeterminators = __instance.determinators;
__instance.determinators = new Dictionary<int, AbnormalityDeterminator>();
foreach (var p in _savedDeterminators)
{
p.Value.OnUnregEvent();
}
}
else
{
__instance.determinators = _savedDeterminators;
foreach (var p in _savedDeterminators)
{
p.Value.OnRegEvent();
}
}
};
_savedDeterminators = __instance.determinators;
if (!Enabled.Value) return;
__instance.determinators = new Dictionary<int, AbnormalityDeterminator>();
foreach (var p in _savedDeterminators)
{
p.Value.OnUnregEvent();
}
}
}

View File

@@ -1,4 +1,9 @@
using BepInEx;
using System.Reflection;
using BepInEx;
using CheatEnabler.Functions;
using CheatEnabler.Patches;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
@@ -11,10 +16,10 @@ public class CheatEnabler : BaseUnityPlugin
private void Awake()
{
DevShortcuts.Enabled = Config.Bind("General", "DevShortcuts", false, "Enable DevMode shortcuts");
AbnormalDisabler.Enabled = Config.Bind("General", "DisableAbnormalChecks", false,
GamePatch.DevShortcutsEnabled = Config.Bind("General", "DevShortcuts", false, "Enable DevMode shortcuts");
GamePatch.AbnormalDisablerEnabled = Config.Bind("General", "DisableAbnormalChecks", false,
"disable all abnormal checks");
TechPatch.Enabled = Config.Bind("General", "UnlockTech", false,
GamePatch.UnlockTechEnabled = Config.Bind("General", "UnlockTech", false,
"Unlock clicked tech by holding key-modifilers(Shift/Alt/Ctrl)");
FactoryPatch.ImmediateEnabled = Config.Bind("Build", "ImmediateBuild", false,
"Build immediately");
@@ -78,33 +83,19 @@ public class CheatEnabler : BaseUnityPlugin
"Mecha and Drones/Fleets invincible");
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,
"Buildings invincible");
}
private void Start() {
UIConfigWindow.Init();
DevShortcuts.Init();
AbnormalDisabler.Init();
TechPatch.Init();
FactoryPatch.Init();
ResourcePatch.Init();
PlanetPatch.Init();
Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "CheatEnabler.Patches")
.Do(type => type.GetMethod("Init")?.Invoke(null, null));
PlayerFunctions.Init();
PlayerPatch.Init();
DysonSpherePatch.Init();
DysonSphereFunctions.Init();
CombatPatch.Init();
}
private void OnDestroy()
{
CombatPatch.Uninit();
DysonSpherePatch.Uninit();
PlayerPatch.Uninit();
PlanetPatch.Uninit();
ResourcePatch.Uninit();
FactoryPatch.Uninit();
TechPatch.Uninit();
AbnormalDisabler.Uninit();
DevShortcuts.Uninit();
Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "CheatEnabler.Patches")
.Do(type => type.GetMethod("Uninit")?.Invoke(null, null));
}
private void Update()

View File

@@ -1,110 +0,0 @@
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
namespace CheatEnabler;
public static class DevShortcuts
{
public static ConfigEntry<bool> Enabled;
private static Harmony _patch;
private static PlayerAction_Test _test;
public static void Init()
{
_patch ??= Harmony.CreateAndPatchAll(typeof(DevShortcuts));
Enabled.SettingChanged += (_, _) =>
{
if (_test != null) _test.active = Enabled.Value;
};
}
public static void Uninit()
{
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.Init))]
private static void PlayerController_Init_Postfix(PlayerController __instance)
{
var cnt = __instance.actions.Length;
var newActions = new PlayerAction[cnt + 1];
for (var i = 0; i < cnt; i++)
{
newActions[i] = __instance.actions[i];
}
_test = new PlayerAction_Test();
_test.Init(__instance.player);
_test.active = Enabled.Value;
newActions[cnt] = _test;
__instance.actions = newActions;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.GameTick))]
private static void PlayerAction_Test_GameTick_Postfix(PlayerAction_Test __instance)
{
__instance.Update();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))]
private static IEnumerable<CodeInstruction> PlayerAction_Test_Update_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.End().MatchBack(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlayerAction_Test), nameof(PlayerAction_Test.active)))
);
var pos = matcher.Pos;
/* Remove Shift+F4 part of the method */
matcher.Start().RemoveInstructions(pos).MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(GameMain), "get_sandboxToolsEnabled")),
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Ceq)
);
var labels = matcher.Labels;
matcher.SetInstructionAndAdvance(
new CodeInstruction(OpCodes.Ldc_I4_1).WithLabels(labels)
).RemoveInstructions(2);
/* Remove Ctrl+A */
matcher.Start().MatchForward(false,
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) && instr.OperandIs(0x61)),
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(UnityEngine.Input), nameof(UnityEngine.Input.GetKeyDown), new[] { typeof(UnityEngine.KeyCode) }))
);
labels = matcher.Labels;
matcher.Labels = null;
matcher.RemoveInstructions(2);
matcher.Opcode = OpCodes.Br;
matcher.Labels = labels;
return matcher.InstructionEnumeration();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.FrameLogic))]
private static IEnumerable<CodeInstruction> GameCamera_Logic_Transpiler(IEnumerable<CodeInstruction> instructions)
{
var matcher = new CodeMatcher(instructions);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameCamera), nameof(GameCamera.finalPoser))),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(CameraPoser), nameof(CameraPoser.cameraPose)))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.Insert(
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
Transpilers.EmitDelegate((GameCamera camera) =>
{
if (PlayerAction_Test.lockCam)
{
camera.finalPoser.cameraPose = PlayerAction_Test.camPose;
}
})
);
return matcher.InstructionEnumeration();
}
}

View File

@@ -1,7 +1,7 @@
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Functions;
public static class DysonSphereFunctions
{
@@ -42,8 +42,8 @@ public static class DysonSphereFunctions
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
var totalCpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
var rocketCount = 0;
var solarSailCount = 0;
var rocketCount = 0L;
var solarSailCount = 0L;
foreach (var dysonSphereLayer in dysonSphere.layersIdBased)
{
if (dysonSphereLayer == null) continue;
@@ -112,11 +112,24 @@ public static class DysonSphereFunctions
{
lock (productRegister)
{
if (rocketCount > 0) productRegister[11902] += rocketCount;
if (solarSailCount > 0)
var count = rocketCount;
while (count > 0x40000000L)
{
productRegister[11901] += solarSailCount;
productRegister[11903] += solarSailCount;
productRegister[11902] += 0x40000000;
count -= 0x40000000;
}
if (count > 0L) productRegister[11902] += (int)count;
count = solarSailCount;
while (count > 0x40000000L)
{
productRegister[11901] += 0x40000000;
productRegister[11903] += 0x40000000;
count -= 0x40000000;
}
if (count > 0L)
{
productRegister[11901] += (int)count;
productRegister[11903] += (int)count;
}
}
}
@@ -125,7 +138,13 @@ public static class DysonSphereFunctions
{
lock (consumeRegister)
{
if (solarSailCount > 0) consumeRegister[11901] += solarSailCount;
var count = solarSailCount;
while (count > 0x40000000L)
{
consumeRegister[11901] += 0x40000000;
count -= 0x40000000;
}
if (count > 0L) consumeRegister[11901] += (int)count;
}
}
});

View File

@@ -1,6 +1,6 @@
using Random = UnityEngine.Random;
namespace CheatEnabler;
namespace CheatEnabler.Functions;
public static class PlanetFunctions
{
public static void BuryAllVeins(bool bury)

View File

@@ -2,7 +2,7 @@
using System.Linq;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Functions;
public static class PlayerFunctions
{

View File

@@ -3,8 +3,9 @@ using System.Reflection;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class CombatPatch
{
@@ -25,23 +26,8 @@ public static class CombatPatch
MechaInvincible.Enable(false);
}
private static class MechaInvincible
private class MechaInvincible: PatchImpl<MechaInvincible>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(MechaInvincible));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)]
private static IEnumerable<CodeInstruction> Player_get_invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -75,23 +61,8 @@ public static class CombatPatch
}
}
private static class BuildingsInvincible
private class BuildingsInvincible: PatchImpl<BuildingsInvincible>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BuildingsInvincible));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]

View File

@@ -5,7 +5,7 @@ using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class DysonSpherePatch
{
@@ -82,12 +82,11 @@ public static class DysonSpherePatch
return matcher.InstructionEnumeration();
}
private static class SkipBulletPatch
private class SkipBulletPatch: PatchImpl<SkipBulletPatch>
{
private static long _sailLifeTime;
private static DysonSailCache[][] _sailsCache;
private static int[] _sailsCacheLen, _sailsCacheCapacity;
private static Harmony _patch;
private struct DysonSailCache
{
@@ -107,21 +106,16 @@ public static class DysonSpherePatch
}
}
public static void Enable(bool on)
protected override void OnEnable()
{
if (on)
{
UpdateSailLifeTime();
UpdateSailsCacheForThisGame();
_patch ??= Harmony.CreateAndPatchAll(typeof(SkipBulletPatch));
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
}
else
{
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
_patch?.UnpatchSelf();
_patch = null;
}
UpdateSailLifeTime();
UpdateSailsCacheForThisGame();
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
}
private static void UpdateSailLifeTime()
@@ -286,20 +280,16 @@ public static class DysonSpherePatch
}
}
private static class SkipAbsorbPatch
private class SkipAbsorbPatch: PatchImpl<SkipAbsorbPatch>
{
private static Harmony _patch;
public static void Enable(bool on)
protected override void OnEnable()
{
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(SkipAbsorbPatch));
return;
}
_patch?.UnpatchSelf();
_patch = null;
_instantAbsorb = QuickAbsorbEnabled.Value;
}
protected override void OnDisable()
{
_instantAbsorb = false;
}
[HarmonyTranspiler]
@@ -342,23 +332,18 @@ public static class DysonSpherePatch
}
}
private static class QuickAbsorbPatch
private class QuickAbsorbPatch: PatchImpl<QuickAbsorbPatch>
{
private static Harmony _patch;
public static void Enable(bool on)
protected override void OnEnable()
{
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(QuickAbsorbPatch));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
_instantAbsorb = SkipAbsorbEnabled.Value;
}
protected override void OnDisable()
{
_instantAbsorb = false;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(DysonSphereLayer), nameof(DysonSphereLayer.GameTick))]
private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -398,22 +383,8 @@ public static class DysonSpherePatch
}
}
private static class EjectAnywayPatch
private class EjectAnywayPatch: PatchImpl<EjectAnywayPatch>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(EjectAnywayPatch));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -443,23 +414,8 @@ public static class DysonSpherePatch
}
}
private static class OverclockEjector
private class OverclockEjector: PatchImpl<OverclockEjector>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(OverclockEjector));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectAndSiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -511,22 +467,8 @@ public static class DysonSpherePatch
}
}
private static class OverclockSilo
private class OverclockSilo: PatchImpl<OverclockSilo>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(OverclockSilo));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectAndSiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)

View File

@@ -8,7 +8,7 @@ using UnityEngine;
using UnityEngine.UI;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class FactoryPatch
{
@@ -224,9 +224,9 @@ public static class FactoryPatch
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(ConfigEntry<bool>), nameof(ConfigEntry<bool>.Value))),
new CodeInstruction(OpCodes.Brfalse, label1),
new CodeInstruction(OpCodes.Ldstr, "Build without condition is enabled!"),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Localization), nameof(Localization.Translate), new[] { typeof(string) })),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Localization), nameof(Localization.Translate), [typeof(string)])),
new CodeInstruction(OpCodes.Ldstr, "\r\n"),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(string), nameof(string.Concat), new[] { typeof(string), typeof(string) })),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(string), nameof(string.Concat), [typeof(string), typeof(string)])),
new CodeInstruction(OpCodes.Call, AccessTools.PropertySetter(typeof(WarningSystem), nameof(WarningSystem.criticalWarningTexts)))
);
if (m.InstructionAt(2).opcode == OpCodes.Ret)
@@ -302,9 +302,9 @@ public static class FactoryPatch
);
return matcher.InstructionEnumeration();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UXAssist.PlanetFunctions), nameof(UXAssist.PlanetFunctions.BuildOrbitalCollectors))]
[HarmonyPatch(typeof(UXAssist.Functions.PlanetFunctions), nameof(UXAssist.Functions.PlanetFunctions.BuildOrbitalCollectors))]
private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
{
var factory = GameMain.mainPlayer?.factory;
@@ -315,33 +315,24 @@ public static class FactoryPatch
}
}
private static class ArchitectMode
private class ArchitectMode: PatchImpl<ArchitectMode>
{
private static Harmony _patch;
private static bool[] _canBuildItems;
public static void Enable(bool enable)
protected override void OnEnable()
{
if (enable)
var factory = GameMain.mainPlayer?.factory;
if (factory != null)
{
if (_patch != null) return;
var factory = GameMain.mainPlayer?.factory;
if (factory != null)
{
ArrivePlanet(factory);
}
_patch = Harmony.CreateAndPatchAll(typeof(ArchitectMode));
return;
ArrivePlanet(factory);
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), new[] { typeof(int), typeof(int), typeof(int), typeof(bool) },
new[] { ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Out, ArgumentType.Normal })]
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), new[] { typeof(int), typeof(int), typeof(int[]), typeof(int), typeof(bool) },
new[] { ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal })]
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), [typeof(int), typeof(int), typeof(int), typeof(bool)],
[ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Out, ArgumentType.Normal])]
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), [typeof(int), typeof(int), typeof(int[]), typeof(int), typeof(bool)],
[ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal])]
public static bool TakeTailItemsPatch(StorageComponent __instance, int itemId)
{
if (__instance == null || __instance.id != GameMain.mainPlayer.package.id) return true;
@@ -1123,20 +1114,8 @@ public static class FactoryPatch
/* END: Item sources calculation */
}
private static class RemovePowerSpaceLimit
private class RemovePowerSpaceLimit: PatchImpl<RemovePowerSpaceLimit>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(RemovePowerSpaceLimit));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
@@ -1165,19 +1144,8 @@ public static class FactoryPatch
}
}
private static class BoostWindPower
private class BoostWindPower: PatchImpl<BoostWindPower>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BoostWindPower));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Wind))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Wind_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -1201,19 +1169,8 @@ public static class FactoryPatch
}
}
private static class BoostSolarPower
private class BoostSolarPower: PatchImpl<BoostSolarPower>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BoostSolarPower));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_PV))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_PV_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -1236,19 +1193,8 @@ public static class FactoryPatch
}
}
private static class BoostFuelPower
private class BoostFuelPower: PatchImpl<BoostFuelPower>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BoostFuelPower));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Fuel))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Fuel_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -1288,19 +1234,8 @@ public static class FactoryPatch
}
}
private static class BoostGeothermalPower
private class BoostGeothermalPower: PatchImpl<BoostGeothermalPower>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(BoostGeothermalPower));
return;
}
_patch?.UnpatchSelf();
_patch = null;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_GTH))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_GTH_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -1382,25 +1317,22 @@ public static class FactoryPatch
}
}
private static class GreaterPowerUsageInLogistics
private class GreaterPowerUsageInLogistics: PatchImpl<GreaterPowerUsageInLogistics>
{
private static Harmony _patch;
public static void Enable(bool enable)
protected override void OnEnable()
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(GreaterPowerUsageInLogistics));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
var window = UIRoot.instance?.uiGame?.stationWindow;
if (window == null) return;
window._Close();
window.maxMiningSpeedSlider.maxValue = enable ? 27f : 20f;
window.maxMiningSpeedSlider.maxValue = 27f;
}
protected override void OnDisable()
{
var window = UIRoot.instance?.uiGame?.stationWindow;
if (window == null) return;
window._Close();
window.maxMiningSpeedSlider.maxValue = 20f;
}
[HarmonyTranspiler]
@@ -1535,23 +1467,8 @@ public static class FactoryPatch
}
}
private static class ControlPanelRemoteLogistics
private class ControlPanelRemoteLogistics: PatchImpl<ControlPanelRemoteLogistics>
{
private static Harmony _patch;
public static void Enable(bool enable)
{
if (enable)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(ControlPanelRemoteLogistics));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnItemIconMouseDown))]
[HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnHoldupItemClick))]

View File

@@ -0,0 +1,306 @@
using System;
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine.Bindings;
using UXAssist.Common;
namespace CheatEnabler.Patches;
public static class GamePatch
{
public static ConfigEntry<bool> DevShortcutsEnabled;
public static ConfigEntry<bool> AbnormalDisablerEnabled;
public static ConfigEntry<bool> UnlockTechEnabled;
public static void Init()
{
DevShortcutsEnabled.SettingChanged += (_, _) => DevShortcuts.Enable(DevShortcutsEnabled.Value);
AbnormalDisablerEnabled.SettingChanged += (_, _) => AbnormalDisabler.Enable(AbnormalDisablerEnabled.Value);
UnlockTechEnabled.SettingChanged += (_, _) => UnlockTech.Enable(UnlockTechEnabled.Value);
DevShortcuts.Enable(DevShortcutsEnabled.Value);
AbnormalDisabler.Enable(AbnormalDisablerEnabled.Value);
UnlockTech.Enable(UnlockTechEnabled.Value);
}
public static void Uninit()
{
UnlockTech.Enable(false);
AbnormalDisabler.Enable(false);
DevShortcuts.Enable(false);
}
public class AbnormalDisabler : PatchImpl<AbnormalDisabler>
{
private static Dictionary<int, AbnormalityDeterminator> _savedDeterminators;
protected override void OnEnable()
{
if (_savedDeterminators == null) return;
var abnormalLogic = GameMain.gameScenario.abnormalityLogic;
foreach (var p in _savedDeterminators)
{
p.Value.OnUnregEvent();
}
abnormalLogic.determinators = new Dictionary<int, AbnormalityDeterminator>();
}
protected override void OnDisable()
{
if (_savedDeterminators == null) return;
var abnormalLogic = GameMain.gameScenario.abnormalityLogic;
abnormalLogic.determinators = _savedDeterminators;
foreach (var p in _savedDeterminators)
{
p.Value.OnRegEvent();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")]
private static bool DisableAbnormalLogic()
{
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")]
private static void DisableAbnormalDeterminators(AbnormalityLogic __instance)
{
_savedDeterminators = __instance.determinators;
if (!AbnormalDisablerEnabled.Value) return;
__instance.determinators = new Dictionary<int, AbnormalityDeterminator>();
foreach (var p in _savedDeterminators)
{
p.Value.OnUnregEvent();
}
}
}
public class DevShortcuts : PatchImpl<DevShortcuts>
{
private static PlayerAction_Test _test;
protected override void OnEnable()
{
if (_test != null) _test.active = true;
}
protected override void OnDisable()
{
if (_test != null) _test.active = false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.Init))]
private static void PlayerController_Init_Postfix(PlayerController __instance)
{
var cnt = __instance.actions.Length;
var newActions = new PlayerAction[cnt + 1];
for (var i = 0; i < cnt; i++)
{
newActions[i] = __instance.actions[i];
}
_test = new PlayerAction_Test();
_test.Init(__instance.player);
_test.active = DevShortcutsEnabled.Value;
newActions[cnt] = _test;
__instance.actions = newActions;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.GameTick))]
private static void PlayerAction_Test_GameTick_Postfix(PlayerAction_Test __instance)
{
__instance.Update();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))]
private static IEnumerable<CodeInstruction> PlayerAction_Test_Update_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.End().MatchBack(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlayerAction_Test), nameof(PlayerAction_Test.active)))
);
var pos = matcher.Pos;
/* Remove Shift+F4 part of the method */
matcher.Start().RemoveInstructions(pos).MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(GameMain), "get_sandboxToolsEnabled")),
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Ceq)
);
var labels = matcher.Labels;
matcher.SetInstructionAndAdvance(
new CodeInstruction(OpCodes.Ldc_I4_1).WithLabels(labels)
).RemoveInstructions(2);
/* Remove Ctrl+A */
matcher.Start().MatchForward(false,
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) && instr.OperandIs(0x61)),
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(UnityEngine.Input), nameof(UnityEngine.Input.GetKeyDown), [typeof(UnityEngine.KeyCode)]))
);
labels = matcher.Labels;
matcher.Labels = null;
matcher.RemoveInstructions(2);
matcher.Opcode = OpCodes.Br;
matcher.Labels = labels;
return matcher.InstructionEnumeration();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.FrameLogic))]
private static IEnumerable<CodeInstruction> GameCamera_Logic_Transpiler(IEnumerable<CodeInstruction> instructions)
{
var matcher = new CodeMatcher(instructions);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameCamera), nameof(GameCamera.finalPoser))),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(CameraPoser), nameof(CameraPoser.cameraPose)))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.Insert(
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
Transpilers.EmitDelegate((GameCamera camera) =>
{
if (PlayerAction_Test.lockCam)
{
camera.finalPoser.cameraPose = PlayerAction_Test.camPose;
}
})
);
return matcher.InstructionEnumeration();
}
}
public class UnlockTech: PatchImpl<UnlockTech>
{
private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000)
{
var techStates = history.techStates;
var techID = techProto.ID;
if (techStates == null || !techStates.TryGetValue(techID, out var value))
{
return;
}
if (value.unlocked)
{
return;
}
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
foreach (var preid in techProto.PreTechs)
{
var preProto = LDB.techs.Select(preid);
if (preProto != null)
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
}
foreach (var preid in techProto.PreTechsImplicit)
{
var preProto = LDB.techs.Select(preid);
if (preProto != null)
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
}
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
while (value.curLevel <= maxLvl)
{
if (value.curLevel == 0)
{
foreach (var recipe in techProto.UnlockRecipes)
{
history.UnlockRecipe(recipe);
}
}
for (var j = 0; j < techProto.UnlockFunctions.Length; j++)
{
history.UnlockTechFunction(techProto.UnlockFunctions[j], techProto.UnlockValues[j], value.curLevel);
}
for (var k = 0; k < techProto.AddItems.Length; k++)
{
history.GainTechAwards(techProto.AddItems[k], techProto.AddItemCounts[k]);
}
value.curLevel++;
}
value.unlocked = maxLvl >= value.maxLevel;
value.curLevel = value.unlocked ? maxLvl : maxLvl + 1;
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
value.hashUploaded = value.unlocked ? value.hashNeeded : 0;
techStates[techID] = value;
history.RegFeatureKey(1000100);
history.NotifyTechUnlock(techID, maxLvl, true);
}
private static void OnClickTech(UITechNode node)
{
var history = GameMain.history;
if (VFInput.shift)
{
if (VFInput.alt) return;
if (VFInput.control)
UnlockTechRecursive(history, node.techProto, -100);
else
UnlockTechRecursive(history, node.techProto, -1);
}
else
{
if (VFInput.control)
{
if (!VFInput.alt)
UnlockTechRecursive(history, node.techProto, -10);
else
return;
}
else if (VFInput.alt)
{
UnlockTechRecursive(history, node.techProto);
}
else
{
return;
}
}
history.VarifyTechQueue();
if (history.currentTech != history.techQueue[0])
{
history.currentTech = history.techQueue[0];
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.OnPointerDown))]
private static IEnumerable<CodeInstruction> UITechNode_OnPointerDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UITechNode), nameof(UITechNode.tree))),
new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(UITechTree), "get_selected"))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.Insert(
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(UnlockTech), nameof(UnlockTech.OnClickTech)))
);
return matcher.InstructionEnumeration();
}
}
}

View File

@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class PlanetPatch
{
public static ConfigEntry<bool> WaterPumpAnywhereEnabled;
@@ -24,23 +25,8 @@ public static class PlanetPatch
TerraformAnyway.Enable(false);
}
private static class WaterPumperPatch
private class WaterPumperPatch: PatchImpl<WaterPumperPatch>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(WaterPumperPatch));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
@@ -61,23 +47,8 @@ public static class PlanetPatch
}
}
private static class TerraformAnyway
private class TerraformAnyway: PatchImpl<TerraformAnyway>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(TerraformAnyway));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]
private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -96,7 +67,7 @@ public static class PlanetPatch
new CodeMatch(OpCodes.Sub)
).Advance(2).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldc_I8, 0L),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Math), "Max", new[] { typeof(long), typeof(long) }))
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Math), "Max", [typeof(long), typeof(long)]))
);
return matcher.InstructionEnumeration();
}

View File

@@ -2,8 +2,9 @@
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class PlayerPatch
{
@@ -24,23 +25,8 @@ public static class PlayerPatch
WarpWithoutSpaceWarpers.Enable(false);
}
private static class InstantTeleport
private class InstantTeleport: PatchImpl<InstantTeleport>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(InstantTeleport));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.DoRightClickFastTravel))]
@@ -62,23 +48,8 @@ public static class PlayerPatch
}
}
private static class WarpWithoutSpaceWarpers
private class WarpWithoutSpaceWarpers: PatchImpl<WarpWithoutSpaceWarpers>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(WarpWithoutSpaceWarpers));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Mecha), nameof(Mecha.HasWarper))]
private static bool Mecha_HasWarper_Prefix(ref bool __result)

View File

@@ -2,8 +2,9 @@
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
namespace CheatEnabler;
namespace CheatEnabler.Patches;
public static class ResourcePatch
{
@@ -24,23 +25,8 @@ public static class ResourcePatch
FastMining.Enable(false);
}
private static class InfiniteResource
private class InfiniteResource: PatchImpl<InfiniteResource>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(InfiniteResource));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
@@ -69,23 +55,8 @@ public static class ResourcePatch
}
}
private static class FastMining
private class FastMining: PatchImpl<FastMining>
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(FastMining));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]

View File

@@ -1,154 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using JetBrains.Annotations;
namespace CheatEnabler;
public static class TechPatch
{
public static ConfigEntry<bool> Enabled;
private static Harmony _patch;
public static void Init()
{
Enabled.SettingChanged += (_, _) => ValueChanged();
ValueChanged();
}
public static void Uninit()
{
_patch?.UnpatchSelf();
_patch = null;
}
private static void ValueChanged()
{
if (Enabled.Value)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(TechPatch));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
}
private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000)
{
var techStates = history.techStates;
var techID = techProto.ID;
if (techStates == null || !techStates.TryGetValue(techID, out var value))
{
return;
}
if (value.unlocked)
{
return;
}
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
foreach (var preid in techProto.PreTechs)
{
var preProto = LDB.techs.Select(preid);
if (preProto != null)
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
}
foreach (var preid in techProto.PreTechsImplicit)
{
var preProto = LDB.techs.Select(preid);
if (preProto != null)
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
}
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
while (value.curLevel <= maxLvl)
{
if (value.curLevel == 0)
{
foreach (var recipe in techProto.UnlockRecipes)
{
history.UnlockRecipe(recipe);
}
}
for (var j = 0; j < techProto.UnlockFunctions.Length; j++)
{
history.UnlockTechFunction(techProto.UnlockFunctions[j], techProto.UnlockValues[j], value.curLevel);
}
for (var k = 0; k < techProto.AddItems.Length; k++)
{
history.GainTechAwards(techProto.AddItems[k], techProto.AddItemCounts[k]);
}
value.curLevel++;
}
value.unlocked = maxLvl >= value.maxLevel;
value.curLevel = value.unlocked ? maxLvl : maxLvl + 1;
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
value.hashUploaded = value.unlocked ? value.hashNeeded : 0;
techStates[techID] = value;
history.RegFeatureKey(1000100);
history.NotifyTechUnlock(techID, maxLvl, true);
}
private static void OnClickTech(UITechNode node)
{
var history = GameMain.history;
if (VFInput.shift)
{
if (VFInput.alt) return;
if (VFInput.control)
UnlockTechRecursive(history, node.techProto, -100);
else
UnlockTechRecursive(history, node.techProto, -1);
}
else
{
if (VFInput.control)
{
if (!VFInput.alt)
UnlockTechRecursive(history, node.techProto, -10);
else
return;
}
else if (VFInput.alt)
{
UnlockTechRecursive(history, node.techProto);
}
else
{
return;
}
}
history.VarifyTechQueue();
if (history.currentTech != history.techQueue[0])
{
history.currentTech = history.techQueue[0];
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.OnPointerDown))]
private static IEnumerable<CodeInstruction> UITechNode_OnPointerDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UITechNode), nameof(UITechNode.tree))),
new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(UITechTree), "get_selected"))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.Insert(
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(TechPatch), nameof(TechPatch.OnClickTech)))
);
return matcher.InstructionEnumeration();
}
}

View File

@@ -1,4 +1,6 @@
using UnityEngine;
using CheatEnabler.Functions;
using CheatEnabler.Patches;
using UnityEngine;
using UXAssist.UI;
using UXAssist.Common;
@@ -84,15 +86,15 @@ public static class UIConfigWindow
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, DevShortcuts.Enabled, "Enable Dev Shortcuts");
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, AbnormalDisabler.Enabled, "Disable Abnormal Checks");
wnd.AddCheckBox(x, y, tab1, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks");
y += 36f;
cb = wnd.AddCheckBox(x, y, tab1, TechPatch.Enabled, "Unlock Tech with Key-Modifiers");
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");