1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 21:33:28 +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()
{
if (_patch != null) return;
_patch = Harmony.CreateAndPatchAll(typeof(AbnormalDisabler));
}

View File

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

View File

@@ -18,6 +18,7 @@ public static class BuildPatch
public static void Init()
{
if (_patch != null) return;
ImmediateEnabled.SettingChanged += (_, _) => ImmediateValueChanged();
NoCostEnabled.SettingChanged += (_, _) => NoCostValueChanged();
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;
namespace CheatEnabler;
@@ -6,10 +8,15 @@ public static class DevShortcuts
{
public static ConfigEntry<bool> Enabled;
private static Harmony _patch;
private static PlayerAction_Test _test;
public static void Init()
{
_patch = Harmony.CreateAndPatchAll(typeof(DevShortcuts));
Enabled.SettingChanged += (_, _) =>
{
if (_test != null) _test.active = Enabled.Value;
};
}
public static void Uninit()
@@ -30,32 +37,41 @@ public static class DevShortcuts
newActions[i] = __instance.actions[i];
}
var test = new PlayerAction_Test();
test.Init(__instance.player);
newActions[cnt] = test;
_test = new PlayerAction_Test();
_test.Init(__instance.player);
_test.active = Enabled.Value;
newActions[cnt] = _test;
__instance.actions = newActions;
Enabled.SettingChanged += (_, _) =>
{
if (!Enabled.Value)
{
test.active = false;
}
};
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), "GameTick")]
private static void PlayerAction_Test_GameTick_Postfix(PlayerAction_Test __instance)
{
if (!Enabled.Value) return;
var lastActive = __instance.active;
__instance.Update();
if (lastActive != __instance.active)
{
UIRealtimeTip.PopupAhead(
(lastActive ? "Developer Mode Shortcuts Disabled" : "Developer Mode Shortcuts Enabled").Translate(),
false);
}
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))]
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
* Disable abnormal determinants (Disable all sanity checks, and can get achievements on using Console and Developer Mode
shortcuts).
* Shift+F4 to switch Developer Mode on/off.
* Numpad 1: Gets all items and extends bag.
* Numpad 2: Boosts walk speed, gathering speed and mecha energy restoration.
* Numpad 3: Fills planet with foundations and bury all veins.
* Numpad 4: +1 construction drone.
* Numpad 5: Upgrades drone engine tech to full.
* Numpad 6: Unlocks researching tech.
* Numpad 7: Unlocks Drive Engine 1.
* Numpad 8: Unlocks Drive Engine 2 and maximize energy.
* Numpad 9: Unlocks ability to warp.
* Numpad 0: No costs for Logistic Storages' output.
* LCtrl + T: Unlocks all techs (not upgrades).
* LCtrl + A: Resets all local achievements.
* LCtrl + Q: Adds 10000 to every metadata.
* LCtrl + W: Enters Sandbox Mode.
* Numpad *: Proliferates items on hand.
* Numpad /: Removes proliferations from items on hand.
* PageDown: Remembers Pose of game camera.
* PageUp: Locks game camera using remembered Pose.
* Always infinite resource.
* Each function can be enabled individually in config file.
* Press `` LAlt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel.
* There are also buttons on title screen and planet minimap area to call up the config panel.
* Features:
+ Enable Dev Shortcuts (check config panel for usage)
+ Disable Abnormal Checks
+ Build:
+ Finish build immediately
+ Infinite buildings
+ Build without condition
+ No collision
+ Planet:
+ Infinite Natural Resources
+ Fast Mining
+ Pump Anywhere
+ Terraform without enought sands
+ Re-intialize planet (without reseting veins)
+ Quick dismantle all buildings (without drops)
+ Dyson Sphere:
+ Skip bullet period
+ Skip absorption period
+ Quick absorb
+ Eject anyway
+ 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
## 使用说明
* 屏蔽游戏异常检测 (使用任何作弊功能都不影响正常获得成就)
* 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锁定摄像机
* 总是无限资源。
* 各功能可以在配置文件中单独开关。
* 按 `` 左Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键
* 标题界面和行星小地图旁也有按钮呼出主面板。
* 功能:
+ 启用开发模式快捷键(使用说明见设置面板)
+ 屏蔽异常检测
+ 建造:
+ 建造秒完成
+ 无限建筑
+ 无条件建造
+ 无碰撞
+ 行星:
+ 自然资源采集不消耗
+ 高速采集
+ 平地抽水
+ 沙土不够时依然可以整改地形
+ 初始化本行星(不重置矿脉)
+ 快速拆除所有建筑(不掉落)
+ 戴森球:
+ 跳过子弹阶段
+ 跳过吸收阶段
+ 快速吸收
+ 全球弹射
+ 初始化戴森球
+ 快速拆除戴森壳
+ 母星系:
+ 母星有稀有资源
+ 母星是纯平的
+ 母星系恒星高亮

View File

@@ -24,15 +24,17 @@ public class UIConfigWindow : UI.MyWindowWithTabs
I18N.Add("Infinite Natural Resources", "Infinite Natural Resources", "自然资源采集不消耗");
I18N.Add("Fast Mining", "Fast Mining", "高速采集");
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("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
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("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳");
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("Fire ice on birth planet", "Fire ice 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("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("Initialize This Planet", "Initialize This Planet", "初始化本行星");
I18N.Add("Dismantle All Buildings", "Dismantle All Buildings", "拆除所有建筑");
I18N.Apply();
}
@@ -94,7 +94,7 @@ public class UIConfigWindow : UI.MyWindowWithTabs
y += 36f;
UI.MyCheckBox.CreateCheckBox(x, y, tab3, WaterPumperPatch.Enabled, "Pump Anywhere");
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;
y = 10f;
AddButton(x, y, tab3, "矿物掩埋标题", 16, "button-bury-all", () =>