1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 02:53:29 +08:00
This commit is contained in:
2023-09-12 21:05:54 +08:00
parent e12d20980a
commit e798055f7a
6 changed files with 100 additions and 71 deletions

View File

@@ -11,6 +11,7 @@ public static class AbnormalDisabler
public static void Init() public static void Init()
{ {
if (_patch != null) return;
_patch = Harmony.CreateAndPatchAll(typeof(AbnormalDisabler)); _patch = Harmony.CreateAndPatchAll(typeof(AbnormalDisabler));
} }

View File

@@ -72,7 +72,7 @@ public static class BirthPlanetPatch
FlatBirthPlanet.SettingChanged += (_, _) => PatchBirthThemeData(); FlatBirthPlanet.SettingChanged += (_, _) => PatchBirthThemeData();
HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData(); HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData();
PatchBirthThemeData(); PatchBirthThemeData();
_patch = Harmony.CreateAndPatchAll(typeof(DevShortcuts)); _patch = Harmony.CreateAndPatchAll(typeof(BirthPlanetPatch));
} }
public static void Uninit() public static void Uninit()

View File

@@ -18,6 +18,7 @@ public static class BuildPatch
public static void Init() public static void Init()
{ {
if (_patch != null) return;
ImmediateEnabled.SettingChanged += (_, _) => ImmediateValueChanged(); ImmediateEnabled.SettingChanged += (_, _) => ImmediateValueChanged();
NoCostEnabled.SettingChanged += (_, _) => NoCostValueChanged(); NoCostEnabled.SettingChanged += (_, _) => NoCostValueChanged();
NoConditionEnabled.SettingChanged += (_, _) => NoConditionValueChanged(); NoConditionEnabled.SettingChanged += (_, _) => NoConditionValueChanged();

View File

@@ -1,4 +1,6 @@
using BepInEx.Configuration; using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
namespace CheatEnabler; namespace CheatEnabler;
@@ -6,10 +8,15 @@ public static class DevShortcuts
{ {
public static ConfigEntry<bool> Enabled; public static ConfigEntry<bool> Enabled;
private static Harmony _patch; private static Harmony _patch;
private static PlayerAction_Test _test;
public static void Init() public static void Init()
{ {
_patch = Harmony.CreateAndPatchAll(typeof(DevShortcuts)); _patch = Harmony.CreateAndPatchAll(typeof(DevShortcuts));
Enabled.SettingChanged += (_, _) =>
{
if (_test != null) _test.active = Enabled.Value;
};
} }
public static void Uninit() public static void Uninit()
@@ -30,32 +37,41 @@ public static class DevShortcuts
newActions[i] = __instance.actions[i]; newActions[i] = __instance.actions[i];
} }
var test = new PlayerAction_Test(); _test = new PlayerAction_Test();
test.Init(__instance.player); _test.Init(__instance.player);
newActions[cnt] = test; _test.active = Enabled.Value;
newActions[cnt] = _test;
__instance.actions = newActions; __instance.actions = newActions;
Enabled.SettingChanged += (_, _) =>
{
if (!Enabled.Value)
{
test.active = false;
}
};
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), "GameTick")] [HarmonyPatch(typeof(PlayerAction_Test), "GameTick")]
private static void PlayerAction_Test_GameTick_Postfix(PlayerAction_Test __instance) private static void PlayerAction_Test_GameTick_Postfix(PlayerAction_Test __instance)
{ {
if (!Enabled.Value) return;
var lastActive = __instance.active;
__instance.Update(); __instance.Update();
if (lastActive != __instance.active) }
{
UIRealtimeTip.PopupAhead( [HarmonyTranspiler]
(lastActive ? "Developer Mode Shortcuts Disabled" : "Developer Mode Shortcuts Enabled").Translate(), [HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))]
false); private static IEnumerable<CodeInstruction> PlayerAction_Test_Update_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
} {
var matcher = new CodeMatcher(instructions, generator);
matcher.End().MatchBack(false,
new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlayerAction_Test), nameof(PlayerAction_Test.active)))
);
var pos = matcher.Pos;
/* Remove Shift+F4 part of the method */
matcher.Start().RemoveInstructions(pos);
matcher.Start().MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(GameMain), "get_sandboxToolsEnabled")),
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Ceq)
);
var labels = matcher.Labels;
matcher.SetInstructionAndAdvance(
new CodeInstruction(OpCodes.Ldc_I4_1).WithLabels(labels)
).RemoveInstructions(2);
return matcher.InstructionEnumeration();
} }
} }

