feat(UXAssist): set orbital collector product limits

This commit is contained in:
2026-07-22 15:25:30 +08:00
parent 53d558a9a4
commit 69d5a4b3ce
6 changed files with 58 additions and 1 deletions
@@ -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
}