1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 02:13:29 +08:00

CheatEnabler v2.2.7

This commit is contained in:
2023-10-07 16:46:13 +08:00
parent 0c48691dc9
commit d0bc5cf1d4
8 changed files with 79 additions and 9 deletions

View File

@@ -73,6 +73,8 @@ public class CheatEnabler : BaseUnityPlugin
"Can do terraform without enough sands");
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
"Stop ejectors when available nodes are all filled up");
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
"Construct only nodes but frames");
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
"Skip bullet");
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,

View File

@@ -5,7 +5,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
<Description>DSP MOD - CheatEnabler</Description>
<Version>2.2.6</Version>
<Version>2.2.7</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>CheatEnabler</PackageId>

View File

@@ -9,6 +9,7 @@ namespace CheatEnabler;
public static class DysonSpherePatch
{
public static ConfigEntry<bool> StopEjectOnNodeCompleteEnabled;
public static ConfigEntry<bool> OnlyConstructNodesEnabled;
public static ConfigEntry<bool> SkipBulletEnabled;
public static ConfigEntry<bool> SkipAbsorbEnabled;
public static ConfigEntry<bool> QuickAbsorbEnabled;
@@ -22,6 +23,7 @@ public static class DysonSpherePatch
{
_dysonSpherePatch ??= Harmony.CreateAndPatchAll(typeof(DysonSpherePatch));
StopEjectOnNodeCompleteEnabled.SettingChanged += (_, _) => StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value);
OnlyConstructNodesEnabled.SettingChanged += (_, _) => OnlyConstructNodes.Enable(OnlyConstructNodesEnabled.Value);
SkipBulletEnabled.SettingChanged += (_, _) => SkipBulletPatch.Enable(SkipBulletEnabled.Value);
SkipAbsorbEnabled.SettingChanged += (_, _) => SkipAbsorbPatch.Enable(SkipBulletEnabled.Value);
QuickAbsorbEnabled.SettingChanged += (_, _) => QuickAbsorbPatch.Enable(QuickAbsorbEnabled.Value);
@@ -29,6 +31,7 @@ public static class DysonSpherePatch
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value);
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value);
StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value);
OnlyConstructNodes.Enable(OnlyConstructNodesEnabled.Value);
SkipBulletPatch.Enable(SkipBulletEnabled.Value);
SkipAbsorbPatch.Enable(SkipBulletEnabled.Value);
QuickAbsorbPatch.Enable(QuickAbsorbEnabled.Value);
@@ -40,6 +43,7 @@ public static class DysonSpherePatch
public static void Uninit()
{
StopEjectOnNodeComplete.Enable(false);
OnlyConstructNodes.Enable(false);
SkipBulletPatch.Enable(false);
SkipAbsorbPatch.Enable(false);
QuickAbsorbPatch.Enable(false);
@@ -158,7 +162,6 @@ public static class DysonSpherePatch
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;
@@ -284,6 +287,55 @@ public static class DysonSpherePatch
}
}
private static class OnlyConstructNodes
{
private static Harmony _patch;
public static void Enable(bool on)
{
if (on)
{
_patch ??= Harmony.CreateAndPatchAll(typeof(OnlyConstructNodes));
}
else
{
_patch?.UnpatchSelf();
_patch = null;
}
var spheres = GameMain.data?.dysonSpheres;
if (spheres == null) return;
foreach (var sphere in spheres)
{
if (sphere == null) continue;
sphere.CheckAutoNodes();
if (sphere.autoNodeCount > 0) continue;
sphere.PickAutoNode();
sphere.PickAutoNode();
sphere.PickAutoNode();
sphere.PickAutoNode();
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.spReqOrder), MethodType.Getter)]
private static IEnumerable<CodeInstruction> DysonNode_spReqOrder_Getter_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(DysonNode), nameof(DysonNode._spReq)))
).Advance(1).SetInstructionAndAdvance(
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonNode), nameof(DysonNode.spMax)))
).Insert(
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonNode), nameof(DysonNode.sp))),
new CodeInstruction(OpCodes.Sub)
);
return matcher.InstructionEnumeration();
}
}
private static class SkipBulletPatch
{
private static long _sailLifeTime;

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
@@ -620,6 +621,7 @@ public static class FactoryPatch
public static void OnAltFormatChanged()
{
if (_signalBelts == null) return;
var factories = GameMain.data?.factories;
if (factories == null) return;
var factoryCount = GameMain.data.factoryCount;
@@ -632,6 +634,7 @@ public static class FactoryPatch
var entitySignPool = factory.entitySignPool;
if (entitySignPool == null) continue;
var belts = _signalBelts[i];
if (belts == null) continue;
foreach (var pair in belts)
{
var beltId = pair.Key;

View File

@@ -4,6 +4,11 @@
#### 添加一些作弊功能,同时屏蔽异常检测
## Changlog
* 2.2.7
+ New function: `Construct only nodes but frames`
+ Opening config panel does not close inventory panel now
+ Remove `Input direction conflict` check while using `Remove some build conditions`
+ Fix a bug that prevents `Belt signal alt format` from switching number formats for current belt signals
* 2.2.6
+ New function: `Stop ejectors when available nodes are all filled up`
+ Fix a bug that absorb solar sails on unfinised nodes
@@ -72,7 +77,8 @@
+ Re-intialize planet (without reseting veins)
+ Quick dismantle all buildings (without drops)
+ Dyson Sphere:
+ Stop ejectors when available nodes are all filled up
+ Stop ejectors when available nodes are all filled up
+ Construct only nodes but frames
+ Skip bullet period
+ Skip absorption period
+ Quick absorb
@@ -96,6 +102,11 @@
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
## 更新日志
* 2.2.7
+ 新功能:`只建造节点不建造框架`
+ 打开设置面板时不再关闭背包面板
+ 在`移除部分不影响游戏逻辑的建造条件`启用时移除`输入方向冲突`的检查条件
+ 修复导致`传送带信号替换格式`不切换传送带信号数字格式的问题
* 2.2.6
+ 新功能:`可用节点全部造完时停止弹射`
+ 修复了在未完成的节点上吸收太阳帆的问题
@@ -165,6 +176,7 @@
+ 快速拆除所有建筑(不掉落)
+ 戴森球:
+ 可用节点全部造完时停止弹射
+ 只建造节点不建造框架
+ 跳过子弹阶段
+ 跳过吸收阶段
+ 快速吸收

View File

@@ -40,11 +40,10 @@ public static class ResourcePatch
_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))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
@@ -89,8 +88,7 @@ public static class ResourcePatch
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int),
typeof(int))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]

View File

@@ -53,6 +53,7 @@ public class UIConfigWindow : UI.MyWindowWithTabs
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("Construct only nodes but frames", "Construct only nodes but frames", "只造节点不造框架");
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
@@ -206,6 +207,8 @@ public class UIConfigWindow : UI.MyWindowWithTabs
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.OnlyConstructNodesEnabled, "Construct only nodes but frames");
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");

View File

@@ -1,6 +1,6 @@
{
"name": "CheatEnabler",
"version_number": "2.2.6",
"version_number": "2.2.7",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [