mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 07:40:12 +08:00
feat(UXAssist): set orbital collector product limits
This commit is contained in:
@@ -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. |
|
||||
|
||||
@@ -29,6 +29,7 @@ public static class LogisticsConfigProvider
|
||||
public static ConfigEntry<int> AutoConfigILSShipCount => LogisticsPatch.AutoConfigILSShipCount;
|
||||
public static ConfigEntry<int> AutoConfigVeinCollectorHarvestSpeed => LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed;
|
||||
public static ConfigEntry<int> AutoConfigVeinCollectorMinPilerValue => LogisticsPatch.AutoConfigVeinCollectorMinPilerValue;
|
||||
public static ConfigEntry<int> OrbitalCollectorProductLimit => LogisticsPatch.OrbitalCollectorProductLimit;
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled => LogisticsPatch.LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled => LogisticsPatch.AllowOverflowInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> GreaterPowerUsageInLogisticsEnabled => LogisticsPatch.GreaterPowerUsageInLogisticsEnabled;
|
||||
|
||||
@@ -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", "填充的配送机数量");
|
||||
|
||||
@@ -42,6 +42,7 @@ public static class LogisticsPatch
|
||||
// Vein collector config
|
||||
public static ConfigEntry<int> AutoConfigVeinCollectorHarvestSpeed; // 0-20, 100% + 10% * value
|
||||
public static ConfigEntry<int> AutoConfigVeinCollectorMinPilerValue; // 0~4; 0 = Maximum in tech, 1~4 = piler stacking count
|
||||
public static ConfigEntry<int> OrbitalCollectorProductLimit;
|
||||
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> 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
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed = Config.Bind("Factory", "AutoConfigVeinCollectorHarvestSpeed", 20, new ConfigDescription("AMM: Collecting Speed", new AcceptableValueRange<int>(0, 20)));
|
||||
LogisticsPatch.AutoConfigVeinCollectorMinPilerValue = Config.Bind("Factory", "AutoConfigVeinCollectorMinPilerValue", 0, new ConfigDescription("AMM: Outgoing integration count", new AcceptableValueRange<int>(0, 4)));
|
||||
LogisticsPatch.OrbitalCollectorProductLimit = Config.Bind("Factory", "OrbitalCollectorProductLimit", 20000, new ConfigDescription("Orbital Collector product limit", new AcceptableValueRange<int>(1, 999999)));
|
||||
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
|
||||
"Logistics capacity related tweaks");
|
||||
LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||
|
||||
Reference in New Issue
Block a user