mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
CheatEnabler v2.2.6
This commit is contained in:
1 parent
befed5ae60
commit
0c48691dc9
7 files changed
+192
-158
No files matched your search
@@ -71,6 +71,8 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Can pump water anywhere (while water type is not None)");
|
||||
TerraformPatch.Enabled = Config.Bind("Planet", "TerraformAnyway", false,
|
||||
"Can do terraform without enough sands");
|
||||
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
|
||||
"Stop ejectors when available nodes are all filled up");
|
||||
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
|
||||
"Skip bullet");
|
||||
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.2.5</Version>
|
||||
<Version>2.2.6</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
|
||||
+176
-156
@@ -15,12 +15,6 @@ public static class DysonSpherePatch
|
||||
public static ConfigEntry<bool> EjectAnywayEnabled;
|
||||
public static ConfigEntry<bool> OverclockEjectorEnabled;
|
||||
public static ConfigEntry<bool> OverclockSiloEnabled;
|
||||
private static Harmony _skipBulletPatch;
|
||||
private static Harmony _skipAbsorbPatch;
|
||||
private static Harmony _quickAbsorbPatch;
|
||||
private static Harmony _ejectAnywayPatch;
|
||||
private static Harmony _overclockEjector;
|
||||
private static Harmony _overclockSilo;
|
||||
private static Harmony _dysonSpherePatch;
|
||||
private static bool _instantAbsorb;
|
||||
|
||||
@@ -28,145 +22,33 @@ public static class DysonSpherePatch
|
||||
{
|
||||
_dysonSpherePatch ??= Harmony.CreateAndPatchAll(typeof(DysonSpherePatch));
|
||||
StopEjectOnNodeCompleteEnabled.SettingChanged += (_, _) => StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value);
|
||||
SkipBulletEnabled.SettingChanged += (_, _) => SkipBulletValueChanged();
|
||||
SkipAbsorbEnabled.SettingChanged += (_, _) => SkipAbsorbValueChanged();
|
||||
QuickAbsorbEnabled.SettingChanged += (_, _) => QuickAbsorbValueChanged();
|
||||
EjectAnywayEnabled.SettingChanged += (_, _) => EjectAnywayValueChanged();
|
||||
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjectorValueChanged();
|
||||
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSiloValueChanged();
|
||||
SkipBulletEnabled.SettingChanged += (_, _) => SkipBulletPatch.Enable(SkipBulletEnabled.Value);
|
||||
SkipAbsorbEnabled.SettingChanged += (_, _) => SkipAbsorbPatch.Enable(SkipBulletEnabled.Value);
|
||||
QuickAbsorbEnabled.SettingChanged += (_, _) => QuickAbsorbPatch.Enable(QuickAbsorbEnabled.Value);
|
||||
EjectAnywayEnabled.SettingChanged += (_, _) => EjectAnywayPatch.Enable(EjectAnywayEnabled.Value);
|
||||
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
||||
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||
StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value);
|
||||
SkipBulletValueChanged();
|
||||
SkipAbsorbValueChanged();
|
||||
QuickAbsorbValueChanged();
|
||||
EjectAnywayValueChanged();
|
||||
OverclockEjectorValueChanged();
|
||||
OverclockSiloValueChanged();
|
||||
SkipBulletPatch.Enable(SkipBulletEnabled.Value);
|
||||
SkipAbsorbPatch.Enable(SkipBulletEnabled.Value);
|
||||
QuickAbsorbPatch.Enable(QuickAbsorbEnabled.Value);
|
||||
EjectAnywayPatch.Enable(EjectAnywayEnabled.Value);
|
||||
OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
||||
OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
StopEjectOnNodeComplete.Enable(false);
|
||||
_skipBulletPatch?.UnpatchSelf();
|
||||
_skipBulletPatch = null;
|
||||
_skipAbsorbPatch?.UnpatchSelf();
|
||||
_skipAbsorbPatch = null;
|
||||
_quickAbsorbPatch?.UnpatchSelf();
|
||||
_quickAbsorbPatch = null;
|
||||
_ejectAnywayPatch?.UnpatchSelf();
|
||||
_ejectAnywayPatch = null;
|
||||
_overclockEjector?.UnpatchSelf();
|
||||
_overclockEjector = null;
|
||||
_overclockSilo?.UnpatchSelf();
|
||||
_overclockSilo = null;
|
||||
SkipBulletPatch.Enable(false);
|
||||
SkipAbsorbPatch.Enable(false);
|
||||
QuickAbsorbPatch.Enable(false);
|
||||
EjectAnywayPatch.Enable(false);
|
||||
OverclockEjector.Enable(false);
|
||||
OverclockSilo.Enable(false);
|
||||
_dysonSpherePatch?.UnpatchSelf();
|
||||
_dysonSpherePatch = null;
|
||||
}
|
||||
|
||||
private static void SkipBulletValueChanged()
|
||||
{
|
||||
if (SkipBulletEnabled.Value)
|
||||
{
|
||||
if (_skipBulletPatch != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SkipBulletPatch.UpdateSailLifeTime();
|
||||
SkipBulletPatch.UpdateSailsCacheForThisGame();
|
||||
_skipBulletPatch = Harmony.CreateAndPatchAll(typeof(SkipBulletPatch));
|
||||
}
|
||||
else if (_skipBulletPatch != null)
|
||||
{
|
||||
_skipBulletPatch.UnpatchSelf();
|
||||
_skipBulletPatch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SkipAbsorbValueChanged()
|
||||
{
|
||||
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
|
||||
if (SkipAbsorbEnabled.Value)
|
||||
{
|
||||
if (_skipAbsorbPatch != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_skipAbsorbPatch = Harmony.CreateAndPatchAll(typeof(SkipAbsorbPatch));
|
||||
}
|
||||
else if (_skipAbsorbPatch != null)
|
||||
{
|
||||
_skipAbsorbPatch.UnpatchSelf();
|
||||
_skipAbsorbPatch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void QuickAbsorbValueChanged()
|
||||
{
|
||||
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
|
||||
if (QuickAbsorbEnabled.Value)
|
||||
{
|
||||
if (_quickAbsorbPatch != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_quickAbsorbPatch = Harmony.CreateAndPatchAll(typeof(QuickAbsorbPatch));
|
||||
}
|
||||
else if (_quickAbsorbPatch != null)
|
||||
{
|
||||
_quickAbsorbPatch.UnpatchSelf();
|
||||
_quickAbsorbPatch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void EjectAnywayValueChanged()
|
||||
{
|
||||
if (EjectAnywayEnabled.Value)
|
||||
{
|
||||
if (_ejectAnywayPatch != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_ejectAnywayPatch = Harmony.CreateAndPatchAll(typeof(EjectAnywayPatch));
|
||||
}
|
||||
else if (_ejectAnywayPatch != null)
|
||||
{
|
||||
_ejectAnywayPatch.UnpatchSelf();
|
||||
_ejectAnywayPatch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OverclockEjectorValueChanged()
|
||||
{
|
||||
if (OverclockEjectorEnabled.Value)
|
||||
{
|
||||
if (_overclockEjector != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_overclockEjector = Harmony.CreateAndPatchAll(typeof(OverclockEjector));
|
||||
}
|
||||
else if (_overclockEjector != null)
|
||||
{
|
||||
_overclockEjector.UnpatchSelf();
|
||||
_overclockEjector = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OverclockSiloValueChanged()
|
||||
{
|
||||
if (OverclockSiloEnabled.Value)
|
||||
{
|
||||
if (_overclockSilo != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_overclockSilo = Harmony.CreateAndPatchAll(typeof(OverclockSilo));
|
||||
}
|
||||
else if (_overclockSilo != null)
|
||||
{
|
||||
_overclockSilo.UnpatchSelf();
|
||||
_overclockSilo = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitCurrentDysonSphere(int index)
|
||||
{
|
||||
@@ -228,6 +110,7 @@ public static class DysonSpherePatch
|
||||
{
|
||||
private static Harmony _patch;
|
||||
private static HashSet<int>[] _nodeForAbsorb;
|
||||
private static bool _initialized;
|
||||
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
@@ -238,6 +121,7 @@ public static class DysonSpherePatch
|
||||
}
|
||||
else
|
||||
{
|
||||
_initialized = false;
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
_nodeForAbsorb = null;
|
||||
@@ -246,8 +130,15 @@ public static class DysonSpherePatch
|
||||
|
||||
private static void InitNodeForAbsorb()
|
||||
{
|
||||
_nodeForAbsorb = new HashSet<int>[GameMain.data.galaxy.starCount];
|
||||
foreach (var sphere in GameMain.data.dysonSpheres)
|
||||
_initialized = false;
|
||||
_nodeForAbsorb = null;
|
||||
var data = GameMain.data;
|
||||
var galaxy = data?.galaxy;
|
||||
if (galaxy == null) return;
|
||||
_nodeForAbsorb = new HashSet<int>[galaxy.starCount];
|
||||
var spheres = data.dysonSpheres;
|
||||
if (spheres == null) return;
|
||||
foreach (var sphere in spheres)
|
||||
{
|
||||
if (sphere?.layersSorted == null) continue;
|
||||
var starIndex = sphere.starData.index;
|
||||
@@ -257,15 +148,17 @@ public static class DysonSpherePatch
|
||||
for (var i = layer.nodeCursor - 1; i > 0; i--)
|
||||
{
|
||||
var node = layer.nodePool[i];
|
||||
if (node == null || node.id != i) continue;
|
||||
SetNodeForAbsorb(starIndex, layer.id, node.id, node.sp == node.spMax && node.cpReqOrder > 0);
|
||||
if (node == null || node.id != i || node.sp < node.spMax || node.cpReqOrder == 0) continue;
|
||||
SetNodeForAbsorb(starIndex, layer.id, node.id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
private static void SetNodeForAbsorb(int index, int layerId, int nodeId, bool canAbsorb)
|
||||
{
|
||||
CheatEnabler.Logger.LogDebug($"{index} {layerId} {nodeId} {canAbsorb}");
|
||||
ref var comp = ref _nodeForAbsorb[index];
|
||||
comp ??= new HashSet<int>();
|
||||
var idx = nodeId * 10 + layerId;
|
||||
@@ -275,11 +168,22 @@ public static class DysonSpherePatch
|
||||
comp.Remove(idx);
|
||||
}
|
||||
|
||||
private static void UpdateNodeForAbsorb(DysonNode node)
|
||||
private static void UpdateNodeForAbsorbOnSpChange(DysonNode node)
|
||||
{
|
||||
if (!_initialized) return;
|
||||
if (node.sp < node.spMax || node.cpReqOrder <= 0) return;
|
||||
var shells = node.shells;
|
||||
if (shells.Count == 0) return;
|
||||
SetNodeForAbsorb(shells[0].dysonSphere.starData.index, node.layerId, node.id, node.sp == node.spMax && node.cpReqOrder > 0);
|
||||
SetNodeForAbsorb(shells[0].dysonSphere.starData.index, node.layerId, node.id, true);
|
||||
}
|
||||
|
||||
private static void UpdateNodeForAbsorbOnCpChange(DysonNode node)
|
||||
{
|
||||
if (!_initialized) return;
|
||||
if (node.sp < node.spMax || node.cpReqOrder > 0) return;
|
||||
var shells = node.shells;
|
||||
if (shells.Count == 0) return;
|
||||
SetNodeForAbsorb(shells[0].dysonSphere.starData.index, node.layerId, node.id, false);
|
||||
}
|
||||
|
||||
private static bool AnyNodeForAbsorb(int starIndex)
|
||||
@@ -299,14 +203,15 @@ public static class DysonSpherePatch
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.RecalcCpReq))]
|
||||
private static void DysonNode_RecalcCpReq_Postfix(DysonNode __instance)
|
||||
{
|
||||
UpdateNodeForAbsorb(__instance);
|
||||
UpdateNodeForAbsorbOnCpChange(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DysonSphereLayer), nameof(DysonSphereLayer.RemoveDysonNode))]
|
||||
private static void DysonSphereLayer_RemoveDysonNode_Prefix(DysonSphereLayer __instance, int nodeId)
|
||||
{
|
||||
SetNodeForAbsorb(__instance.starData.index, __instance.id, nodeId, false);
|
||||
if (_initialized)
|
||||
SetNodeForAbsorb(__instance.starData.index, __instance.id, nodeId, false);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
@@ -324,21 +229,25 @@ public static class DysonSpherePatch
|
||||
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
var label1 = generator.DefineLabel();
|
||||
matcher.Start().InsertAndAdvance(
|
||||
matcher.MatchForward(false,
|
||||
// if (this.orbitId == 0
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.orbitId))),
|
||||
new CodeMatch(OpCodes.Brtrue)
|
||||
).Advance(2).Insert(
|
||||
// || !StopEjectOnNodeComplete.AnyNodeForAbsorb(this.starData.index))
|
||||
new CodeInstruction(OpCodes.Ldarg_2),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.starData))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), nameof(StarData.index))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.Brtrue, label1)
|
||||
new CodeInstruction(OpCodes.And)
|
||||
);
|
||||
matcher.Labels.Add(label1);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))]
|
||||
private static IEnumerable<CodeInstruction> DysonNode_ConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructSp))]
|
||||
private static IEnumerable<CodeInstruction> DysonNode_ConstructSp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.Start().MatchForward(false,
|
||||
@@ -348,7 +257,28 @@ public static class DysonSpherePatch
|
||||
matcher.Labels = new List<Label>();
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.UpdateNodeForAbsorb)))
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.UpdateNodeForAbsorbOnSpChange)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))]
|
||||
private static IEnumerable<CodeInstruction> DysonNode_ConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchBack(false,
|
||||
// Search for previous patch:
|
||||
// node._cpReq = node._cpReq - 1;
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonNode), nameof(DysonNode._cpReq))),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Sub),
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(DysonNode), nameof(DysonNode._cpReq)))
|
||||
).Advance(6).Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.UpdateNodeForAbsorbOnCpChange)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
@@ -359,7 +289,8 @@ public static class DysonSpherePatch
|
||||
private static long _sailLifeTime;
|
||||
private static DysonSailCache[][] _sailsCache;
|
||||
private static int[] _sailsCacheLen, _sailsCacheCapacity;
|
||||
|
||||
private static Harmony _patch;
|
||||
|
||||
private struct DysonSailCache
|
||||
{
|
||||
public DysonSail Sail;
|
||||
@@ -378,13 +309,28 @@ public static class DysonSpherePatch
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateSailLifeTime()
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
UpdateSailLifeTime();
|
||||
UpdateSailsCacheForThisGame();
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(SkipBulletPatch));
|
||||
}
|
||||
else
|
||||
{
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateSailLifeTime()
|
||||
{
|
||||
if (GameMain.history == null) return;
|
||||
_sailLifeTime = (long)(GameMain.history.solarSailLife * 60f + 0.1f);
|
||||
}
|
||||
|
||||
public static void UpdateSailsCacheForThisGame()
|
||||
private static void UpdateSailsCacheForThisGame()
|
||||
{
|
||||
var galaxy = GameMain.data?.galaxy;
|
||||
if (galaxy == null) return;
|
||||
@@ -504,7 +450,7 @@ public static class DysonSpherePatch
|
||||
var nodes = layer.nodePool;
|
||||
var nlen = layer.nodeCursor;
|
||||
var nidx = time % nlen;
|
||||
for (var j = nlen - 1; j > 0; j--)
|
||||
for (var j = nlen - 1; j >= 0; j--)
|
||||
{
|
||||
var nodeIdx = (nidx + j) % nlen;
|
||||
var node = nodes[nodeIdx];
|
||||
@@ -539,6 +485,22 @@ public static class DysonSpherePatch
|
||||
|
||||
private static class SkipAbsorbPatch
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
|
||||
if (on)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(SkipAbsorbPatch));
|
||||
}
|
||||
else
|
||||
{
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.OrderConstructCp))]
|
||||
private static IEnumerable<CodeInstruction> DysonNode_OrderConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
@@ -604,6 +566,21 @@ public static class DysonSpherePatch
|
||||
|
||||
private static class QuickAbsorbPatch
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
_instantAbsorb = SkipAbsorbEnabled.Value && QuickAbsorbEnabled.Value;
|
||||
if (on)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(QuickAbsorbPatch));
|
||||
}
|
||||
else
|
||||
{
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
}
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonSphereLayer), nameof(DysonSphereLayer.GameTick))]
|
||||
private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
@@ -631,7 +608,7 @@ public static class DysonSpherePatch
|
||||
for (var i = layer.nodeCursor - 1; i > 0; i--)
|
||||
{
|
||||
var node = layer.nodePool[i];
|
||||
if (node == null || node.id != i || node.sp != node.spMax) continue;
|
||||
if (node == null || node.id != i || node.sp < node.spMax) continue;
|
||||
if (node._cpReq <= node.cpOrdered) continue;
|
||||
while (swarm.AbsorbSail(node, gameTick)) {}
|
||||
}
|
||||
@@ -658,6 +635,20 @@ public static class DysonSpherePatch
|
||||
|
||||
private static class 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)
|
||||
@@ -689,6 +680,21 @@ public static class DysonSpherePatch
|
||||
|
||||
private static class 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)
|
||||
@@ -742,6 +748,20 @@ public static class DysonSpherePatch
|
||||
|
||||
private static class 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)
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||
|
||||
## Changlog
|
||||
* 2.2.6
|
||||
+ New function: `Stop ejectors when available nodes are all filled up`
|
||||
+ Fix a bug that absorb solar sails on unfinised nodes
|
||||
* 2.2.5
|
||||
+ Skip all intermediate states and absorb solar sails instantly while enable `Quick absorb`, `Skip bullet period` and `Skip absorption period` at the same time.
|
||||
+ Fix a problem that `Quick absorb` does not absorb all solar sails instantly when most nodes are full.
|
||||
@@ -69,6 +72,7 @@
|
||||
+ Re-intialize planet (without reseting veins)
|
||||
+ Quick dismantle all buildings (without drops)
|
||||
+ Dyson Sphere:
|
||||
+ Stop ejectors when available nodes are all filled up
|
||||
+ Skip bullet period
|
||||
+ Skip absorption period
|
||||
+ Quick absorb
|
||||
@@ -92,6 +96,9 @@
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
|
||||
|
||||
## 更新日志
|
||||
* 2.2.6
|
||||
+ 新功能:`可用节点全部造完时停止弹射`
|
||||
+ 修复了在未完成的节点上吸收太阳帆的问题
|
||||
* 2.2.5
|
||||
+ 在同时启用`快速吸收`、`跳过子弹阶段`和`跳过吸收阶段`时,所有弹射的太阳帆会跳过所有中间环节立即吸收
|
||||
+ 修复了`快速吸收`在大部分节点已满时无法立即吸收所有太阳帆的问题
|
||||
@@ -157,6 +164,7 @@
|
||||
+ 初始化本行星(不重置矿脉)
|
||||
+ 快速拆除所有建筑(不掉落)
|
||||
+ 戴森球:
|
||||
+ 可用节点全部造完时停止弹射
|
||||
+ 跳过子弹阶段
|
||||
+ 跳过吸收阶段
|
||||
+ 快速吸收
|
||||
|
||||
@@ -118,6 +118,7 @@ public class MyWindow: ManualBehaviour
|
||||
var panel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.layerPanel;
|
||||
var btn = Instantiate(panel.layerButtons[0]);
|
||||
btn.gameObject.name = objName;
|
||||
btn.highlighted = false;
|
||||
Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||
var t = btn.gameObject.transform.Find("Text").GetComponent<Text>();
|
||||
if (t != null)
|
||||
|
||||
@@ -52,6 +52,7 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
||||
I18N.Add("Initialize This Planet", "Initialize this planet", "初始化本行星");
|
||||
I18N.Add("Dismantle All Buildings", "Dismantle all buildings", "拆除所有建筑");
|
||||
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
|
||||
I18N.Add("Stop ejectors when available nodes are all filled up", "Stop ejectors when available nodes are all filled up", "可用节点全部造完时停止弹射");
|
||||
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
|
||||
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
||||
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
||||
@@ -203,6 +204,8 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
||||
var tab4 = AddTab(336f, 3, _windowTrans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
y += 36f;
|
||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||
y += 36f;
|
||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.2.5",
|
||||
"version_number": "2.2.6",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
Reference in new issue
Block a user