mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 22:13:30 +08:00
WIP
This commit is contained in:
@@ -33,7 +33,7 @@ public static class FactoryPatch
|
||||
if (_factoryPatch != null) return;
|
||||
_noConditionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Q, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCondition",
|
||||
canOverride = true
|
||||
@@ -41,7 +41,7 @@ public static class FactoryPatch
|
||||
);
|
||||
_noCollisionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.W, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCollision",
|
||||
canOverride = true
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||
|
||||
## Changlog
|
||||
* 2.3.14
|
||||
+ Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed.
|
||||
* 2.3.13
|
||||
+ Fix a bug that shortcuts are not working and have display issue on settings window.
|
||||
* 2.3.12
|
||||
@@ -131,6 +133,8 @@
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||
|
||||
## 更新日志
|
||||
* 2.3.14
|
||||
+ 移除了`无条件建造`和`无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
|
||||
* 2.3.13
|
||||
+ 修复了快捷键无效和设置窗口上的按键显示问题
|
||||
* 2.3.12
|
||||
|
||||
@@ -19,6 +19,7 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> OffGridBuildingEnabled;
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> TreatStackingAsSingleEnabled;
|
||||
public static ConfigEntry<bool> QuickBuildAndDismantleLabEnabled;
|
||||
|
||||
private static Harmony _factoryPatch;
|
||||
|
||||
@@ -33,6 +34,7 @@ public static class FactoryPatch
|
||||
OffGridBuildingEnabled.SettingChanged += (_, _) => OffGridBuilding.Enable(OffGridBuildingEnabled.Value);
|
||||
LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
TreatStackingAsSingleEnabled.SettingChanged += (_, _) => TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
|
||||
QuickBuildAndDismantleLabEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabEnabled.Value);
|
||||
UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
|
||||
RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
|
||||
NightLight.Enable(NightLightEnabled.Value);
|
||||
@@ -42,6 +44,7 @@ public static class FactoryPatch
|
||||
OffGridBuilding.Enable(OffGridBuildingEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
|
||||
QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabEnabled.Value);
|
||||
|
||||
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||
}
|
||||
@@ -57,6 +60,7 @@ public static class FactoryPatch
|
||||
OffGridBuilding.Enable(false);
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
TreatStackingAsSingle.Enable(false);
|
||||
QuickBuildAndDismantleLab.Enable(false);
|
||||
|
||||
_factoryPatch?.UnpatchSelf();
|
||||
_factoryPatch = null;
|
||||
@@ -956,4 +960,97 @@ public static class FactoryPatch
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private static class QuickBuildAndDismantleLab
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(QuickBuildAndDismantleLab));
|
||||
return;
|
||||
}
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
private static bool DetermineMoreLabs(BuildTool_Dismantle dismantle, int id)
|
||||
{
|
||||
if (!VFInput._chainReaction) return true;
|
||||
var factory = dismantle.factory;
|
||||
var entity = factory.entityPool[id];
|
||||
var factorySystem = factory.factorySystem;
|
||||
if (entity.labId <= 0 || entity.labId > factorySystem.labCursor) return true;
|
||||
ref var lab = ref factory.factorySystem.labPool[entity.labId];
|
||||
if (lab.id != entity.labId) return true;
|
||||
factory.ReadObjectConn(id, 14, out _, out var nextId, out _);
|
||||
if (nextId == 0) return true;
|
||||
while (true)
|
||||
{
|
||||
factory.ReadObjectConn(nextId, 14, out _, out var nextNextId, out _);
|
||||
if (nextNextId <= 0) break;
|
||||
var pose = dismantle.GetObjectPose(nextId);
|
||||
var desc = dismantle.GetPrefabDesc(nextId);
|
||||
var preview = new BuildPreview
|
||||
{
|
||||
item = dismantle.GetItemProto(nextId),
|
||||
desc = desc,
|
||||
lpos = pose.position,
|
||||
lrot = pose.rotation,
|
||||
lpos2 = pose.position,
|
||||
lrot2 = pose.rotation,
|
||||
objId = nextId,
|
||||
needModel = desc.lodCount > 0 && desc.lodMeshes[0] != null,
|
||||
isConnNode = true
|
||||
};
|
||||
dismantle.buildPreviews.Add(preview);
|
||||
nextId = nextNextId;
|
||||
}
|
||||
nextId = id;
|
||||
while (true)
|
||||
{
|
||||
factory.ReadObjectConn(nextId, 15, out _, out nextId, out _);
|
||||
if (nextId <= 0) break;
|
||||
var pose = dismantle.GetObjectPose(nextId);
|
||||
var desc = dismantle.GetPrefabDesc(nextId);
|
||||
var preview = new BuildPreview
|
||||
{
|
||||
item = dismantle.GetItemProto(nextId),
|
||||
desc = desc,
|
||||
lpos = pose.position,
|
||||
lrot = pose.rotation,
|
||||
lpos2 = pose.position,
|
||||
lrot2 = pose.rotation,
|
||||
objId = nextId,
|
||||
needModel = desc.lodCount > 0 && desc.lodMeshes[0] != null,
|
||||
isConnNode = true
|
||||
};
|
||||
dismantle.buildPreviews.Add(preview);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))]
|
||||
private static IEnumerable<CodeInstruction> BuildTool_Dismantle_DeterminePreviews_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldloc_3),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.desc))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PrefabDesc), nameof(PrefabDesc.isBattleBase))),
|
||||
new CodeMatch(OpCodes.Brfalse)
|
||||
).Advance(-1);
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldloc_3),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.objId))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(QuickBuildAndDismantleLab), nameof(DetermineMoreLabs))),
|
||||
new CodeInstruction(OpCodes.And)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public static class PlayerPatch
|
||||
AutoNavigation.Enable(AutoNavigationEnabled.Value);
|
||||
_autoDriveKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.A, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleAutoCruise",
|
||||
canOverride = true
|
||||
@@ -237,7 +237,7 @@ public static class PlayerPatch
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (GameMain.instance.timei % 6 == 0)
|
||||
if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero)
|
||||
{
|
||||
_direction = astroVec.normalized;
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#### 一些提升用户体验的功能和补丁
|
||||
|
||||
## Changlog
|
||||
* 1.0.19
|
||||
+ Remove default shortcut key for `Auto-cruise`, to avoid misoperation. Please set it in the system options window manually if needed.
|
||||
* 1.0.18
|
||||
+ Fix crash while coursing to a dark-fog hive.
|
||||
+ Auto-cruise does not bypass dark-fog hives if they are targeted.
|
||||
@@ -11,7 +13,7 @@
|
||||
+ New function: `Auto navigation on sailings`, which is inspired by [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/)
|
||||
- It keeps Icarus on course to the target planet
|
||||
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
|
||||
- Furthermore, there is also a shortcut key(Alt+A by default) which can be set in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
- Furthermore, there is also a shortcut key which can be set in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
- Auto-cruise will start when you target a planet on star map
|
||||
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
|
||||
- It will speed down when approaching the target planet, to avoid overshooting
|
||||
@@ -78,7 +80,7 @@
|
||||
|
||||
## Usage
|
||||
|
||||
* Press `` LAlt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel.
|
||||
* Press `` Alt+`(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.
|
||||
* Patches:
|
||||
+ Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
|
||||
@@ -105,7 +107,7 @@
|
||||
- Auto navigation on sailings
|
||||
- It keeps Icarus on course to the target planet
|
||||
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
|
||||
- Furthermore, there is also a shortcut key(Alt+A by default) which can be set in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
- Furthermore, you can set a shortcut key in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
- Auto-cruise will start when you select a planet as target
|
||||
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
|
||||
- It will speed down when approaching the target planet, to avoid overshooting
|
||||
@@ -135,6 +137,8 @@
|
||||
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
|
||||
|
||||
## 更新日志
|
||||
* 1.0.19
|
||||
+ 移除了`自动巡航`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
|
||||
* 1.0.18
|
||||
+ 修复了以黑雾巢穴为目标时导致崩溃的问题
|
||||
+ 当黑雾巢穴是目标时,自动导航不会绕过它
|
||||
@@ -142,7 +146,7 @@
|
||||
+ 新功能:`航行时自动导航`,想法来自[CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/)
|
||||
- 它会保持伊卡洛斯飞向目标星球
|
||||
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
|
||||
- 此外,还有一个快捷键(默认为Alt+A)可以在系统选项窗口中设置,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
- 此外,还有一个快捷键可以在系统选项窗口中设置,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
- 当你选择目标星球后,自动巡航就会开始
|
||||
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
|
||||
- 它会在接近目标星球时减速,以避免发生越过目标的情况
|
||||
@@ -209,7 +213,7 @@
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 按 `` 左Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。
|
||||
* 按 `` Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。
|
||||
* 标题界面和行星小地图旁也有按钮呼出主面板。
|
||||
* 补丁:
|
||||
+ 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
||||
@@ -238,7 +242,7 @@
|
||||
- 航行时自动导航
|
||||
- 它会保持伊卡洛斯飞向目标星球
|
||||
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
|
||||
- 此外,还有一个快捷键(默认为Alt+A)可以在系统选项窗口中设置,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
- 此外,可以在系统选项窗口中设置快捷键,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
- 当你选择目标星球后,自动巡航就会开始
|
||||
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
|
||||
- 它会在接近目标星球时减速,以避免发生越过目标的情况
|
||||
|
||||
@@ -67,6 +67,8 @@ public class UXAssist : BaseUnityPlugin
|
||||
"Logistics capacity related tweaks");
|
||||
FactoryPatch.TreatStackingAsSingleEnabled = Config.Bind("Factory", "TreatStackingAsSingle", false,
|
||||
"Treat stack items as single in monitor components");
|
||||
FactoryPatch.QuickBuildAndDismantleLabEnabled = Config.Bind("Factory", "QuickBuildAndDismantleLab", true,
|
||||
"Quick build and dismantle labs");
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible");
|
||||
PlayerPatch.HideTipsForSandsChangesEnabled = Config.Bind("Player", "HideTipsForGettingSands", false,
|
||||
"Hide tips for getting soil piles");
|
||||
|
||||
Reference in New Issue
Block a user