mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
Stop capturing the transient miner output damper, apply the sandbox boost state to artificial stars as for launchers, and keep lens-free photon flows when no ray receiver is selected. Scale the planner conservation check by each ledger row and normalize the simplex right-hand side so large rates no longer fail. Skip non-production objects before copying native settings, decode blueprints through the native paste path, and simplify analyzer mode resolution. Update stale ProductionCheck expectations, add regression checks, and document the rules.
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace UXAssist.Production;
|
|
|
|
internal static class SandboxBoost
|
|
{
|
|
internal const string EnabledKey = "BoostEnabled";
|
|
|
|
internal static string ModeKey(ProductionBuilding building)
|
|
{
|
|
switch (building.Kind)
|
|
{
|
|
case ProductionBuildingKind.Ejector:
|
|
return "Mode1";
|
|
case ProductionBuildingKind.Silo:
|
|
case ProductionBuildingKind.FuelGenerator when building.FuelMask == 4:
|
|
return "Mode0";
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// Native paste applies a stored boost mode only with sandbox tools enabled; live captures report the applied state.
|
|
internal static bool TryResolve(IReadOnlyDictionary<string, double> operatingParameters, string modeKey,
|
|
int buildingItemId, out bool boosted, out ProductionDiagnostic diagnostic)
|
|
{
|
|
boosted = false;
|
|
diagnostic = null;
|
|
if (operatingParameters == null || !operatingParameters.TryGetValue(modeKey, out var mode) ||
|
|
mode != 0 && mode != 1 || mode == 1 && !operatingParameters.ContainsKey(EnabledKey))
|
|
{
|
|
diagnostic = new ProductionDiagnostic(ProductionDiagnosticCode.MissingOperatingParameter,
|
|
"Provide the building's native boost mode and whether sandbox boost is active.",
|
|
buildingItemId: buildingItemId);
|
|
return false;
|
|
}
|
|
|
|
if (operatingParameters.TryGetValue(EnabledKey, out var enabled) &&
|
|
(enabled != 0 && enabled != 1 || enabled == 1 && mode != 1))
|
|
{
|
|
diagnostic = new ProductionDiagnostic(ProductionDiagnosticCode.InvalidRequest,
|
|
"The sandbox boost setting conflicts with the building's native boost mode.",
|
|
buildingItemId: buildingItemId);
|
|
return false;
|
|
}
|
|
|
|
boosted = enabled == 1;
|
|
return true;
|
|
}
|
|
}
|