mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 02:53:29 +08:00
WIP
This commit is contained in:
@@ -395,6 +395,7 @@ public static class FactoryPatch
|
||||
yield return new CodeInstruction(OpCodes.Ret);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler, HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.CheckBuildConditions))]
|
||||
private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
@@ -418,7 +419,7 @@ public static class FactoryPatch
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.Branches(out _)),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(BuildTool), nameof(BuildTool_Path.waitForConfirm))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(BuildTool_Path), nameof(BuildTool_Path.waitForConfirm))),
|
||||
new CodeMatch(ci => ci.Branches(out _))
|
||||
);
|
||||
var operand = matcher.Operand;
|
||||
|
||||
52
CheatEnabler/PlayerFunctions.cs
Normal file
52
CheatEnabler/PlayerFunctions.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace CheatEnabler;
|
||||
|
||||
public static class PlayerFunctions
|
||||
{
|
||||
public static void TeleportToOuterSpace()
|
||||
{
|
||||
var maxSqrDistance = 0.0;
|
||||
var starPosition = VectorLF3.zero;
|
||||
foreach (var star in GameMain.galaxy.stars)
|
||||
{
|
||||
var sqrDistance = star.position.sqrMagnitude;
|
||||
if (sqrDistance > maxSqrDistance)
|
||||
{
|
||||
maxSqrDistance = sqrDistance;
|
||||
starPosition = star.position;
|
||||
}
|
||||
}
|
||||
if (starPosition == VectorLF3.zero) return;
|
||||
var distance = Math.Sqrt(maxSqrDistance);
|
||||
GameMain.mainPlayer.controller.actionSail.StartFastTravelToUPosition((starPosition + starPosition.normalized * 50) * GalaxyData.LY);
|
||||
}
|
||||
|
||||
public static void TeleportToSelectedAstronomical()
|
||||
{
|
||||
var starmap = UIRoot.instance?.uiGame?.starmap;
|
||||
if (starmap == null) return;
|
||||
if (starmap.focusPlanet != null)
|
||||
{
|
||||
GameMain.mainPlayer.controller.actionSail.StartFastTravelToPlanet(starmap.focusPlanet.planet);
|
||||
return;
|
||||
}
|
||||
var targetUPos = VectorLF3.zero;
|
||||
if (starmap.focusStar != null)
|
||||
{
|
||||
var star = starmap.focusStar.star;
|
||||
targetUPos = star.uPosition + VectorLF3.unit_x * star.physicsRadius;
|
||||
}
|
||||
else if (starmap.focusHive != null)
|
||||
{
|
||||
var hive = starmap.focusHive.hive;
|
||||
var id = hive.hiveAstroId - 1000000;
|
||||
if (id > 0 && id < starmap.spaceSector.astros.Length)
|
||||
{
|
||||
ref var astro = ref starmap.spaceSector.astros[id];
|
||||
targetUPos = astro.uPos + VectorLF3.unit_x * astro.uRadius;
|
||||
}
|
||||
}
|
||||
GameMain.mainPlayer.controller.actionSail.StartFastTravelToUPosition(targetUPos);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@
|
||||
+ New function: `Remove some build conditions`
|
||||
+ Fix compatibility with some mods
|
||||
* 2.2.2
|
||||
+ New function: `Assign game to currrnet account`
|
||||
+ New function: `Assign gamesave to currrnet account`
|
||||
+ New subfunction: `Belt signal alt format`
|
||||
+ Fix a crash on using `Initialize this Planet`
|
||||
+ Fix belt build in `Finish build immediately`
|
||||
@@ -115,7 +115,7 @@
|
||||
+ Enable Dev Shortcuts (check config panel for usage)
|
||||
+ Disable Abnormal Checks
|
||||
+ Unlock techs with key-modifiers (Ctrl/Alt/Shift)
|
||||
+ Assign game to currrnet account
|
||||
+ Assign gamesave to currrnet account
|
||||
+ Factory:
|
||||
+ Finish build immediately
|
||||
+ Architect mode (Infinite buildings)
|
||||
@@ -238,7 +238,7 @@
|
||||
+ 新功能:`移除部分不影响游戏逻辑的建造条件`
|
||||
+ 修复了与一些mod的兼容性问题
|
||||
* 2.2.2
|
||||
+ 新功能:`将游戏绑定给当前账号`
|
||||
+ 新功能:`将游戏存档绑定给当前账号`
|
||||
+ 新子功能:`传送带信号替换格式`
|
||||
+ 修复了`初始化本行星`可能导致崩溃的问题
|
||||
+ 修复了`建造秒完成`中传送带建造的问题
|
||||
@@ -268,7 +268,7 @@
|
||||
+ 启用开发模式快捷键(使用说明见设置面板)
|
||||
+ 屏蔽异常检测
|
||||
+ 使用组合键解锁科技(Ctrl/Alt/Shift)
|
||||
+ 将游戏绑定给当前账号
|
||||
+ 将游戏存档绑定给当前账号
|
||||
+ 工厂:
|
||||
+ 建造秒完成
|
||||
+ 建筑师模式(无限建筑)
|
||||
|
||||
@@ -37,9 +37,8 @@ public static class TechPatch
|
||||
}
|
||||
}
|
||||
|
||||
private static void UnlockTechRecursive([NotNull] TechProto techProto, int maxLevel = 10000)
|
||||
private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000)
|
||||
{
|
||||
var history = GameMain.history;
|
||||
var techStates = history.techStates;
|
||||
var techID = techProto.ID;
|
||||
if (techStates == null || !techStates.TryGetValue(techID, out var value))
|
||||
@@ -58,19 +57,13 @@ public static class TechPatch
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechRecursive(preProto, maxLevel);
|
||||
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
|
||||
}
|
||||
|
||||
var techQueue = history.techQueue;
|
||||
if (techQueue != null)
|
||||
foreach (var preid in techProto.PreTechsImplicit)
|
||||
{
|
||||
for (var i = 0; i < techQueue.Length; i++)
|
||||
{
|
||||
if (techQueue[i] == techID)
|
||||
{
|
||||
techQueue[i] = 0;
|
||||
}
|
||||
}
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechRecursive(history, preProto, techProto.PreTechsMax ? 10000 : -1);
|
||||
}
|
||||
|
||||
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
|
||||
@@ -105,23 +98,37 @@ public static class TechPatch
|
||||
|
||||
private static void OnClickTech(UITechNode node)
|
||||
{
|
||||
var history = GameMain.history;
|
||||
if (VFInput.shift)
|
||||
{
|
||||
if (VFInput.alt) return;
|
||||
if (VFInput.control)
|
||||
UnlockTechRecursive(node.techProto, -100);
|
||||
UnlockTechRecursive(history, node.techProto, -100);
|
||||
else
|
||||
UnlockTechRecursive(node.techProto, -1);
|
||||
return;
|
||||
UnlockTechRecursive(history, node.techProto, -1);
|
||||
}
|
||||
if (VFInput.control)
|
||||
else
|
||||
{
|
||||
if (!VFInput.alt)
|
||||
UnlockTechRecursive(node.techProto, -10);
|
||||
if (VFInput.control)
|
||||
{
|
||||
if (!VFInput.alt)
|
||||
UnlockTechRecursive(history, node.techProto, -10);
|
||||
else
|
||||
return;
|
||||
}
|
||||
else if (VFInput.alt)
|
||||
{
|
||||
UnlockTechRecursive(history, node.techProto);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (VFInput.alt)
|
||||
history.VarifyTechQueue();
|
||||
if (history.currentTech != history.techQueue[0])
|
||||
{
|
||||
UnlockTechRecursive(node.techProto);
|
||||
history.currentTech = history.techQueue[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public static class UIConfigWindow
|
||||
{
|
||||
I18N.Add("Factory", "Factory", "工厂");
|
||||
I18N.Add("Planet", "Planet", "行星");
|
||||
I18N.Add("Combat", "Combat", "战斗");
|
||||
I18N.Add("Mecha/Combat", "Mecha/Combat", "机甲/战斗");
|
||||
I18N.Add("Enable Dev Shortcuts", "Enable Dev Shortcuts", "开发模式快捷键");
|
||||
I18N.Add("Disable Abnormal Checks", "Disable Abnormal Checks", "关闭数据异常检查");
|
||||
I18N.Add("Hotkey", "Hotkey", "快捷键");
|
||||
@@ -26,7 +26,7 @@ public static class UIConfigWindow
|
||||
I18N.Add("Unlock Tech with Key-Modifiers Tips",
|
||||
"Click tech on tree while holding:\n Shift: Tech level + 1\n Ctrl: Tech level + 10\n Ctrl + Shift: Tech level + 100\n Alt: Tech level to MAX\n\nNote: all direct prerequisites will be unlocked as well.",
|
||||
"按住以下组合键点击科技树:\n Shift:科技等级+1\n Ctrl:科技等级+10\n Ctrl+Shift:科技等级+100\n Alt:科技等级升到最大\n\n注意:所有直接前置科技也会被解锁");
|
||||
I18N.Add("Assign game to current account", "Assign game to current account", "将游戏绑定给当前账号");
|
||||
I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
|
||||
I18N.Add("Finish build immediately", "Finish build immediately", "建造秒完成");
|
||||
I18N.Add("Architect mode", "Architect mode", "建筑师模式");
|
||||
I18N.Add("Build without condition", "Build without condition check", "无条件建造");
|
||||
@@ -60,6 +60,8 @@ public static class UIConfigWindow
|
||||
I18N.Add("Instant teleport (like that in Sandbox mode)", "Instant teleport (like that in Sandbox mode)", "快速传送(和沙盒模式一样)");
|
||||
I18N.Add("Mecha and Drones/Fleets invicible", "Mecha and Drones/Fleets invicible", "机甲和战斗无人机无敌");
|
||||
I18N.Add("Buildings invicible", "Buildings invincible", "建筑无敌");
|
||||
I18N.Add("Teleport to outer space", "Teleport to outer space", "传送到外太空");
|
||||
I18N.Add("Teleport to selected astronomical", "Teleport to selected astronomical", "传送到选中的天体");
|
||||
I18N.Apply();
|
||||
MyConfigWindow.OnUICreated += CreateUI;
|
||||
MyConfigWindow.OnUpdateUI += UpdateUI;
|
||||
@@ -87,7 +89,7 @@ public static class UIConfigWindow
|
||||
MyWindow.AddTipsButton(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips");
|
||||
x = 300f;
|
||||
y = 10f;
|
||||
_resignGameBtn = wnd.AddButton(x, y, 200f, tab1, "Assign game to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
||||
_resignGameBtn = wnd.AddButton(x, y, 200f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
||||
|
||||
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
||||
x = 0f;
|
||||
@@ -188,12 +190,17 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Combat");
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical);
|
||||
return;
|
||||
|
||||
void OnBeltSignalChanged()
|
||||
|
||||
Reference in New Issue
Block a user