feat(production): include logistics charging in black-box power

This commit is contained in:
soarqin committed 2026-10-11 03:13:07 +08:00
1 parent d4ba72abf4
commit 8696a80a66
7 files changed
+164 -2

No files matched your search

@@ -117,6 +117,29 @@ public sealed class FactoryBlackBoxAnalyzer
continue;
}
if (snapshot.RecipeId == 0 && building.Kind == ProductionBuildingKind.Logistics)
{
double? logisticsWatts = null;
if (!snapshot.OperatingParameters.TryGetValue("ChargePowerWatts", out var chargePowerWatts))
diagnostics.Add(new ProductionDiagnostic(ProductionDiagnosticCode.MissingOperatingParameter,
"The selected logistics facility needs its configured charging power.",
buildingItemId: snapshot.BuildingItemId));
else if (chargePowerWatts < 0 || double.IsNaN(chargePowerWatts) ||
double.IsInfinity(chargePowerWatts * snapshot.Count))
diagnostics.Add(new ProductionDiagnostic(ProductionDiagnosticCode.InvalidRequest,
"The selected logistics charging power must be finite and nonnegative.",
buildingItemId: snapshot.BuildingItemId));
else
logisticsWatts = chargePowerWatts * snapshot.Count;
if (logisticsWatts.HasValue) consumptionWatts += logisticsWatts.Value;
else powerComplete = false;
groups.Add(new ProductionGroupFlow(null, snapshot.Count, 0, snapshot.Count, snapshot.Count,
logisticsWatts, logisticsWatts, Array.Empty<KeyValuePair<int, double>>(),
Array.Empty<KeyValuePair<int, double>>()));
continue;
}
if (snapshot.RecipeId == 0 && (building.Kind == ProductionBuildingKind.Ordinary ||
building.Kind == ProductionBuildingKind.Auxiliary))
{