mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 11:42:20 +08:00
UXAssist 1.0.26
This commit is contained in:
@@ -12,7 +12,6 @@ public static class TechPatch
|
|||||||
public static ConfigEntry<bool> Enabled;
|
public static ConfigEntry<bool> Enabled;
|
||||||
private static Harmony _patch;
|
private static Harmony _patch;
|
||||||
|
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
Enabled.SettingChanged += (_, _) => ValueChanged();
|
Enabled.SettingChanged += (_, _) => ValueChanged();
|
||||||
@@ -43,12 +42,11 @@ public static class TechPatch
|
|||||||
var history = GameMain.history;
|
var history = GameMain.history;
|
||||||
var techStates = history.techStates;
|
var techStates = history.techStates;
|
||||||
var techID = techProto.ID;
|
var techID = techProto.ID;
|
||||||
if (techStates == null || !techStates.ContainsKey(techID))
|
if (techStates == null || !techStates.TryGetValue(techID, out var value))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = techStates[techID];
|
|
||||||
if (value.unlocked)
|
if (value.unlocked)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
#### 一些提升用户体验的功能和补丁
|
#### 一些提升用户体验的功能和补丁
|
||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
* 1.0.26
|
||||||
|
+ New features:
|
||||||
|
- Restore upgrades of `Sorter Cargo Stacking` on panel
|
||||||
|
- Set `Sorter Cargo Stacking` to unresearched state
|
||||||
|
+ Changes to `Protect veins from exhaustion` configuration:
|
||||||
|
- The vein amount is protected at 1000 by default now
|
||||||
|
- The maximum vein amount is changed to 10000, and the maximum oil speed is changed to 10.0/s
|
||||||
* 1.0.25
|
* 1.0.25
|
||||||
+ Fix an issue that building entites can not be clicked through when `Do not render factory entities (except belts and sorters)` is enabled
|
+ Fix an issue that building entites can not be clicked through when `Do not render factory entities (except belts and sorters)` is enabled
|
||||||
* 1.0.24
|
* 1.0.24
|
||||||
@@ -169,6 +176,9 @@
|
|||||||
- Construct only nodes but frames
|
- Construct only nodes but frames
|
||||||
- Re-initialize Dyson Spheres
|
- Re-initialize Dyson Spheres
|
||||||
- Quick dismantle Dyson Shells
|
- Quick dismantle Dyson Shells
|
||||||
|
+ Tech
|
||||||
|
- Restore upgrades of `Sorter Cargo Stacking` on panel
|
||||||
|
- Set `Sorter Cargo Stacking` to unresearched state
|
||||||
+ Combat
|
+ Combat
|
||||||
- Open Dark Fog Communicator anywhere
|
- Open Dark Fog Communicator anywhere
|
||||||
|
|
||||||
@@ -185,6 +195,13 @@
|
|||||||
* [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
|
* [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.26
|
||||||
|
+ 新功能:
|
||||||
|
- 在升级面板上恢复`分拣器货物堆叠`的升级
|
||||||
|
- 将`分拣器货物堆叠`设为未研究状态
|
||||||
|
+ `保护矿脉不会耗尽`配置的改动:
|
||||||
|
- 现在默认矿脉数量保护在1000
|
||||||
|
- 最大矿脉数量改为10000,最大采油速度改为10.0/s
|
||||||
* 1.0.25
|
* 1.0.25
|
||||||
+ 修复了`不渲染工厂建筑实体(除了传送带和分拣器)`启用时无法点穿工厂实体的问题
|
+ 修复了`不渲染工厂建筑实体(除了传送带和分拣器)`启用时无法点穿工厂实体的问题
|
||||||
* 1.0.24
|
* 1.0.24
|
||||||
@@ -352,6 +369,9 @@
|
|||||||
- 只建造节点不建造框架
|
- 只建造节点不建造框架
|
||||||
- 初始化戴森球
|
- 初始化戴森球
|
||||||
- 快速拆除戴森壳
|
- 快速拆除戴森壳
|
||||||
|
+ 科研
|
||||||
|
- 在升级面板上恢复`分拣器货物堆叠`的升级
|
||||||
|
- 将`分拣器货物堆叠`设为未研究状态
|
||||||
+ 战斗
|
+ 战斗
|
||||||
- 在任意位置打开黑雾通讯器
|
- 在任意位置打开黑雾通讯器
|
||||||
|
|
||||||
|
|||||||
109
UXAssist/TechPatch.cs
Normal file
109
UXAssist/TechPatch.cs
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using BepInEx.Configuration;
|
||||||
|
using HarmonyLib;
|
||||||
|
using UXAssist.Common;
|
||||||
|
|
||||||
|
namespace UXAssist;
|
||||||
|
|
||||||
|
public static class TechPatch
|
||||||
|
{
|
||||||
|
public static ConfigEntry<bool> SorterCargoStackingEnabled;
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
I18N.Add("分拣器运货量", "Sorter Mk.III cargo stacking : ", "极速分拣器每次可运送 ");
|
||||||
|
SorterCargoStackingEnabled.SettingChanged += (_, _) => SorterCargoStacking.Enable(SorterCargoStackingEnabled.Value);
|
||||||
|
SorterCargoStacking.Enable(SorterCargoStackingEnabled.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Uninit()
|
||||||
|
{
|
||||||
|
SorterCargoStacking.Enable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SorterCargoStacking
|
||||||
|
{
|
||||||
|
private static Harmony _patch;
|
||||||
|
private static bool _protoPatched;
|
||||||
|
|
||||||
|
public static void Enable(bool on)
|
||||||
|
{
|
||||||
|
TryPatchProto(on);
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
_patch ??= Harmony.CreateAndPatchAll(typeof(SorterCargoStacking));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_patch?.UnpatchSelf();
|
||||||
|
_patch = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void TryPatchProto(bool on)
|
||||||
|
{
|
||||||
|
var techs = LDB.techs;
|
||||||
|
if (techs == null || techs.dataArray == null || techs.dataArray.Length == 0) return;
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
var delim = -26.0f;
|
||||||
|
var tp3301 = techs.Select(3301);
|
||||||
|
if (tp3301 != null && tp3301.IsObsolete)
|
||||||
|
{
|
||||||
|
_protoPatched = false;
|
||||||
|
delim = tp3301.Position.y + 1.0f;
|
||||||
|
}
|
||||||
|
if (_protoPatched) return;
|
||||||
|
|
||||||
|
foreach (var tp in techs.dataArray)
|
||||||
|
{
|
||||||
|
switch (tp.ID)
|
||||||
|
{
|
||||||
|
case >= 3301 and <= 3305:
|
||||||
|
tp.UnlockValues[0] = tp.ID - 3300 + 1;
|
||||||
|
tp.IsObsolete = false;
|
||||||
|
continue;
|
||||||
|
case 3306:
|
||||||
|
tp.PreTechs = [];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tp.Position.y > delim) continue;
|
||||||
|
tp.Position.y -= 4.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_protoPatched = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var delim = -28.0f;
|
||||||
|
var tp3301 = techs.Select(3301);
|
||||||
|
if (tp3301 != null && !tp3301.IsObsolete)
|
||||||
|
{
|
||||||
|
_protoPatched = true;
|
||||||
|
delim = tp3301.Position.y - 1.0f;
|
||||||
|
}
|
||||||
|
if (!_protoPatched) return;
|
||||||
|
foreach (var tp in techs.dataArray)
|
||||||
|
{
|
||||||
|
if (tp.ID is >= 3301 and <= 3305)
|
||||||
|
{
|
||||||
|
tp.IsObsolete = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tp.Position.y > delim) continue;
|
||||||
|
tp.Position.y += 4.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_protoPatched = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix, HarmonyPriority(Priority.Last)]
|
||||||
|
[HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")]
|
||||||
|
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||||
|
{
|
||||||
|
TryPatchProto(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ public static class UIConfigWindow
|
|||||||
I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂");
|
I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂");
|
||||||
I18N.Add("Player/Mecha", "Player/Mecha", "玩家/机甲");
|
I18N.Add("Player/Mecha", "Player/Mecha", "玩家/机甲");
|
||||||
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
|
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
|
||||||
I18N.Add("Combat", "Combat", "战斗");
|
I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗");
|
||||||
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
|
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
|
||||||
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
|
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
|
||||||
/*
|
/*
|
||||||
@@ -64,6 +64,8 @@ public static class UIConfigWindow
|
|||||||
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("Dismantle selected layer", "Dismantle selected layer", "拆除选中的戴森壳");
|
I18N.Add("Dismantle selected layer", "Dismantle selected layer", "拆除选中的戴森壳");
|
||||||
I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?");
|
I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?");
|
||||||
|
I18N.Add("Restore upgrades of \"Sorter Cargo Stacking\" on panel", "Restore upgrades of \"Sorter Cargo Stacking\" on panel", "在升级面板上恢复\"分拣器货物叠加\"的升级");
|
||||||
|
I18N.Add("Set \"Sorter Cargo Stacking\" to unresearched state", "Set \"Sorter Cargo Stacking\" to unresearched state", "将\"分拣器货物叠加\"设为未研究状态");
|
||||||
I18N.Add("Open Dark Fog Communicator", "Open Dark Fog Communicator", "打开黑雾通讯器");
|
I18N.Add("Open Dark Fog Communicator", "Open Dark Fog Communicator", "打开黑雾通讯器");
|
||||||
I18N.Apply();
|
I18N.Apply();
|
||||||
MyConfigWindow.OnUICreated += CreateUI;
|
MyConfigWindow.OnUICreated += CreateUI;
|
||||||
@@ -237,10 +239,28 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
_dysonTab = tab4;
|
_dysonTab = tab4;
|
||||||
|
|
||||||
var tab5 = wnd.AddTab(_windowTrans, "Combat");
|
var tab5 = wnd.AddTab(_windowTrans, "Tech/Combat");
|
||||||
x = 10;
|
x = 10;
|
||||||
y = 10;
|
y = 10;
|
||||||
wnd.AddButton(x, y, tab5, "Open Dark Fog Communicator", 16, "button-open-df-communicator", () =>
|
MyCheckBox.CreateCheckBox(x, y, tab5, TechPatch.SorterCargoStackingEnabled, "Restore upgrades of \"Sorter Cargo Stacking\" on panel");
|
||||||
|
y += 36f;
|
||||||
|
wnd.AddButton(x, y, 300f, tab5, "Set \"Sorter Cargo Stacking\" to unresearched state", 16, "button-remove-cargo-stacking", () =>
|
||||||
|
{
|
||||||
|
var history = GameMain.data?.history;
|
||||||
|
if (history == null) return;
|
||||||
|
history.inserterStackCountObsolete = 1;
|
||||||
|
for (var id = 3301; id <= 3305; id++)
|
||||||
|
{
|
||||||
|
history.techStates.TryGetValue(id, out var state);
|
||||||
|
if (!state.unlocked) continue;
|
||||||
|
state.unlocked = false;
|
||||||
|
state.hashUploaded = 0;
|
||||||
|
history.techStates[id] = state;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
y += 36f;
|
||||||
|
y += 36f;
|
||||||
|
wnd.AddButton(x, y, 300f, tab5, "Open Dark Fog Communicator", 16, "button-open-df-communicator", () =>
|
||||||
{
|
{
|
||||||
if (!(GameMain.data?.gameDesc.isCombatMode ?? false)) return;
|
if (!(GameMain.data?.gameDesc.isCombatMode ?? false)) return;
|
||||||
var uiGame = UIRoot.instance.uiGame;
|
var uiGame = UIRoot.instance.uiGame;
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
"Quick build and dismantle stacking labs");
|
"Quick build and dismantle stacking labs");
|
||||||
FactoryPatch.ProtectVeinsFromExhaustionEnabled = Config.Bind("Factory", "ProtectVeinsFromExhaustion", false,
|
FactoryPatch.ProtectVeinsFromExhaustionEnabled = Config.Bind("Factory", "ProtectVeinsFromExhaustion", false,
|
||||||
"Protect veins from exhaustion");
|
"Protect veins from exhaustion");
|
||||||
FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = Config.Bind("Factory", "KeepVeinAmount", 100, new ConfigDescription("Keep veins amount (0 to disable)", new AcceptableValueRange<int>(0, 1000))).Value;
|
FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = Config.Bind("Factory", "KeepVeinAmount", 1000, new ConfigDescription("Keep veins amount (0 to disable)", new AcceptableValueRange<int>(0, 10000))).Value;
|
||||||
FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = Config.Bind("Factory", "KeepOilSpeed", 1.0f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", new AcceptableValueRange<float>(0.0f, 1.0f))).Value;
|
FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = Config.Bind("Factory", "KeepOilSpeed", 1.0f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", new AcceptableValueRange<float>(0.0f, 10.0f))).Value;
|
||||||
FactoryPatch.DoNotRenderEntitiesEnabled = Config.Bind("Factory", "DoNotRenderEntities", false,
|
FactoryPatch.DoNotRenderEntitiesEnabled = Config.Bind("Factory", "DoNotRenderEntities", false,
|
||||||
"Do not render factory entities");
|
"Do not render factory entities");
|
||||||
FactoryPatch.DragBuildPowerPolesEnabled = Config.Bind("Factory", "DragBuildPowerPoles", false,
|
FactoryPatch.DragBuildPowerPolesEnabled = Config.Bind("Factory", "DragBuildPowerPoles", false,
|
||||||
@@ -92,6 +92,8 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
PlayerPatch.AutoBoostEnabled = Config.Bind("Player", "AutoBoost", false,
|
PlayerPatch.AutoBoostEnabled = Config.Bind("Player", "AutoBoost", false,
|
||||||
"Auto boost speed with auto-cruise enabled");
|
"Auto boost speed with auto-cruise enabled");
|
||||||
PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)");
|
PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)");
|
||||||
|
TechPatch.SorterCargoStackingEnabled = Config.Bind("Tech", "SorterCargoStacking", false,
|
||||||
|
"Restore upgrades of `Sorter Cargo Stacking` on panel");
|
||||||
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
|
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
|
||||||
"Stop ejectors when available nodes are all filled up");
|
"Stop ejectors when available nodes are all filled up");
|
||||||
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
|
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
|
||||||
@@ -111,6 +113,7 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
FactoryPatch.Init();
|
FactoryPatch.Init();
|
||||||
PlanetPatch.Init();
|
PlanetPatch.Init();
|
||||||
PlayerPatch.Init();
|
PlayerPatch.Init();
|
||||||
|
TechPatch.Init();
|
||||||
DysonSpherePatch.Init();
|
DysonSpherePatch.Init();
|
||||||
|
|
||||||
I18N.Apply();
|
I18N.Apply();
|
||||||
@@ -119,6 +122,7 @@ public class UXAssist : BaseUnityPlugin
|
|||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
DysonSpherePatch.Uninit();
|
DysonSpherePatch.Uninit();
|
||||||
|
TechPatch.Uninit();
|
||||||
PlayerPatch.Uninit();
|
PlayerPatch.Uninit();
|
||||||
PlanetPatch.Uninit();
|
PlanetPatch.Uninit();
|
||||||
FactoryPatch.Uninit();
|
FactoryPatch.Uninit();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UXAssist</Description>
|
<Description>DSP MOD - UXAssist</Description>
|
||||||
<Version>1.0.25</Version>
|
<Version>1.0.26</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>UXAssist</PackageId>
|
<PackageId>UXAssist</PackageId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UXAssist",
|
"name": "UXAssist",
|
||||||
"version_number": "1.0.25",
|
"version_number": "1.0.26",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
Reference in New Issue
Block a user