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

CheatEnabler v2.4.2

This commit is contained in:
2026-01-29 02:13:06 +08:00
parent 71c0fe75db
commit 6e4416389d
5 changed files with 24 additions and 24 deletions

View File

@@ -3,6 +3,10 @@
## Changlog ## Changlog
* 2.4.2
* Fix critical bugs:
* Dyson Power is not updated actively when `Skip bullet period` or `Skip absorption period` is enabled and no rocket is in fire.
* Dyson Power is not updated actively on clicking `Complete Dyson Sphere Shells instantly` or `Remove all frames on Dyson Sphere`.
* 2.4.1 * 2.4.1
* New feature: `Remove all frames on Dyson Sphere` * New feature: `Remove all frames on Dyson Sphere`
* Can save rockets with very little power generation impact. * Can save rockets with very little power generation impact.
@@ -171,6 +175,10 @@
## 更新日志 ## 更新日志
* 2.4.2
* 修复了严重的系列BUG:
* 在启用`跳过子弹阶段``跳过吸收阶段`并且没有火箭发射时,戴森球的发电量未实时更新
* 点击`立即完成戴森壳建造``移除戴森球上的所有框架`时,戴森球的发电量未实时更新
* 2.4.1 * 2.4.1
* 新增功能:`移除戴森球上的所有框架` * 新增功能:`移除戴森球上的所有框架`
* 可以节省火箭,且几乎不影响发电效率 * 可以节省火箭,且几乎不影响发电效率

View File

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

View File

@@ -217,6 +217,7 @@ public static class DysonSphereFunctions
if (count > 0L) consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count; if (count > 0L) consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count;
} }
} }
dysonSphere.needRecalculatePower = true;
}); });
} }
@@ -281,6 +282,7 @@ public static class DysonSphereFunctions
dysonSphere.CheckAutoNodes(); dysonSphere.CheckAutoNodes();
dysonSphere.PickAutoNode(); dysonSphere.PickAutoNode();
dysonSphere.modelRenderer.RebuildModels(); dysonSphere.modelRenderer.RebuildModels();
dysonSphere.needRecalculatePower = true;
}); });
} }

View File

@@ -337,6 +337,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += len; sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += len; sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += len; sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += len;
__instance.dysonSphere.needRecalculatePower = true;
return; return;
} }
idx--; idx--;
@@ -350,6 +351,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt; sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt; sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += absorbCnt; sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += absorbCnt;
__instance.dysonSphere.needRecalculatePower = true;
} }
} }
for (; idx >= 0; idx--) for (; idx >= 0; idx--)
@@ -380,31 +382,19 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(ExpiryOrder), nameof(ExpiryOrder.index))) new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(ExpiryOrder), nameof(ExpiryOrder.index)))
).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert( ).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert(
// if (node.ConstructCp() != null)
// {
// this.dysonSphere.productRegister[ProductionStatistics.DYSON_CELL_ID]++;
// }
new CodeInstruction(OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(DysonNode), nameof(DysonNode.ConstructCp))),
new CodeInstruction(OpCodes.Brfalse_S, label1),
new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.dysonSphere))), new CodeInstruction(OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(DysonSphere), nameof(DysonSphere.productRegister))),
new CodeInstruction(OpCodes.Ldc_I4, ProductionStatistics.DYSON_CELL_ID),
new CodeInstruction(OpCodes.Ldelema, typeof(int)),
new CodeInstruction(OpCodes.Dup),
new CodeInstruction(OpCodes.Ldind_I4),
new CodeInstruction(OpCodes.Ldc_I4_1),
new CodeInstruction(OpCodes.Add),
new CodeInstruction(OpCodes.Stind_I4),
// this.RemoveSolarSail(index);
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(label1),
new CodeInstruction(OpCodes.Ldloc_1), new CodeInstruction(OpCodes.Ldloc_1),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(DysonSwarm), nameof(DysonSwarm.RemoveSolarSail))), Transpilers.EmitDelegate((DysonSwarm swarm, DysonNode node, int index) => {
if (node.ConstructCp() != null)
{
swarm.dysonSphere.productRegister[ProductionStatistics.DYSON_CELL_ID]++;
swarm.dysonSphere.needRecalculatePower = true;
}
swarm.RemoveSolarSail(index);
}),
// return false; // return false;
new CodeInstruction(OpCodes.Ldc_I4_1), new CodeInstruction(OpCodes.Ldc_I4_0),
new CodeInstruction(OpCodes.Ret) new CodeInstruction(OpCodes.Ret)
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();

View File

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