mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
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:
1 parent
6345562c66
commit
f0773ffb9b
24 files changed
+463
-404
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static UXAssist.Production.ProductionMath;
|
||||
|
||||
namespace UXAssist.Production;
|
||||
|
||||
@@ -52,7 +53,9 @@ public sealed class ProcessEvaluator
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsOrdinary(recipe.Category))
|
||||
// Recipe types unknown to the catalog, such as ones added by other mods, keep their material flows only
|
||||
// while no building is selected.
|
||||
if (!IsOrdinary(recipe.Category) && (recipe.Category != ProductionRecipeCategory.None || building != null))
|
||||
{
|
||||
diagnostic = new ProductionDiagnostic(ProductionDiagnosticCode.UnsupportedProcess,
|
||||
"The recipe requires a special-process adapter.", recipeId: recipe.Id,
|
||||
@@ -114,17 +117,6 @@ public sealed class ProcessEvaluator
|
||||
|
||||
private static bool ValidFlows(IReadOnlyDictionary<int, double> flows)
|
||||
{
|
||||
return flows.All(flow => flow.Key > 0 && flow.Value > 0 && !double.IsNaN(flow.Value) &&
|
||||
!double.IsInfinity(flow.Value));
|
||||
}
|
||||
|
||||
private static bool FinitePositive(double value)
|
||||
{
|
||||
return value > 0 && !double.IsNaN(value) && !double.IsInfinity(value);
|
||||
}
|
||||
|
||||
private static bool FiniteNonnegative(double value)
|
||||
{
|
||||
return value >= 0 && !double.IsNaN(value) && !double.IsInfinity(value);
|
||||
return flows.All(flow => flow.Key > 0 && FinitePositive(flow.Value));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user