mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 12:53:34 +08:00
WIP
This commit is contained in:
@@ -12,7 +12,8 @@ public static class TerraformPatch
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_patch = Harmony.CreateAndPatchAll(typeof(TerraformPatch));
|
||||
Enabled.SettingChanged += (_, _) => ValueChanged();
|
||||
ValueChanged();
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
@@ -22,6 +23,25 @@ public static class TerraformPatch
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
private static void ValueChanged()
|
||||
{
|
||||
if (Enabled.Value)
|
||||
{
|
||||
if (_patch != null)
|
||||
{
|
||||
_patch.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
_patch = Harmony.CreateAndPatchAll(typeof(TerraformPatch));
|
||||
}
|
||||
else if (_patch != null)
|
||||
{
|
||||
_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)
|
||||
|
||||
Reference in New Issue
Block a user