mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 22:13:30 +08:00
Work in progress
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
## Changlog
|
||||
|
||||
* 1.1.5
|
||||
+ New feature: `Logistics Control Panel Improvement`
|
||||
- Auto apply filter with item under mouse cursor while opening the panel
|
||||
- Quick-set item filter while right-clicking item icons in storage list on the panel
|
||||
+ `Quick build and dismantle stacking labs`: works for storages and tanks now
|
||||
+ `Enable game window resize`: Keep window resizable on applying game options.
|
||||
+ `Remember window position and size on last exit`: Do not resize window on applying game options if resolution related config entries are not changed.
|
||||
+ Auto resize panel to fit content, for better support of multilanguages and mods dependent on UX Assist config panel functions.
|
||||
+ Fix a crash when config panel is opened before game is fully loaded
|
||||
* 1.1.4
|
||||
+ Fix `Remove some build conditions`
|
||||
@@ -76,7 +81,7 @@
|
||||
+ Auto-cruise does not bypass dark-fog hives if they are targeted.
|
||||
* 1.0.17
|
||||
+ 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 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 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
|
||||
@@ -124,15 +129,15 @@
|
||||
+ Sort blueprint structures before saving, to reduce generated blueprint data size a little.
|
||||
* 1.0.4
|
||||
+ Add new function: `Off-grid building and stepped rotation`
|
||||
+ Fix an issue that window position not restored and can not be resized when function is enabled but game is started with different mod profiles.
|
||||
+ Fix an issue that window position not restored and can not be resized when function is enabled but game is started with different mod profiles.
|
||||
* 1.0.3
|
||||
+ Add new function: `Quick build Orbital Collectors`.
|
||||
+ Add new function: `Quick build Orbital Collectors`.
|
||||
+ Add confirmation popup for `Re-intialize planet`, `Quick dismantle all buildings`, `Re-initialize Dyson Spheres` and `Quick dismantle Dyson Shells`.
|
||||
+ Fix error on `Remove build count and range limit` when building a large amount of belts.
|
||||
+ Fix an issue that window position not saved correctly when quit game without using in-game menu.
|
||||
* 1.0.2
|
||||
+ Redesign config tabs, for clearer layout.
|
||||
+ Add 2 new options:
|
||||
+ Add 2 new options:
|
||||
- Enable game window resize.
|
||||
- Remember window position and size on last exit.
|
||||
* 1.0.1
|
||||
@@ -143,12 +148,16 @@
|
||||
+ Initial release
|
||||
+ Functions moved from [MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/) and [CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)
|
||||
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 1.1.5
|
||||
+ 新功能:`物流控制面板改进`
|
||||
- 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
- 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
|
||||
+ `快速建造和拆除堆叠研究站`:现在也支持储物仓和储液罐
|
||||
+ `允许调整游戏窗口大小`:在应用游戏选项时保持窗口可调整大小
|
||||
+ `记住上次退出时的窗口位置和大小`:如果分辨率相关的配置项未改变,则在应用游戏选项时不调整窗口大小
|
||||
+ 自动调整面板大小适应内容,以更好地支持多语言和依赖于UX助手配置面板功能的mod
|
||||
+ 修复了在游戏完全加载前打开配置面板可能导致的崩溃问题
|
||||
* 1.1.4
|
||||
+ 修复了`移除部分不影响游戏逻辑的建造条件`
|
||||
@@ -256,7 +265,7 @@
|
||||
+ 修复了`物流塔存储数量限制控制改进`启用时可能导致的崩溃问题
|
||||
* 1.0.9
|
||||
+ 新功能:`更好的自动保存机制`
|
||||
- 自动存档会以星区地址和日期时间组合为文件名存储在'Save\AutoSaves'文件夹中
|
||||
- 自动存档会以星区地址和日期时间组合为文件名存储在'Save\AutoSaves'文件夹中
|
||||
- 注意:此功能会在保存/读取菜单按最后修改时间对存档进行排序,因此你不再需要[DSP_Save_Game_Sorter]了
|
||||
* 1.0.8
|
||||
+ 新功能:`物流塔存储数量限制控制改进`
|
||||
|
||||
@@ -10,6 +10,7 @@ public static class DysonSpherePatch
|
||||
{
|
||||
public static ConfigEntry<bool> StopEjectOnNodeCompleteEnabled;
|
||||
public static ConfigEntry<bool> OnlyConstructNodesEnabled;
|
||||
public static ConfigEntry<int> AutoConstructMultiplier;
|
||||
private static Harmony _dysonSpherePatch;
|
||||
|
||||
public static void Init()
|
||||
@@ -57,6 +58,165 @@ public static class DysonSpherePatch
|
||||
}
|
||||
ds.RemoveLayer(index);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.AutoConstruct))]
|
||||
private static bool DysonSphere_AutoConstruct_Prefix(DysonSphere __instance)
|
||||
{
|
||||
var totalCount = AutoConstructMultiplier.Value * 6;
|
||||
var totalCount2 = AutoConstructMultiplier.Value * 6;
|
||||
foreach (var dysonSphereLayer in __instance.layersIdBased)
|
||||
{
|
||||
if (dysonSphereLayer == null) continue;
|
||||
int todoCount;
|
||||
int[] productRegister;
|
||||
for (var j = dysonSphereLayer.nodePool.Length - 1; j >= 0; j--)
|
||||
{
|
||||
var dysonNode = dysonSphereLayer.nodePool[j];
|
||||
if (dysonNode == null || dysonNode.id != j) continue;
|
||||
var count = dysonNode._spReq - dysonNode.spOrdered;
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
if (count > totalCount)
|
||||
{
|
||||
count = totalCount;
|
||||
dysonNode.spOrdered += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
dysonNode.spOrdered = dysonNode._spReq;
|
||||
__instance.RemoveAutoNode(dysonNode);
|
||||
__instance.PickAutoNode();
|
||||
}
|
||||
|
||||
todoCount = count;
|
||||
if (dysonNode.sp < dysonNode.spMax)
|
||||
{
|
||||
if (dysonNode.sp + count > dysonNode.spMax)
|
||||
{
|
||||
var diff = dysonNode.spMax - dysonNode.sp;
|
||||
count -= diff;
|
||||
dysonNode.spOrdered -= diff;
|
||||
dysonNode._spReq -= diff;
|
||||
|
||||
dysonNode.sp = dysonNode.spMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
dysonNode.spOrdered -= count;
|
||||
dysonNode._spReq -= count;
|
||||
|
||||
dysonNode.sp += count;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
__instance.UpdateProgress(dysonNode);
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
var frameCount = dysonNode.frames.Count;
|
||||
var frameIndex = dysonNode.frameTurn % frameCount;
|
||||
for (var i = frameCount; i > 0; i--)
|
||||
{
|
||||
var dysonFrame = dysonNode.frames[frameIndex];
|
||||
var spMax = dysonFrame.spMax >> 1;
|
||||
if (dysonFrame.nodeA == dysonNode && dysonFrame.spA < spMax)
|
||||
{
|
||||
if (dysonFrame.spA + count > spMax)
|
||||
{
|
||||
var diff = spMax - dysonFrame.spA;
|
||||
count -= diff;
|
||||
dysonNode.spOrdered -= diff;
|
||||
dysonNode._spReq -= diff;
|
||||
|
||||
dysonFrame.spA = spMax;
|
||||
__instance.UpdateProgress(dysonFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
dysonNode.spOrdered -= count;
|
||||
dysonNode._spReq -= count;
|
||||
|
||||
dysonFrame.spA += count;
|
||||
count = 0;
|
||||
__instance.UpdateProgress(dysonFrame);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dysonFrame.nodeB == dysonNode && dysonFrame.spB < spMax)
|
||||
{
|
||||
if (dysonFrame.spB + count > spMax)
|
||||
{
|
||||
var diff = spMax - dysonFrame.spB;
|
||||
count -= diff;
|
||||
dysonNode.spOrdered -= diff;
|
||||
dysonNode._spReq -= diff;
|
||||
|
||||
dysonFrame.spB = spMax;
|
||||
__instance.UpdateProgress(dysonFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
dysonNode.spOrdered -= count;
|
||||
dysonNode._spReq -= count;
|
||||
|
||||
dysonFrame.spB += count;
|
||||
count = 0;
|
||||
__instance.UpdateProgress(dysonFrame);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
frameIndex = (frameIndex + 1) % frameCount;
|
||||
}
|
||||
}
|
||||
|
||||
productRegister = __instance.productRegister;
|
||||
if (productRegister != null)
|
||||
{
|
||||
lock (productRegister)
|
||||
{
|
||||
productRegister[11902] += todoCount - count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count = dysonNode._cpReq - dysonNode.cpOrdered;
|
||||
if (count > totalCount2) count = totalCount2;
|
||||
todoCount = count;
|
||||
dysonNode.cpOrdered += count;
|
||||
var shellCount = dysonNode.shells.Count;
|
||||
var shellIndex = dysonNode.shellTurn % shellCount;
|
||||
for (var i = shellCount; i > 0 && count > 0; i--)
|
||||
{
|
||||
var dysonShell = dysonNode.shells[shellIndex];
|
||||
var nodeIndex = dysonShell.nodeIndexMap[dysonNode.id];
|
||||
var diff = (dysonShell.vertsqOffset[nodeIndex + 1] - dysonShell.vertsqOffset[nodeIndex]) * dysonShell.cpPerVertex - dysonShell.nodecps[nodeIndex];
|
||||
if (diff > count)
|
||||
diff = count;
|
||||
count -= diff;
|
||||
dysonNode.cpOrdered -= diff;
|
||||
dysonNode._cpReq -= diff;
|
||||
dysonShell.nodecps[nodeIndex] += diff;
|
||||
dysonShell.nodecps[dysonShell.nodecps.Length - 1] += diff;
|
||||
shellIndex = (shellIndex + 1) % shellCount;
|
||||
}
|
||||
productRegister = __instance.productRegister;
|
||||
if (productRegister != null)
|
||||
{
|
||||
lock (productRegister)
|
||||
{
|
||||
productRegister[11903] += todoCount - count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
@@ -174,7 +334,7 @@ public static class DysonSpherePatch
|
||||
private static bool AnyNodeForAbsorb(int starIndex)
|
||||
{
|
||||
var comp = _nodeForAbsorb[starIndex];
|
||||
return comp != null && comp.Count > 0;
|
||||
return comp is { Count: > 0 };
|
||||
}
|
||||
|
||||
private static void GameMain_Begin_Postfix()
|
||||
|
||||
@@ -22,13 +22,11 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> LargerAreaForUpgradeAndDismantleEnabled;
|
||||
public static ConfigEntry<bool> LargerAreaForTerraformEnabled;
|
||||
public static ConfigEntry<bool> OffGridBuildingEnabled;
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> TreatStackingAsSingleEnabled;
|
||||
public static ConfigEntry<bool> QuickBuildAndDismantleLabsEnabled;
|
||||
public static ConfigEntry<bool> ProtectVeinsFromExhaustionEnabled;
|
||||
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
|
||||
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
|
||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> BeltSignalsForBuyOutEnabled;
|
||||
private static PressKeyBind _doNotRenderEntitiesKey;
|
||||
|
||||
@@ -54,14 +52,11 @@ public static class FactoryPatch
|
||||
LargerAreaForUpgradeAndDismantleEnabled.SettingChanged += (_, _) => LargerAreaForUpgradeAndDismantle.Enable(LargerAreaForUpgradeAndDismantleEnabled.Value);
|
||||
LargerAreaForTerraformEnabled.SettingChanged += (_, _) => LargerAreaForTerraform.Enable(LargerAreaForTerraformEnabled.Value);
|
||||
OffGridBuildingEnabled.SettingChanged += (_, _) => OffGridBuilding.Enable(OffGridBuildingEnabled.Value);
|
||||
LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
TreatStackingAsSingleEnabled.SettingChanged += (_, _) => TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
|
||||
QuickBuildAndDismantleLabsEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
|
||||
ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
|
||||
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
BeltSignalsForBuyOutEnabled.SettingChanged += (_, _) => BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
|
||||
UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value);
|
||||
RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value);
|
||||
@@ -70,14 +65,11 @@ public static class FactoryPatch
|
||||
LargerAreaForUpgradeAndDismantle.Enable(LargerAreaForUpgradeAndDismantleEnabled.Value);
|
||||
LargerAreaForTerraform.Enable(LargerAreaForTerraformEnabled.Value);
|
||||
OffGridBuilding.Enable(OffGridBuildingEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value);
|
||||
QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
|
||||
ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
|
||||
DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
|
||||
|
||||
_factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||
@@ -92,14 +84,11 @@ public static class FactoryPatch
|
||||
LargerAreaForUpgradeAndDismantle.Enable(false);
|
||||
LargerAreaForTerraform.Enable(false);
|
||||
OffGridBuilding.Enable(false);
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
TreatStackingAsSingle.Enable(false);
|
||||
QuickBuildAndDismantleLab.Enable(false);
|
||||
ProtectVeinsFromExhaustion.Enable(false);
|
||||
DoNotRenderEntities.Enable(false);
|
||||
DragBuildPowerPoles.Enable(false);
|
||||
AllowOverflowInLogistics.Enable(false);
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
BeltSignalsForBuyOut.Enable(false);
|
||||
BeltSignalsForBuyOut.UninitPersist();
|
||||
|
||||
@@ -872,209 +861,7 @@ public static class FactoryPatch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LogisticsCapacityTweaks
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(LogisticsCapacityTweaks));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
private static KeyCode _lastKey = KeyCode.None;
|
||||
private static long _nextKeyTick;
|
||||
private static bool _skipNextEvent;
|
||||
|
||||
private static bool UpdateKeyPressed(KeyCode code)
|
||||
{
|
||||
if (!Input.GetKey(code))
|
||||
return false;
|
||||
if (code != _lastKey)
|
||||
{
|
||||
_lastKey = code;
|
||||
_nextKeyTick = GameMain.instance.timei + 30;
|
||||
return true;
|
||||
}
|
||||
|
||||
var currTick = GameMain.instance.timei;
|
||||
if (_nextKeyTick > currTick) return false;
|
||||
_nextKeyTick = currTick + 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void UpdateInput()
|
||||
{
|
||||
if (_lastKey != KeyCode.None && Input.GetKeyUp(_lastKey))
|
||||
{
|
||||
_lastKey = KeyCode.None;
|
||||
}
|
||||
|
||||
if (VFInput.shift) return;
|
||||
var ctrl = VFInput.control;
|
||||
var alt = VFInput.alt;
|
||||
if (ctrl && alt) return;
|
||||
int delta;
|
||||
if (UpdateKeyPressed(KeyCode.LeftArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = -100000;
|
||||
else if (alt)
|
||||
delta = -1000;
|
||||
else
|
||||
delta = -10;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.RightArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = 100000;
|
||||
else if (alt)
|
||||
delta = 1000;
|
||||
else
|
||||
delta = 10;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.DownArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = -1000000;
|
||||
else if (alt)
|
||||
delta = -10000;
|
||||
else
|
||||
delta = -100;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.UpArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = 1000000;
|
||||
else if (alt)
|
||||
delta = 10000;
|
||||
else
|
||||
delta = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var targets = new List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(new PointerEventData(EventSystem.current) { position = Input.mousePosition }, targets);
|
||||
foreach (var target in targets)
|
||||
{
|
||||
var stationStorage = target.gameObject.GetComponentInParent<UIStationStorage>();
|
||||
if (stationStorage is null) continue;
|
||||
var station = stationStorage.station;
|
||||
ref var storage = ref station.storage[stationStorage.index];
|
||||
var oldMax = storage.max;
|
||||
var newMax = oldMax + delta;
|
||||
if (newMax < 0)
|
||||
{
|
||||
newMax = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int itemCountMax;
|
||||
if (AllowOverflowInLogisticsEnabled.Value)
|
||||
{
|
||||
itemCountMax = 90000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
var modelProto = LDB.models.Select(stationStorage.stationWindow.factory.entityPool[station.entityId].modelIndex);
|
||||
itemCountMax = 0;
|
||||
if (modelProto != null)
|
||||
{
|
||||
itemCountMax = modelProto.prefabDesc.stationMaxItemCount;
|
||||
}
|
||||
|
||||
itemCountMax += station.isStellar ? GameMain.history.remoteStationExtraStorage : GameMain.history.localStationExtraStorage;
|
||||
}
|
||||
|
||||
if (newMax > itemCountMax)
|
||||
{
|
||||
newMax = itemCountMax;
|
||||
}
|
||||
}
|
||||
|
||||
storage.max = newMax;
|
||||
_skipNextEvent = oldMax / 100 != newMax / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnMaxSliderValueChange))]
|
||||
private static bool UIStationStorage_OnMaxSliderValueChange_Prefix()
|
||||
{
|
||||
if (!_skipNextEvent) return true;
|
||||
_skipNextEvent = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.OnTechFunctionUnlocked))]
|
||||
private static bool PlanetTransport_OnTechFunctionUnlocked_Prefix(PlanetTransport __instance, int _funcId, double _valuelf, int _level)
|
||||
{
|
||||
switch (_funcId)
|
||||
{
|
||||
case 30:
|
||||
{
|
||||
var stationPool = __instance.stationPool;
|
||||
var factory = __instance.factory;
|
||||
var history = GameMain.history;
|
||||
for (var i = __instance.stationCursor - 1; i > 0; i--)
|
||||
{
|
||||
if (stationPool[i] == null || stationPool[i].id != i || (stationPool[i].isStellar && !stationPool[i].isCollector && !stationPool[i].isVeinCollector)) continue;
|
||||
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;
|
||||
var maxCount = LDB.models.Select(modelIndex).prefabDesc.stationMaxItemCount;
|
||||
var oldMaxCount = maxCount + history.localStationExtraStorage - _valuelf;
|
||||
var intOldMaxCount = (int)Math.Round(oldMaxCount);
|
||||
var ratio = (maxCount + history.localStationExtraStorage) / oldMaxCount;
|
||||
var storage = stationPool[i].storage;
|
||||
for (var j = storage.Length - 1; j >= 0; j--)
|
||||
{
|
||||
if (storage[j].max + 10 < intOldMaxCount) continue;
|
||||
storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 50.0)) * 50;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 31:
|
||||
{
|
||||
var stationPool = __instance.stationPool;
|
||||
var factory = __instance.factory;
|
||||
var history = GameMain.history;
|
||||
for (var i = __instance.stationCursor - 1; i > 0; i--)
|
||||
{
|
||||
if (stationPool[i] == null || stationPool[i].id != i || !stationPool[i].isStellar || stationPool[i].isCollector || stationPool[i].isVeinCollector) continue;
|
||||
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;
|
||||
var maxCount = LDB.models.Select(modelIndex).prefabDesc.stationMaxItemCount;
|
||||
var oldMaxCount = maxCount + history.remoteStationExtraStorage - _valuelf;
|
||||
var intOldMaxCount = (int)Math.Round(oldMaxCount);
|
||||
var ratio = (maxCount + history.remoteStationExtraStorage) / oldMaxCount;
|
||||
var storage = stationPool[i].storage;
|
||||
for (var j = storage.Length - 1; j >= 0; j--)
|
||||
{
|
||||
if (storage[j].max + 10 < intOldMaxCount) continue;
|
||||
storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 100.0)) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TreatStackingAsSingle
|
||||
{
|
||||
private static Harmony _patch;
|
||||
@@ -1807,72 +1594,6 @@ public static class FactoryPatch
|
||||
}
|
||||
}
|
||||
|
||||
private static class AllowOverflowInLogistics
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(AllowOverflowInLogistics));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
// Do not check for overflow when try to send hand items into storages
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
|
||||
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(LDB), nameof(LDB.items))),
|
||||
new CodeMatch(OpCodes.Ldarg_0)
|
||||
);
|
||||
var pos = matcher.Pos;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S)
|
||||
);
|
||||
var inst = matcher.InstructionAt(1).Clone();
|
||||
var pos2 = matcher.Pos + 2;
|
||||
matcher.Start().Advance(pos);
|
||||
var labels = matcher.Labels;
|
||||
matcher.RemoveInstructions(pos2 - pos).Insert(
|
||||
new CodeInstruction(OpCodes.Ldloc_1).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.inhandItemCount))),
|
||||
inst
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
// Remove storage limit check
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.SetStationStorage))]
|
||||
private static IEnumerable<CodeInstruction> PlanetTransport_SetStationStorage_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(ci => ci.IsLdarg()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Add),
|
||||
new CodeMatch(ci => ci.Branches(out _)),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Add),
|
||||
new CodeMatch(ci => ci.IsStarg())
|
||||
);
|
||||
var labels = matcher.Labels;
|
||||
matcher.RemoveInstructions(9).Labels.AddRange(labels);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private static class BeltSignalsForBuyOut
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
454
UXAssist/LogisticsPatch.cs
Normal file
454
UXAssist/LogisticsPatch.cs
Normal file
@@ -0,0 +1,454 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
public static class LogisticsPatch
|
||||
{
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> LogisticsConstrolPanelImprovementEnabled;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsConstrolPanelImprovementEnabled.SettingChanged += (_, _) => LogisticsConstrolPanelImprovement.Enable(LogisticsConstrolPanelImprovementEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsConstrolPanelImprovement.Enable(LogisticsConstrolPanelImprovementEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
AllowOverflowInLogistics.Enable(false);
|
||||
LogisticsConstrolPanelImprovement.Enable(false);
|
||||
}
|
||||
|
||||
public static class LogisticsCapacityTweaks
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(LogisticsCapacityTweaks));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
private static KeyCode _lastKey = KeyCode.None;
|
||||
private static long _nextKeyTick;
|
||||
private static bool _skipNextEvent;
|
||||
|
||||
private static bool UpdateKeyPressed(KeyCode code)
|
||||
{
|
||||
if (!Input.GetKey(code))
|
||||
return false;
|
||||
if (code != _lastKey)
|
||||
{
|
||||
_lastKey = code;
|
||||
_nextKeyTick = GameMain.instance.timei + 30;
|
||||
return true;
|
||||
}
|
||||
|
||||
var currTick = GameMain.instance.timei;
|
||||
if (_nextKeyTick > currTick) return false;
|
||||
_nextKeyTick = currTick + 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void UpdateInput()
|
||||
{
|
||||
if (_lastKey != KeyCode.None && Input.GetKeyUp(_lastKey))
|
||||
{
|
||||
_lastKey = KeyCode.None;
|
||||
}
|
||||
|
||||
if (VFInput.shift) return;
|
||||
var ctrl = VFInput.control;
|
||||
var alt = VFInput.alt;
|
||||
if (ctrl && alt) return;
|
||||
int delta;
|
||||
if (UpdateKeyPressed(KeyCode.LeftArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = -100000;
|
||||
else if (alt)
|
||||
delta = -1000;
|
||||
else
|
||||
delta = -10;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.RightArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = 100000;
|
||||
else if (alt)
|
||||
delta = 1000;
|
||||
else
|
||||
delta = 10;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.DownArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = -1000000;
|
||||
else if (alt)
|
||||
delta = -10000;
|
||||
else
|
||||
delta = -100;
|
||||
}
|
||||
else if (UpdateKeyPressed(KeyCode.UpArrow))
|
||||
{
|
||||
if (ctrl)
|
||||
delta = 1000000;
|
||||
else if (alt)
|
||||
delta = 10000;
|
||||
else
|
||||
delta = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var targets = new List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(new PointerEventData(EventSystem.current) { position = Input.mousePosition }, targets);
|
||||
foreach (var target in targets)
|
||||
{
|
||||
var stationStorage = target.gameObject.GetComponentInParent<UIStationStorage>();
|
||||
if (stationStorage is null) continue;
|
||||
var station = stationStorage.station;
|
||||
ref var storage = ref station.storage[stationStorage.index];
|
||||
var oldMax = storage.max;
|
||||
var newMax = oldMax + delta;
|
||||
if (newMax < 0)
|
||||
{
|
||||
newMax = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int itemCountMax;
|
||||
if (AllowOverflowInLogisticsEnabled.Value)
|
||||
{
|
||||
itemCountMax = 90000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
var modelProto = LDB.models.Select(stationStorage.stationWindow.factory.entityPool[station.entityId].modelIndex);
|
||||
itemCountMax = 0;
|
||||
if (modelProto != null)
|
||||
{
|
||||
itemCountMax = modelProto.prefabDesc.stationMaxItemCount;
|
||||
}
|
||||
|
||||
itemCountMax += station.isStellar ? GameMain.history.remoteStationExtraStorage : GameMain.history.localStationExtraStorage;
|
||||
}
|
||||
|
||||
if (newMax > itemCountMax)
|
||||
{
|
||||
newMax = itemCountMax;
|
||||
}
|
||||
}
|
||||
|
||||
storage.max = newMax;
|
||||
_skipNextEvent = oldMax / 100 != newMax / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnMaxSliderValueChange))]
|
||||
private static bool UIStationStorage_OnMaxSliderValueChange_Prefix()
|
||||
{
|
||||
if (!_skipNextEvent) return true;
|
||||
_skipNextEvent = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.OnTechFunctionUnlocked))]
|
||||
private static bool PlanetTransport_OnTechFunctionUnlocked_Prefix(PlanetTransport __instance, int _funcId, double _valuelf, int _level)
|
||||
{
|
||||
switch (_funcId)
|
||||
{
|
||||
case 30:
|
||||
{
|
||||
var stationPool = __instance.stationPool;
|
||||
var factory = __instance.factory;
|
||||
var history = GameMain.history;
|
||||
for (var i = __instance.stationCursor - 1; i > 0; i--)
|
||||
{
|
||||
if (stationPool[i] == null || stationPool[i].id != i || (stationPool[i].isStellar && !stationPool[i].isCollector && !stationPool[i].isVeinCollector)) continue;
|
||||
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;
|
||||
var maxCount = LDB.models.Select(modelIndex).prefabDesc.stationMaxItemCount;
|
||||
var oldMaxCount = maxCount + history.localStationExtraStorage - _valuelf;
|
||||
var intOldMaxCount = (int)Math.Round(oldMaxCount);
|
||||
var ratio = (maxCount + history.localStationExtraStorage) / oldMaxCount;
|
||||
var storage = stationPool[i].storage;
|
||||
for (var j = storage.Length - 1; j >= 0; j--)
|
||||
{
|
||||
if (storage[j].max + 10 < intOldMaxCount) continue;
|
||||
storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 50.0)) * 50;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 31:
|
||||
{
|
||||
var stationPool = __instance.stationPool;
|
||||
var factory = __instance.factory;
|
||||
var history = GameMain.history;
|
||||
for (var i = __instance.stationCursor - 1; i > 0; i--)
|
||||
{
|
||||
if (stationPool[i] == null || stationPool[i].id != i || !stationPool[i].isStellar || stationPool[i].isCollector || stationPool[i].isVeinCollector) continue;
|
||||
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;
|
||||
var maxCount = LDB.models.Select(modelIndex).prefabDesc.stationMaxItemCount;
|
||||
var oldMaxCount = maxCount + history.remoteStationExtraStorage - _valuelf;
|
||||
var intOldMaxCount = (int)Math.Round(oldMaxCount);
|
||||
var ratio = (maxCount + history.remoteStationExtraStorage) / oldMaxCount;
|
||||
var storage = stationPool[i].storage;
|
||||
for (var j = storage.Length - 1; j >= 0; j--)
|
||||
{
|
||||
if (storage[j].max + 10 < intOldMaxCount) continue;
|
||||
storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 100.0)) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class AllowOverflowInLogistics
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(AllowOverflowInLogistics));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
// Do not check for overflow when try to send hand items into storages
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
|
||||
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(LDB), nameof(LDB.items))),
|
||||
new CodeMatch(OpCodes.Ldarg_0)
|
||||
);
|
||||
var pos = matcher.Pos;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S)
|
||||
);
|
||||
var inst = matcher.InstructionAt(1).Clone();
|
||||
var pos2 = matcher.Pos + 2;
|
||||
matcher.Start().Advance(pos);
|
||||
var labels = matcher.Labels;
|
||||
matcher.RemoveInstructions(pos2 - pos).Insert(
|
||||
new CodeInstruction(OpCodes.Ldloc_1).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.inhandItemCount))),
|
||||
inst
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
// Remove storage limit check
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.SetStationStorage))]
|
||||
private static IEnumerable<CodeInstruction> PlanetTransport_SetStationStorage_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(ci => ci.IsLdarg()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Add),
|
||||
new CodeMatch(ci => ci.Branches(out _)),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Add),
|
||||
new CodeMatch(ci => ci.IsStarg())
|
||||
);
|
||||
var labels = matcher.Labels;
|
||||
matcher.RemoveInstructions(9).Labels.AddRange(labels);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private static class LogisticsConstrolPanelImprovement
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(LogisticsConstrolPanelImprovement));
|
||||
return;
|
||||
}
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
private static int ItemIdHintUnderMouse()
|
||||
{
|
||||
List<RaycastResult> targets = [];
|
||||
var pointer = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
position = Input.mousePosition
|
||||
};
|
||||
EventSystem.current.RaycastAll(pointer, targets);
|
||||
foreach (var target in targets)
|
||||
{
|
||||
var btn = target.gameObject.GetComponentInParent<UIButton>();
|
||||
if (btn?.tips is { itemId: > 0 })
|
||||
{
|
||||
return btn.tips.itemId;
|
||||
}
|
||||
|
||||
var repWin = target.gameObject.GetComponentInParent<UIReplicatorWindow>();
|
||||
if (repWin != null)
|
||||
{
|
||||
var mouseRecipeIndex = repWin.mouseRecipeIndex;
|
||||
var recipeProtoArray = repWin.recipeProtoArray;
|
||||
if (mouseRecipeIndex < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var recipeProto = recipeProtoArray[mouseRecipeIndex];
|
||||
return recipeProto != null ? recipeProto.Results[0] : 0;
|
||||
}
|
||||
|
||||
var grid = target.gameObject.GetComponentInParent<UIStorageGrid>();
|
||||
if (grid != null)
|
||||
{
|
||||
var storage = grid.storage;
|
||||
if (storage == null) return 0;
|
||||
var mouseOnX = grid.mouseOnX;
|
||||
var mouseOnY = grid.mouseOnY;
|
||||
if (mouseOnX < 0 || mouseOnY < 0) return 0;
|
||||
var gridIndex = mouseOnX + mouseOnY * grid.colCount;
|
||||
return storage.grids[gridIndex].itemId;
|
||||
}
|
||||
|
||||
var productEntry = target.gameObject.GetComponentInParent<UIProductEntry>();
|
||||
if (productEntry == null) continue;
|
||||
if (!productEntry.productionStatWindow.isProductionTab) return 0;
|
||||
return productEntry.entryData?.itemId ?? 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static bool SetFilterItemId(UIControlPanelFilterPanel filterPanel, int itemId)
|
||||
{
|
||||
var filter = filterPanel.GetCurrentFilter();
|
||||
if (filter.itemsFilter is { Length: 1 } && filter.itemsFilter[0] == itemId) return false;
|
||||
filter.itemsFilter = [itemId];
|
||||
filterPanel.SetNewFilter(filter);
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIGame), nameof(UIGame.On_I_Switch))]
|
||||
private static IEnumerable<CodeInstruction> UIGame_On_I_Switch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.End().MatchBack(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(UIGame), nameof(UIGame.ShutAllFunctionWindow)))
|
||||
);
|
||||
if (matcher.IsInvalid)
|
||||
{
|
||||
UXAssist.Logger.LogWarning("Failed to patch UIGame.On_I_Switch()");
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
Transpilers.EmitDelegate((UIGame uiGame) =>
|
||||
{
|
||||
var itemId = ItemIdHintUnderMouse();
|
||||
if (itemId <= 0) return;
|
||||
SetFilterItemId(uiGame.controlPanelWindow.filterPanel, itemId);
|
||||
})
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
private static void OnStationEntryItemIconRightClick(UIControlPanelStationEntry stationEntry, int slot)
|
||||
{
|
||||
var storage = stationEntry.station?.storage;
|
||||
if (storage == null) return;
|
||||
var itemId = storage.Length > slot ? storage[slot].itemId : 0;
|
||||
var controlPanelWindow = UIRoot.instance?.uiGame?.controlPanelWindow;
|
||||
if (controlPanelWindow == null) return;
|
||||
var filterPanel = controlPanelWindow.filterPanel;
|
||||
if (filterPanel == null) return;
|
||||
if (!SetFilterItemId(filterPanel, itemId)) return;
|
||||
filterPanel.RefreshFilterUI();
|
||||
controlPanelWindow.DetermineFilterResults();
|
||||
}
|
||||
|
||||
private static Action<int>[] _onStationEntryItemIconRightClickActions = new Action<int>[5];
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationEntry), nameof(UIControlPanelStationEntry._OnRegEvent))]
|
||||
private static void UIControlPanelStationEntry__OnRegEvent_Postfix(UIControlPanelStationEntry __instance)
|
||||
{
|
||||
_onStationEntryItemIconRightClickActions[0] = _ => OnStationEntryItemIconRightClick(__instance, 0);
|
||||
_onStationEntryItemIconRightClickActions[1] = _ => OnStationEntryItemIconRightClick(__instance, 1);
|
||||
_onStationEntryItemIconRightClickActions[2] = _ => OnStationEntryItemIconRightClick(__instance, 2);
|
||||
_onStationEntryItemIconRightClickActions[3] = _ => OnStationEntryItemIconRightClick(__instance, 3);
|
||||
_onStationEntryItemIconRightClickActions[4] = _ => OnStationEntryItemIconRightClick(__instance, 4);
|
||||
__instance.storageItem0.itemButton.onRightClick += _onStationEntryItemIconRightClickActions[0];
|
||||
__instance.storageItem1.itemButton.onRightClick += _onStationEntryItemIconRightClickActions[1];
|
||||
__instance.storageItem2.itemButton.onRightClick += _onStationEntryItemIconRightClickActions[2];
|
||||
__instance.storageItem3.itemButton.onRightClick += _onStationEntryItemIconRightClickActions[3];
|
||||
__instance.storageItem4.itemButton.onRightClick += _onStationEntryItemIconRightClickActions[4];
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationEntry), nameof(UIControlPanelStationEntry._OnUnregEvent))]
|
||||
private static void UIControlPanelStationEntry__OnUnregEvent_Postfix(UIControlPanelStationEntry __instance)
|
||||
{
|
||||
__instance.storageItem0.itemButton.onRightClick -= _onStationEntryItemIconRightClickActions[0];
|
||||
__instance.storageItem1.itemButton.onRightClick -= _onStationEntryItemIconRightClickActions[1];
|
||||
__instance.storageItem2.itemButton.onRightClick -= _onStationEntryItemIconRightClickActions[2];
|
||||
__instance.storageItem3.itemButton.onRightClick -= _onStationEntryItemIconRightClickActions[3];
|
||||
__instance.storageItem4.itemButton.onRightClick -= _onStationEntryItemIconRightClickActions[4];
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
_onStationEntryItemIconRightClickActions[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
# UXAssist
|
||||
|
||||
#### Some functions and patches for better user experience
|
||||
|
||||
#### 一些提升用户体验的功能和补丁
|
||||
|
||||
## Usage
|
||||
@@ -16,7 +17,7 @@
|
||||
+ Enable `Hide UI` function(`F11` by default) while on Star Map view
|
||||
+ Append mod profile name to game window title, if using mod managers (`Thunderstore Mod Manager` or `r2modman`).
|
||||
* Features:
|
||||
+ General
|
||||
+ General
|
||||
- Enable game window resize
|
||||
- Remember window position and size on last exit
|
||||
- Convert Peace-Mode saves to Combat-Mode on loading
|
||||
@@ -42,6 +43,9 @@
|
||||
- Allow overflow when trying to insert in-hand items
|
||||
- Allow `Enhanced control for logistic storage limits` to exceed tech capacity limits
|
||||
- Remove logistic strorage limit check on loading game
|
||||
- Logistics Control Panel Improvement
|
||||
- Auto apply filter with item under mouse cursor while opening the panel
|
||||
- Quick-set item filter while right-clicking item icons in storage list on the panel
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
- Quick build Orbital Collectors
|
||||
@@ -81,18 +85,19 @@
|
||||
- Open Dark Fog Communicator anywhere
|
||||
|
||||
## Notes
|
||||
|
||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||
+ You can download `BepInEx` [here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||
+ If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||
|
||||
## CREDITS
|
||||
|
||||
* [Dyson Sphere Program](https://store.steampowered.com/app/1366540): The great game
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
|
||||
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation 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
|
||||
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 按 `` Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。
|
||||
@@ -133,6 +138,9 @@
|
||||
- 当尝试塞入手中物品时允许溢出
|
||||
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
|
||||
- 在加载游戏时移除物流塔容量限制检查
|
||||
- 物流控制面板改进
|
||||
- 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
- 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
- 快速建造轨道采集器
|
||||
@@ -173,11 +181,13 @@
|
||||
- 在任意位置打开黑雾通讯器
|
||||
|
||||
## 注意事项
|
||||
|
||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。
|
||||
+ 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`。
|
||||
+ 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件。
|
||||
|
||||
## 鸣谢
|
||||
|
||||
* [戴森球计划](https://store.steampowered.com/app/1366540): 伟大的游戏
|
||||
* [BepInEx](https://bepinex.dev/): 基础模组框架
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI实现
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
cb.labelText.fontSize = fontSize;
|
||||
cb.SetLabelText(label);
|
||||
var width = cb.labelText.preferredWidth;
|
||||
cb.labelText.rectTransform.sizeDelta = new Vector2(width, rect.sizeDelta.y);
|
||||
cb.labelText.rectTransform.sizeDelta = new Vector2(width, cb.labelText.rectTransform.sizeDelta.y);
|
||||
}
|
||||
|
||||
//value
|
||||
@@ -86,4 +86,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
checkImage.enabled = _checked;
|
||||
OnChecked?.Invoke();
|
||||
}
|
||||
|
||||
public float Width => rectTrans.sizeDelta.x + labelText.rectTransform.sizeDelta.x;
|
||||
public float Height => Math.Max(rectTrans.sizeDelta.y, labelText.rectTransform.sizeDelta.y);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,8 @@ public class MyConfigWindow : MyWindowWithTabs
|
||||
public override void _OnCreate()
|
||||
{
|
||||
_windowTrans = GetComponent<RectTransform>();
|
||||
_windowTrans.sizeDelta = new Vector2(810f, 584f);
|
||||
|
||||
OnUICreated?.Invoke(this, _windowTrans);
|
||||
AutoFitWindowSize();
|
||||
SetCurrentTab(0);
|
||||
OnUpdateUI?.Invoke();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
@@ -15,6 +16,13 @@ public class MyWindow: ManualBehaviour
|
||||
private readonly Dictionary<InputField, Tuple<UnityAction<string>, UnityAction<string>>> _inputFields = new();
|
||||
private readonly Dictionary<UIButton, UnityAction> _buttons = new();
|
||||
protected bool EventRegistered { get; private set; }
|
||||
private float _maxX;
|
||||
protected float MaxY;
|
||||
protected const float TitleHeight = 48f;
|
||||
protected const float TabWidth = 105f;
|
||||
protected const float TabHeight = 27f;
|
||||
protected const float Margin = 30f;
|
||||
protected const float Spacing = 10f;
|
||||
|
||||
public virtual void TryClose()
|
||||
{
|
||||
@@ -43,6 +51,12 @@ public class MyWindow: ManualBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void AutoFitWindowSize()
|
||||
{
|
||||
var trans = GetComponent<RectTransform>();
|
||||
trans.sizeDelta = new Vector2(_maxX + Margin + TabWidth + Spacing + Margin, MaxY + TitleHeight + Margin);
|
||||
}
|
||||
|
||||
private static void AddElement(float x, float y, RectTransform rect, RectTransform parent = null)
|
||||
{
|
||||
if (rect != null)
|
||||
@@ -60,14 +74,19 @@ public class MyWindow: ManualBehaviour
|
||||
txt.color = new Color(1f, 1f, 1f, 0.4f);
|
||||
txt.alignment = TextAnchor.MiddleLeft;
|
||||
txt.fontSize = fontSize;
|
||||
if (txt.transform is RectTransform rect)
|
||||
{
|
||||
rect.sizeDelta = new Vector2(txt.preferredWidth + 40f, 30f);
|
||||
}
|
||||
txt.rectTransform.sizeDelta = new Vector2(txt.preferredWidth + 8f, txt.preferredHeight + 8f);
|
||||
AddElement(x, y, txt.rectTransform, parent);
|
||||
return txt;
|
||||
}
|
||||
|
||||
|
||||
public Text AddText2(float x, float y, RectTransform parent, string label, int fontSize = 14, string objName = "label")
|
||||
{
|
||||
var text = AddText(x, y, parent, label, fontSize, objName);
|
||||
_maxX = Math.Max(_maxX, x + text.rectTransform.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + text.rectTransform.sizeDelta.y);
|
||||
return text;
|
||||
}
|
||||
|
||||
public static UIButton AddTipsButton(float x, float y, RectTransform parent, string label, string tip, string content, string objName = "tips-button")
|
||||
{
|
||||
var src = UIRoot.instance.galaxySelect.sandboxToggle.gameObject.transform.parent.Find("tip-button");
|
||||
@@ -82,6 +101,18 @@ public class MyWindow: ManualBehaviour
|
||||
return btn;
|
||||
}
|
||||
|
||||
public UIButton AddTipsButton2(float x, float y, RectTransform parent, string label, string tip, string content, string objName = "tips-button")
|
||||
{
|
||||
var tipsButton = AddTipsButton(x, y, parent, label, tip, content, objName);
|
||||
var rect = tipsButton.transform as RectTransform;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
return tipsButton;
|
||||
}
|
||||
|
||||
public UIButton AddButton(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "button", UnityAction onClick = null)
|
||||
{
|
||||
return AddButton(x, y, 150f, parent, text, fontSize, objName, onClick);
|
||||
@@ -115,6 +146,8 @@ public class MyWindow: ManualBehaviour
|
||||
if (onClick != null)
|
||||
btn.button.onClick.AddListener(onClick);
|
||||
}
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
return btn;
|
||||
}
|
||||
|
||||
@@ -135,7 +168,7 @@ public class MyWindow: ManualBehaviour
|
||||
{
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 0f);
|
||||
}
|
||||
Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||
var t = btn.gameObject.transform.Find("Text")?.GetComponent<Text>();
|
||||
if (t != null)
|
||||
{
|
||||
@@ -148,10 +181,32 @@ public class MyWindow: ManualBehaviour
|
||||
{
|
||||
btn.button.onClick.AddListener(onClick);
|
||||
}
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
return btn;
|
||||
}
|
||||
|
||||
protected InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction<string> onChanged = null, UnityAction<string> onEditEnd = null)
|
||||
public MyCheckBox AddCheckBox(float x, float y, RectTransform parent, ConfigEntry<bool> config, string label = "", int fontSize = 15)
|
||||
{
|
||||
var cb = MyCheckBox.CreateCheckBox(x, y, parent, config, label, fontSize);
|
||||
_maxX = Math.Max(_maxX, x + cb.Width);
|
||||
MaxY = Math.Max(MaxY, y + cb.Height);
|
||||
return cb;
|
||||
}
|
||||
|
||||
public MySlider AddSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f)
|
||||
{
|
||||
var slider = MySlider.CreateSlider(x, y, parent, value, minValue, maxValue, format, width);
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
return slider;
|
||||
}
|
||||
|
||||
public InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction<string> onChanged = null, UnityAction<string> onEditEnd = null)
|
||||
{
|
||||
var stationWindow = UIRoot.instance.uiGame.stationWindow;
|
||||
//public InputField nameInput;
|
||||
@@ -173,6 +228,8 @@ public class MyWindow: ManualBehaviour
|
||||
if (onEditEnd != null)
|
||||
inputField.onEndEdit.AddListener(onEditEnd);
|
||||
}
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
return inputField;
|
||||
}
|
||||
|
||||
@@ -223,6 +280,7 @@ public class MyWindowWithTabs : MyWindow
|
||||
{
|
||||
private readonly List<Tuple<RectTransform, UIButton>> _tabs = [];
|
||||
private float _tabY = 54f;
|
||||
|
||||
public override void TryClose()
|
||||
{
|
||||
_Close();
|
||||
@@ -237,14 +295,14 @@ public class MyWindowWithTabs : MyWindow
|
||||
{
|
||||
var tab = new GameObject();
|
||||
var tabRect = tab.AddComponent<RectTransform>();
|
||||
Util.NormalizeRectWithMargin(tabRect, 48f, 145f, 0f, 0f, parent);
|
||||
Util.NormalizeRectWithMargin(tabRect, TitleHeight, Margin + TabWidth + Spacing, 0f, 0f, parent);
|
||||
tab.name = "tab-" + index;
|
||||
var swarmPanel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.swarmPanel;
|
||||
var src = swarmPanel.orbitButtons[0];
|
||||
var btn = Instantiate(src);
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, 30, y, parent);
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, Margin, y, parent);
|
||||
btn.name = "tab-btn-" + index;
|
||||
btnRect.sizeDelta = new Vector2(105f, 27f);
|
||||
btnRect.sizeDelta = new Vector2(TabWidth, TabHeight);
|
||||
btn.transform.Find("frame").gameObject.SetActive(false);
|
||||
if (btn.transitions.Length >= 3)
|
||||
{
|
||||
@@ -264,6 +322,7 @@ public class MyWindowWithTabs : MyWindow
|
||||
{
|
||||
btn.onClick += OnTabButtonClick;
|
||||
}
|
||||
MaxY = Math.Max(MaxY, y + TabHeight);
|
||||
return tabRect;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ public static class UIConfigWindow
|
||||
I18N.Add("Drag building power poles in maximum connection range", "Drag building power poles in maximum connection range", "拖动建造电线杆时自动使用最大连接距离间隔");
|
||||
I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出");
|
||||
I18N.Add("Belt signals for buy out dark fog items automatically", "Belt signals for buy out dark fog items automatically", "用于自动购买黑雾物品的传送带信号");
|
||||
I18N.Add("Logistics Control Panel Improvement", "Logistics Control Panel Improvement", "物流控制面板改进");
|
||||
I18N.Add("Logistics Control Panel Improvement tips", "Auto apply filter with item under mouse cursor while opening the panel\nQuick-set item filter while right-clicking item icons in storage list on the panel", "打开面板时自动将鼠标指向物品设为筛选条件\n在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件");
|
||||
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||
I18N.Add("Auto boost", "Auto boost", "自动加速");
|
||||
@@ -81,57 +83,53 @@ public static class UIConfigWindow
|
||||
var tab1 = wnd.AddTab(trans, "General");
|
||||
var x = 0f;
|
||||
var y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
y += 36f;
|
||||
/*
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
||||
x = 200f;
|
||||
y += 6f;
|
||||
MyWindow.AddTipsButton(x, y, tab1, "Better auto-save mechanism", "Better auto-save mechanism tips", "auto-save-opt-tips");
|
||||
wnd.AddTipsButton2(x, y, tab1, "Better auto-save mechanism", "Better auto-save mechanism tips", "auto-save-opt-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
*/
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, "Convert old saves to Combat Mode on loading");
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, "Convert old saves to Combat Mode on loading");
|
||||
var tab2 = wnd.AddTab(trans, "Planet/Factory");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LargerAreaForTerraformEnabled, "Larger area for terraform");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.LargerAreaForTerraformEnabled, "Larger area for terraform");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits");
|
||||
x = 270f;
|
||||
var cb = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
MyWindow.AddTipsButton(x, y, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
|
||||
wnd.AddTipsButton2(x, y, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
x = 270f;
|
||||
cb = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
MyWindow.AddTipsButton(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
wnd.AddTipsButton2(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically");
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>
|
||||
@@ -151,9 +149,9 @@ public static class UIConfigWindow
|
||||
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
|
||||
x += 10f;
|
||||
y += 30f;
|
||||
MyWindow.AddText(x, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
wnd.AddText2(x, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
y += 24f;
|
||||
var ocBuildSlider = MySlider.CreateSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount.Value, 0f, 40f, "G", 200f);
|
||||
var ocBuildSlider = wnd.AddSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount.Value, 0f, 40f, "G", 200f);
|
||||
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
|
||||
{
|
||||
ocBuildSlider.SetLabelText("max".Translate());
|
||||
@@ -166,33 +164,44 @@ public static class UIConfigWindow
|
||||
ocBuildSlider.SetLabelText("max".Translate());
|
||||
}
|
||||
};
|
||||
x = 400f;
|
||||
y += 54f;
|
||||
wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, LogisticsPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
cb = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
// x -= 200f;
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Player/Mecha");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
wnd.AddCheckBox(x, y, tab3, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
x = 270f;
|
||||
cb = wnd.AddCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
MyWindow.AddTipsButton(x, y, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
wnd.AddTipsButton2(x, y, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
x = 20f;
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14);
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14);
|
||||
x = 10f;
|
||||
y += 32f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 15);
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 15);
|
||||
y += 32f;
|
||||
MyWindow.AddText(x, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
wnd.AddText2(x, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
y += 24f;
|
||||
var distanceToWarp = MySlider.CreateSlider(x, y, tab3, (float)Math.Round(PlayerPatch.DistanceToWarp.Value * 2.0), 1f, 40f, "0.0", 200f);
|
||||
var distanceToWarp = wnd.AddSlider(x, y, tab3, (float)Math.Round(PlayerPatch.DistanceToWarp.Value * 2.0), 1f, 40f, "0.0", 200f);
|
||||
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
|
||||
{
|
||||
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
|
||||
@@ -206,9 +215,9 @@ public static class UIConfigWindow
|
||||
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only structure points but frames");
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only structure points but frames");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab4, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
|
||||
@@ -218,7 +227,7 @@ public static class UIConfigWindow
|
||||
})
|
||||
);
|
||||
y += 36f;
|
||||
MyWindow.AddText(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
wnd.AddText2(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
y += 26f;
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
@@ -246,9 +255,9 @@ public static class UIConfigWindow
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Tech/Combat");
|
||||
x = 10;
|
||||
y = 10;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab5, TechPatch.BatchBuyoutTechEnabled, "Buy out techs with their prerequisites");
|
||||
wnd.AddCheckBox(x, y, tab5, TechPatch.BatchBuyoutTechEnabled, "Buy out techs with their prerequisites");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab5, TechPatch.SorterCargoStackingEnabled, "Restore upgrades of \"Sorter Cargo Stacking\" on panel");
|
||||
wnd.AddCheckBox(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", () =>
|
||||
{
|
||||
|
||||
@@ -89,8 +89,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Increase maximum area size for terraform to 30x30 (from 10x10)\nNote: this may impact game performance while using large area");
|
||||
FactoryPatch.OffGridBuildingEnabled = Config.Bind("Factory", "OffGridBuilding", false,
|
||||
"Enable off grid building and stepped rotation");
|
||||
FactoryPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
|
||||
"Logistics capacity related tweaks");
|
||||
FactoryPatch.TreatStackingAsSingleEnabled = Config.Bind("Factory", "TreatStackingAsSingle", false,
|
||||
"Treat stack items as single in monitor components");
|
||||
FactoryPatch.QuickBuildAndDismantleLabsEnabled = Config.Bind("Factory", "QuickBuildAndDismantleLab", false,
|
||||
@@ -103,10 +101,14 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Do not render factory entities");
|
||||
FactoryPatch.DragBuildPowerPolesEnabled = Config.Bind("Factory", "DragBuildPowerPoles", false,
|
||||
"Drag building power poles in maximum connection range");
|
||||
FactoryPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||
"Allow overflow in logistic stations");
|
||||
FactoryPatch.BeltSignalsForBuyOutEnabled = Config.Bind("Factory", "BeltSignalsForBuyOut", false,
|
||||
"Belt signals for buy out dark fog items automatically");
|
||||
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
|
||||
"Logistics capacity related tweaks");
|
||||
LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||
"Allow overflow in logistic stations");
|
||||
LogisticsPatch.LogisticsConstrolPanelImprovementEnabled = Config.Bind("Factory", "LogisticsConstrolPanelImprovement", false,
|
||||
"Logistics control panel improvement");
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible");
|
||||
PlayerPatch.EnhancedMechaForgeCountControlEnabled = Config.Bind("Player", "EnhancedMechaForgeCountControl", false,
|
||||
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
|
||||
@@ -127,6 +129,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Stop ejectors when available nodes are all filled up");
|
||||
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
|
||||
"Construct only nodes but frames");
|
||||
DysonSpherePatch.AutoConstructMultiplier = Config.Bind("DysonSphere", "AutoConstructMultiplier", 10, "Dyson Sphere auto-construct speed multiplier");
|
||||
|
||||
I18N.Init();
|
||||
I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置");
|
||||
@@ -142,6 +145,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
UIConfigWindow.Init();
|
||||
GamePatch.Init();
|
||||
FactoryPatch.Init();
|
||||
LogisticsPatch.Init();
|
||||
PlanetPatch.Init();
|
||||
PlayerPatch.Init();
|
||||
TechPatch.Init();
|
||||
@@ -173,7 +177,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
if (VFInput.inputing) return;
|
||||
if (VFInput.onGUI)
|
||||
{
|
||||
FactoryPatch.LogisticsCapacityTweaks.UpdateInput();
|
||||
LogisticsPatch.LogisticsCapacityTweaks.UpdateInput();
|
||||
}
|
||||
if (_toggleKey.keyValue)
|
||||
{
|
||||
@@ -261,8 +265,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
if (panelButtonGo != null && btn != null)
|
||||
{
|
||||
panelButtonGo.name = "open-uxassist-config";
|
||||
rect.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
rect.anchoredPosition3D = new Vector3(128f, -105f, 0f);
|
||||
rect.localScale = new Vector3(0.6f, 0.6f, 0.6f);
|
||||
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
|
||||
b.onClick.RemoveAllListeners();
|
||||
btn.onClick += _ => { ToggleConfigWindow(); };
|
||||
btn.tips.tipTitle = "UXAssist Config";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.1.4</Version>
|
||||
<Version>1.1.5</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.1.4",
|
||||
"version_number": "1.1.5",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
"CommonAPI-CommonAPI-1.6.5",
|
||||
"CommonAPI-DSPModSave-1.1.4",
|
||||
"xiaoye97-BepInEx-5.4.17"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user