From 69d5a4b3ce96b57160869673a173bc99762df6fc Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Wed, 22 Jul 2026 15:25:30 +0800 Subject: [PATCH] feat(UXAssist): set orbital collector product limits --- AGENTS.md | 2 +- .../Common/Config/LogisticsConfigProvider.cs | 1 + UXAssist/Common/I18NKeys.cs | 4 +++ UXAssist/Patches/Logistics/LogisticsPatch.cs | 24 +++++++++++++++++ UXAssist/UIConfigWindow.cs | 27 +++++++++++++++++++ UXAssist/UXAssist.cs | 1 + 6 files changed, 58 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index d400491..68fe348 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,7 +51,7 @@ DSP_Mods/ | Mod | GUID | Description | |-----|------|-------------| -| **UXAssist** | `org.soardev.uxassist` | Core QoL mod and shared library. Window resize, profile-based saves, FPS control, factory/logistics/navigation/Dyson Sphere tweaks, UI improvements, config panel UI, and `Common/` + `UI/` widget library shared by other mods. The Logistics tab can also push auto-config values to all existing facilities of a type on the current planet (per-setting `Apply` and per-category `Apply All` buttons; logic in `LogisticsPatch.Apply*`/`ForEach*`, wired in `UIConfigWindow`). | +| **UXAssist** | `org.soardev.uxassist` | Core QoL mod and shared library. Window resize, profile-based saves, FPS control, factory/logistics/navigation/Dyson Sphere tweaks, UI improvements, config panel UI, and `Common/` + `UI/` widget library shared by other mods. The Logistics tab can push auto-config values to all existing facilities of a type on the current planet (per-setting `Apply` and per-category `Apply All` buttons), and can set both product limits of every Orbital Collector across all loaded factories; logic is in `LogisticsPatch.Apply*`/`ForEach*` and wired in `UIConfigWindow`. | | **CheatEnabler** | `org.soardev.cheatenabler` | Cheat pack (depends on UXAssist). Instant build, architect mode, infinite resources, power boosts, Dyson Sphere cheats with a bounded shell-count input (1–99,999), mecha invincibility, and more. | | **LogisticMiner** | — | Makes logistic stations automatically mine ores and water from the current planet. | | **HideTips** | — | Suppresses all tutorial popups, random tips, achievement/milestone cards, and skips the prologue cutscene. | diff --git a/UXAssist/Common/Config/LogisticsConfigProvider.cs b/UXAssist/Common/Config/LogisticsConfigProvider.cs index e62c225..f492363 100644 --- a/UXAssist/Common/Config/LogisticsConfigProvider.cs +++ b/UXAssist/Common/Config/LogisticsConfigProvider.cs @@ -29,6 +29,7 @@ public static class LogisticsConfigProvider public static ConfigEntry AutoConfigILSShipCount => LogisticsPatch.AutoConfigILSShipCount; public static ConfigEntry AutoConfigVeinCollectorHarvestSpeed => LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed; public static ConfigEntry AutoConfigVeinCollectorMinPilerValue => LogisticsPatch.AutoConfigVeinCollectorMinPilerValue; + public static ConfigEntry OrbitalCollectorProductLimit => LogisticsPatch.OrbitalCollectorProductLimit; public static ConfigEntry LogisticsCapacityTweaksEnabled => LogisticsPatch.LogisticsCapacityTweaksEnabled; public static ConfigEntry AllowOverflowInLogisticsEnabled => LogisticsPatch.AllowOverflowInLogisticsEnabled; public static ConfigEntry GreaterPowerUsageInLogisticsEnabled => LogisticsPatch.GreaterPowerUsageInLogisticsEnabled; diff --git a/UXAssist/Common/I18NKeys.cs b/UXAssist/Common/I18NKeys.cs index 40cf170..d49aca6 100644 --- a/UXAssist/Common/I18NKeys.cs +++ b/UXAssist/Common/I18NKeys.cs @@ -109,6 +109,8 @@ public static class I18NKeys public const string PLS = "PLS"; public const string ILS = "ILS"; public const string AdvancedMiningMachine = "Advanced Mining Machine"; + public const string OrbitalCollectorProductLimit = "Orbital Collector product limit"; + public const string ApplyToUniverse = "Apply to universe"; public const string SetDefaultRemoteLogicToStorage = "Set default remote logic to storage"; public const string MaxChargingPower = "Max. Charging Power"; public const string CountOfBotsFilled = "Count of Bots filled"; @@ -331,6 +333,8 @@ Close this function to resume mining and pumping, usually when you have enough l I18N.Add(PLS, "PLS", "行星物流站"); I18N.Add(ILS, "ILS", "星际物流站"); I18N.Add(AdvancedMiningMachine, "Advanced Mining Machine", "大型采矿机"); + I18N.Add(OrbitalCollectorProductLimit, "Orbital Collector product limit", "轨道采集器产物上限"); + I18N.Add(ApplyToUniverse, "Apply to universe", "应用到全宇宙"); I18N.Add(SetDefaultRemoteLogicToStorage, "Set default remote logic to storage", "设置默认远程逻辑为仓储"); I18N.Add(MaxChargingPower, "Max. Charging Power", "最大充能功率"); I18N.Add(CountOfBotsFilled, "Count of Bots filled", "填充的配送机数量"); diff --git a/UXAssist/Patches/Logistics/LogisticsPatch.cs b/UXAssist/Patches/Logistics/LogisticsPatch.cs index 73d258d..be18793 100644 --- a/UXAssist/Patches/Logistics/LogisticsPatch.cs +++ b/UXAssist/Patches/Logistics/LogisticsPatch.cs @@ -42,6 +42,7 @@ public static class LogisticsPatch // Vein collector config public static ConfigEntry AutoConfigVeinCollectorHarvestSpeed; // 0-20, 100% + 10% * value public static ConfigEntry AutoConfigVeinCollectorMinPilerValue; // 0~4; 0 = Maximum in tech, 1~4 = piler stacking count + public static ConfigEntry OrbitalCollectorProductLimit; public static ConfigEntry LogisticsCapacityTweaksEnabled; public static ConfigEntry AllowOverflowInLogisticsEnabled; @@ -338,5 +339,28 @@ public static class LogisticsPatch public static void ApplyVeinCollectorMinPilerValue() => ForEachStation(StationKind.VeinCollector, VeinCollectorSetPilerCount); public static void ApplyAllVeinCollector() => ForEachStation(StationKind.VeinCollector, DoConfigStation); + public static void ApplyOrbitalCollectorProductLimitToUniverse() + { + var data = GameMain.data; + var factories = data?.factories; + if (factories == null) return; + var limit = OrbitalCollectorProductLimit.Value; + for (var factoryIndex = data.factoryCount - 1; factoryIndex >= 0; factoryIndex--) + { + var transport = factories[factoryIndex]?.transport; + var stationPool = transport?.stationPool; + if (stationPool == null) continue; + for (var stationIndex = transport.stationCursor - 1; stationIndex > 0; stationIndex--) + { + var station = stationPool[stationIndex]; + if (station == null || station.id != stationIndex || !station.isCollector) continue; + var productCount = Math.Min(station.storage.Length, station.collectionIds?.Length ?? 0); + for (var productIndex = 0; productIndex < productCount; productIndex++) + station.storage[productIndex].max = limit; + } + } + RefreshOpenLogisticsWindows(); + } + #endregion } diff --git a/UXAssist/UIConfigWindow.cs b/UXAssist/UIConfigWindow.cs index 53ccd7a..5b776a3 100644 --- a/UXAssist/UIConfigWindow.cs +++ b/UXAssist/UIConfigWindow.cs @@ -479,6 +479,33 @@ public static class UIConfigWindow } } y += 36f; + { + txt = wnd.AddText2(x, y + 4f, tab3, I18NKeys.OrbitalCollectorProductLimit, 15, "text-orbital-collector-product-limit"); + var productLimitConfig = LogisticsConfigProvider.OrbitalCollectorProductLimit; + var productLimitInput = wnd.AddInputField(x + txt.preferredWidth + 10f, y, tab3, productLimitConfig.Value.ToString(), 15, + "input-orbital-collector-product-limit"); + productLimitInput.onEndEdit.AddListener(SetProductLimit); + productLimitInput.contentType = UnityEngine.UI.InputField.ContentType.IntegerNumber; + productLimitInput.characterValidation = UnityEngine.UI.InputField.CharacterValidation.Integer; + (productLimitInput.transform as RectTransform).sizeDelta = new Vector2(100f, (productLimitInput.transform as RectTransform).sizeDelta.y); + wnd.AddButton(x + txt.preferredWidth + 120f, y, 130f, tab3, I18NKeys.ApplyToUniverse, 14, + "button-apply-orbital-collector-product-limit", () => + { + SetProductLimit(productLimitInput.text); + LogisticsPatch.ApplyOrbitalCollectorProductLimitToUniverse(); + }); + productLimitConfig.SettingChanged += ProductLimitChanged; + wnd.OnFree += () => productLimitConfig.SettingChanged -= ProductLimitChanged; + + void SetProductLimit(string value) + { + if (int.TryParse(value, out var parsed)) productLimitConfig.Value = Mathf.Clamp(parsed, 1, 999999); + productLimitInput.text = productLimitConfig.Value.ToString(); + } + + void ProductLimitChanged(object sender, EventArgs args) => productLimitInput.text = productLimitConfig.Value.ToString(); + } + y += 36f; wnd.AddCheckBox(x, y, tab3, LogisticsConfigProvider.AutoConfigLogisticsEnabled, I18NKeys.AutoConfigLogisticStations); y += 26f; wnd.AddCheckBox(x + 10f, y, tab3, LogisticsConfigProvider.AutoConfigLimitAutoReplenishCount, I18NKeys.LimitAutoReplenishCountToValuesBelow, 13).WithSmallerBox(); diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index fadd965..d507aaf 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -196,6 +196,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave LogisticsPatch.AutoConfigILSShipCount = Config.Bind("Factory", "AutoConfigILSShipCount", 10, new ConfigDescription("ILS: Count of Vessels filled", new AcceptableValueRange(0, 10))); LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed = Config.Bind("Factory", "AutoConfigVeinCollectorHarvestSpeed", 20, new ConfigDescription("AMM: Collecting Speed", new AcceptableValueRange(0, 20))); LogisticsPatch.AutoConfigVeinCollectorMinPilerValue = Config.Bind("Factory", "AutoConfigVeinCollectorMinPilerValue", 0, new ConfigDescription("AMM: Outgoing integration count", new AcceptableValueRange(0, 4))); + LogisticsPatch.OrbitalCollectorProductLimit = Config.Bind("Factory", "OrbitalCollectorProductLimit", 20000, new ConfigDescription("Orbital Collector product limit", new AcceptableValueRange(1, 999999))); LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true, "Logistics capacity related tweaks"); LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,