View File

@@ -5,51 +5,62 @@
## Usage ## Usage
* Disable abnormal determinants (Disable all sanity checks, and can get achievements on using Console and Developer Mode * Press `` LAlt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel.
shortcuts). * There are also buttons on title screen and planet minimap area to call up the config panel.
* Shift+F4 to switch Developer Mode on/off. * Features:
* Numpad 1: Gets all items and extends bag. + Enable Dev Shortcuts (check config panel for usage)
* Numpad 2: Boosts walk speed, gathering speed and mecha energy restoration. + Disable Abnormal Checks
* Numpad 3: Fills planet with foundations and bury all veins. + Build:
* Numpad 4: +1 construction drone. + Finish build immediately
* Numpad 5: Upgrades drone engine tech to full. + Infinite buildings
* Numpad 6: Unlocks researching tech. + Build without condition
* Numpad 7: Unlocks Drive Engine 1. + No collision
* Numpad 8: Unlocks Drive Engine 2 and maximize energy. + Planet:
* Numpad 9: Unlocks ability to warp. + Infinite Natural Resources
* Numpad 0: No costs for Logistic Storages' output. + Fast Mining
* LCtrl + T: Unlocks all techs (not upgrades). + Pump Anywhere
* LCtrl + A: Resets all local achievements. + Terraform without enought sands
* LCtrl + Q: Adds 10000 to every metadata. + Re-intialize planet (without reseting veins)
* LCtrl + W: Enters Sandbox Mode. + Quick dismantle all buildings (without drops)
* Numpad *: Proliferates items on hand. + Dyson Sphere:
* Numpad /: Removes proliferations from items on hand. + Skip bullet period
* PageDown: Remembers Pose of game camera. + Skip absorption period
* PageUp: Locks game camera using remembered Pose. + Quick absorb
* Always infinite resource. + Eject anyway
* Each function can be enabled individually in config file. + Re-initialize Dyson Spheres
+ Quick dismantle Dyson Shells
+ Birth star:
+ Rare resources on birth planet
+ Solid flat on birth planet
+ High luminosity for birth star
## 使用说明 ## 使用说明
* 屏蔽游戏异常检测 (使用任何作弊功能都不影响正常获得成就) * 按 `` 左Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键
* Shift+F4 切换开发模式开关 * 标题界面和行星小地图旁也有按钮呼出主面板。
* 按小键盘1获得所有物品并扩展背包 * 功能:
* 按小键盘2加快行走速度及采集速度加快能量恢复速度 + 启用开发模式快捷键(使用说明见设置面板)
* 按小键盘3将地基铺设整个星球并掩埋所有矿物 + 屏蔽异常检测
* 按小键盘4建设机器人 +1 + 建造:
* 按小键盘5建设机器人满级 + 建造秒完成
* 按小键盘6解锁当前科技 + 无限建筑
* 按小键盘7解锁驱动技术I + 无条件建造
* 按小键盘8解锁驱动技术II 最大化能量 + 无碰撞
* 按小键盘9机甲曲速解锁 + 行星:
* 按小键盘0物流站通过传送带出物品无消耗 + 自然资源采集不消耗
* 左ctrl + T解锁所有非升级科技 + 高速采集
* 左ctrl + A重置所有本地成就 + 平地抽水
* 左ctrl + Q增加各项元数据10000点 + 沙土不够时依然可以整改地形
* 左ctrl + W进入沙盒模式 + 初始化本行星(不重置矿脉)
* 小键盘乘号 *:给手上的物品喷涂加速剂 + 快速拆除所有建筑(不掉落)
* 小键盘除号 /:清除手上的物品加速剂 + 戴森球:
* PageDown记录摄像机当前的Pose + 跳过子弹阶段
* PageUp用记录的Pose锁定摄像机 + 跳过吸收阶段
* 总是无限资源。 + 快速吸收
* 各功能可以在配置文件中单独开关。 + 全球弹射
+ 初始化戴森球
+ 快速拆除戴森壳
+ 母星系:
+ 母星有稀有资源
+ 母星是纯平的
+ 母星系恒星高亮

View File

