1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 20:22:17 +08:00
This commit is contained in:
2024-09-18 01:41:08 +08:00
parent fb916b3813
commit bd512a6b78
17 changed files with 232 additions and 207 deletions

View File

@@ -12,7 +12,7 @@ using UXAssist.Common;
namespace UXAssist.Patches;
public static class FactoryPatch
public class FactoryPatch: PatchImpl<FactoryPatch>
{
public static ConfigEntry<bool> UnlimitInteractiveEnabled;
public static ConfigEntry<bool> RemoveSomeConditionEnabled;
@@ -29,8 +29,6 @@ public static class FactoryPatch
public static ConfigEntry<bool> BeltSignalsForBuyOutEnabled;
private static PressKeyBind _doNotRenderEntitiesKey;
private static Harmony _factoryPatch;
public static void Init()
{
_doNotRenderEntitiesKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
@@ -71,11 +69,13 @@ public static class FactoryPatch
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
Enable(true);
}
public static void Uninit()
{
Enable(false);
RemoveSomeConditionBuild.Enable(false);
UnlimitInteractive.Enable(false);
NightLight.Enable(false);
@@ -90,9 +90,6 @@ public static class FactoryPatch
DragBuildPowerPoles.Enable(false);
BeltSignalsForBuyOut.Enable(false);
BeltSignalsForBuyOut.UninitPersist();
_factoryPatch?.UnpatchSelf();
_factoryPatch = null;
}
public static void OnUpdate()
@@ -1324,7 +1321,7 @@ public static class FactoryPatch
private static void UnfixProto()
{
if (GetPatch() == null || OldDragBuild.Count < 3 || DSPGame.IsMenuDemo) return;
if (GetHarmony() == null || OldDragBuild.Count < 3 || DSPGame.IsMenuDemo) return;
var i = 0;
foreach (var id in PowerPoleIds)
{