fix(production): correct blueprint power and planner edge cases

Read the Advanced Mining Machine speed stored with station settings in prebuild
and blueprint captures, and count charging power nodes such as Satellite
Substations at their idle draw. Skip recipes that consume their own product when
choosing an item's default recipe, so Refined Oil uses Plasma Refining instead
of Reforming Refine.

Run each planner recipe in one proliferation mode and report conflicting
explicit modes, keep material flows for recipe types the catalog does not know,
and attribute receiver warnings to their recipe. Compare simplex ratio ties
relatively and drive out near-zero artificials without amplifying residuals.
Bound the steady-state reduction so lossless cycles cannot stall blueprint
descriptions, and choose power units after rounding.

Remove redundant code: share the numeric and flow helpers, and drop the unused
IsExcessIntermediate threshold, legacy constructor and Capture overloads, the
multi-field updater, and the unused proliferator source table.
This commit is contained in:
soarqin committed 2026-10-25 22:01:05 +08:00
1 parent 6345562c66
commit f0773ffb9b
24 files changed
+463 -404

No files matched your search

+3 -13
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using static UXAssist.Production.ProductionMath;
namespace UXAssist.Production;
@@ -25,7 +26,7 @@ public sealed class MiningProcessAdapter : IProductionProcessAdapter
if (operatingParameters == null ||
!operatingParameters.TryGetValue("ResourceItemId", out var outputId) ||
!ValidItemId(outputId) || !catalog.Items.ContainsKey((int)outputId) ||
!PositiveId(outputId) || !catalog.Items.ContainsKey((int)outputId) ||
!operatingParameters.TryGetValue("MiningSpeedMultiplier", out var miningSpeed) ||
!FinitePositive(miningSpeed))
{
@@ -72,8 +73,7 @@ public sealed class MiningProcessAdapter : IProductionProcessAdapter
var powerRatio = machineSpeed * machineSpeed;
var workingWatts = building.WorkingPowerWatts * powerRatio +
building.IdlePowerWatts * (1 - powerRatio);
if (!FinitePositive(perMinute) || workingWatts < 0 ||
double.IsNaN(workingWatts) || double.IsInfinity(workingWatts))
if (!FinitePositive(perMinute) || !FiniteNonnegative(workingWatts))
{
diagnostic = new ProductionDiagnostic(ProductionDiagnosticCode.InvalidRequest,
"The mineral output rate or power demand is outside the supported range.",
@@ -87,14 +87,4 @@ public sealed class MiningProcessAdapter : IProductionProcessAdapter
perMinute, workingWatts, true);
return true;
}
private static bool ValidItemId(double value)
{
return value > 0 && value <= int.MaxValue && value == Math.Truncate(value);
}
private static bool FinitePositive(double value)
{
return value > 0 && !double.IsNaN(value) && !double.IsInfinity(value);
}
}