@@ -24,15 +24,17 @@ public class UIConfigWindow : UI.MyWindowWithTabs
I18N.Add("Infinite Natural Resources", "Infinite Natural Resources", "自然资源采集不消耗"); I18N.Add("Infinite Natural Resources", "Infinite Natural Resources", "自然资源采集不消耗");
I18N.Add("Fast Mining", "Fast Mining", "高速采集"); I18N.Add("Fast Mining", "Fast Mining", "高速采集");
I18N.Add("Pump Anywhere", "Pump Anywhere", "平地抽水"); I18N.Add("Pump Anywhere", "Pump Anywhere", "平地抽水");
I18N.Add("Initialize This Planet", "Initialize This Planet", "初始化本行星");
I18N.Add("Dismantle All Buildings", "Dismantle All Buildings", "拆除所有建筑");
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球"); I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段"); I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段"); I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
I18N.Add("Quick absorb", "Quick absorb", "快速吸收"); I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
I18N.Add("Eject anyway", "Eject anyway", "全球弹射"); I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
I18N.Add("Terraform without enough sands", "Terraform without enough sands", "沙土不够时依然可以整改地形");
I18N.Add("Initialize Dyson Sphere", "Initialize Dyson Sphere", "初始化戴森球"); I18N.Add("Initialize Dyson Sphere", "Initialize Dyson Sphere", "初始化戴森球");
I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳"); I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳");
I18N.Add("Birth", "Birth Sys", "母星系"); I18N.Add("Birth", "Birth Sys", "母星系");
I18N.Add("Terraform without enought sands", "Terraform without enough sands", "沙土不够时依然可以整改地形");
I18N.Add("Silicon/Titanium on birth planet", "Silicon/Titanium on birth planet", "母星有硅和钛"); I18N.Add("Silicon/Titanium on birth planet", "Silicon/Titanium on birth planet", "母星有硅和钛");
I18N.Add("Fire ice on birth planet", "Fire ice on birth planet", "母星有可燃冰"); I18N.Add("Fire ice on birth planet", "Fire ice on birth planet", "母星有可燃冰");
I18N.Add("Kimberlite on birth planet", "Kimberlite on birth planet", "母星有金伯利矿"); I18N.Add("Kimberlite on birth planet", "Kimberlite on birth planet", "母星有金伯利矿");
@@ -43,8 +45,6 @@ public class UIConfigWindow : UI.MyWindowWithTabs
I18N.Add("Unipolar magnet on birth planet", "Unipolar magnet on birth planet", "母星有单极磁石"); I18N.Add("Unipolar magnet on birth planet", "Unipolar magnet on birth planet", "母星有单极磁石");
I18N.Add("Birth planet is solid flat (no water at all)", "Birth planet is solid flat (no water at all)", "母星是纯平的(没有水)"); I18N.Add("Birth planet is solid flat (no water at all)", "Birth planet is solid flat (no water at all)", "母星是纯平的(没有水)");
I18N.Add("Birth star has high luminosity", "Birth star has high luminosity", "母星系恒星高亮"); I18N.Add("Birth star has high luminosity", "Birth star has high luminosity", "母星系恒星高亮");
I18N.Add("Initialize This Planet", "Initialize This Planet", "初始化本行星");
I18N.Add("Dismantle All Buildings", "Dismantle All Buildings", "拆除所有建筑");
I18N.Apply(); I18N.Apply();
} }
@@ -94,7 +94,7 @@ public class UIConfigWindow : UI.MyWindowWithTabs
y += 36f; y += 36f;
UI.MyCheckBox.CreateCheckBox(x, y, tab3, WaterPumperPatch.Enabled, "Pump Anywhere"); UI.MyCheckBox.CreateCheckBox(x, y, tab3, WaterPumperPatch.Enabled, "Pump Anywhere");
y += 36f; y += 36f;
UI.MyCheckBox.CreateCheckBox(x, y, tab3, TerraformPatch.Enabled, "Terraform without enought sands"); UI.MyCheckBox.CreateCheckBox(x, y, tab3, TerraformPatch.Enabled, "Terraform without enough sands");
x = 300f; x = 300f;
y = 10f; y = 10f;
AddButton(x, y, tab3, "矿物掩埋标题", 16, "button-bury-all", () => AddButton(x, y, tab3, "矿物掩埋标题", 16, "button-bury-all", () =>