mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
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.
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using static UXAssist.Production.ProductionMath;
|
|
|
|
namespace UXAssist.Production;
|
|
|
|
public sealed class RenewableGenerationAdapter : IProductionProcessAdapter
|
|
{
|
|
public bool CanEvaluate(ProductionRecipe recipe, ProductionBuilding building)
|
|
{
|
|
return recipe == null && building?.Kind == ProductionBuildingKind.RenewableGenerator;
|
|
}
|
|
|
|
public bool TryEvaluate(ProductionCatalog catalog, ProductionRecipe recipe, ProductionBuilding building,
|
|
ProliferationMode mode, int level, IReadOnlyDictionary<string, double> operatingParameters,
|
|
out ProductionProcess process, out ProductionDiagnostic diagnostic)
|
|
{
|
|
process = null;
|
|
diagnostic = null;
|
|
if (building.RenewableSource == RenewablePowerSource.None ||
|
|
!FiniteNonnegative(building.RatedGenerationWatts))
|
|
{
|
|
diagnostic = new ProductionDiagnostic(ProductionDiagnosticCode.UnsupportedProcess,
|
|
"The generator has no renewable power rating.", buildingItemId: building.ItemId);
|
|
return false;
|
|
}
|
|
|
|
process = new ProductionProcess(0, building.ItemId, ProliferationMode.None, 0,
|
|
Array.Empty<KeyValuePair<int, double>>(), Array.Empty<KeyValuePair<int, double>>(),
|
|
1, building.WorkingPowerWatts, true,
|
|
generationWatts: building.RatedGenerationWatts);
|
|
return true;
|
|
}
|
|
}
|