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

CheatEnabler 2.2.1

This commit is contained in:
2023-09-23 03:26:59 +08:00
parent 2ed617a299
commit ef5c971c5a
4 changed files with 46 additions and 14 deletions

View File

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

View File

@@ -468,7 +468,7 @@ public static class FactoryPatch
private static class NoConditionBuild
{
[HarmonyTranspiler]
[HarmonyTranspiler, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CheckBuildConditions))]
// [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Inserter), nameof(BuildTool_Inserter.CheckBuildConditions))]
@@ -479,13 +479,21 @@ public static class FactoryPatch
yield return new CodeInstruction(OpCodes.Ret);
}
[HarmonyTranspiler]
[HarmonyTranspiler, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
private static IEnumerable<CodeInstruction> BuildTool_Click_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions)
private static IEnumerable<CodeInstruction> BuildTool_Click_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(NoConditionBuild), nameof(CheckForMiner)));
yield return new CodeInstruction(OpCodes.Ret);
var matcher = new CodeMatcher(instructions, generator);
var label1 = generator.DefineLabel();
matcher.Start().InsertAndAdvance(
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(NoConditionBuild), nameof(CheckForMiner))),
new CodeInstruction(OpCodes.Brfalse_S, label1),
new CodeInstruction(OpCodes.Ldc_I4_1),
new CodeInstruction(OpCodes.Ret)
);
matcher.Labels.Add(label1);
return matcher.InstructionEnumeration();
}
public static bool CheckForMiner(BuildTool tool)
@@ -1102,14 +1110,22 @@ public static class FactoryPatch
var matcher = new CodeMatcher(instructions);
matcher.Start().MatchForward(false,
new CodeMatch(OpCodes.Ldc_R4, 110.25f)
).Repeat(codeMatcher => codeMatcher.SetAndAdvance(
OpCodes.Ldc_R4, 1f
));
);
if (matcher.IsValid)
{
matcher.Repeat(codeMatcher => codeMatcher.SetAndAdvance(
OpCodes.Ldc_R4, 1f
));
}
matcher.Start().MatchForward(false,
new CodeMatch(OpCodes.Ldc_R4, 144f)
).Repeat(codeMatcher => codeMatcher.SetAndAdvance(
OpCodes.Ldc_R4, 1f
));
);
if (matcher.IsValid)
{
matcher.Repeat(codeMatcher => codeMatcher.SetAndAdvance(
OpCodes.Ldc_R4, 1f
));
}
return matcher.InstructionEnumeration();
}
}

View File

@@ -4,6 +4,9 @@
#### 添加一些作弊功能,同时屏蔽异常检测
## Changlog
* 2.2.1
+ Check condition for miners even when `Build without condition` is enabled.
+ Fix a patch issue that may cause `Build without condition` not working.
* 2.2.0
+ Add some power related functions
+ Add a subfunction to belt signal item generation, which simulates production process of raws and intermediates on statistics
@@ -58,6 +61,11 @@
+ Solid flat on birth planet
+ High luminosity for birth star
## Notes
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
+ You can download `BepInEx` [here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
+ If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
## CREDITS
* [Dyson Sphere Program](https://store.steampowered.com/app/1366540): The great game
* [BepInEx](https://bepinex.dev/): Base modding framework
@@ -65,6 +73,9 @@
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
## 更新日志
* 2.2.1
+ 即使在启用`无条件建造`时依然检查矿机的建造条件
+ 修复一个可能导致`无条件建造`不生效的问题
* 2.2.0
+ 添加了一些发电相关功能
+ 为传送带信号物品生成添加了一个子功能,在统计面板模拟了原材料和中间产物的生产过程
@@ -118,6 +129,11 @@
+ 母星是纯平的
+ 母星系恒星高亮
## 注意事项
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。
+ 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)选择x64版本下载`BepInEx`
+ 如果使用r2modman你可以点击`Settings` -> `Browse profile folder`然后将下载的zip解压到该文件夹并覆盖现有文件。
## 鸣谢
* [戴森球计划](https://store.steampowered.com/app/1366540): 伟大的游戏
* [BepInEx](https://bepinex.dev/): 基础模组框架

View File

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