Update rewrite docs and cleanup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using ReactorMaintenance.Simulation.Difficulties;
|
||||
using ReactorMaintenance.Simulation.Difficulties;
|
||||
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
@@ -158,4 +158,4 @@ public abstract class Balancing
|
||||
public abstract int RemedyBlockTurns { get; }
|
||||
public abstract int HeatShieldSteps { get; }
|
||||
public abstract int InventoryCapacityPerRemedy { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation.Difficulties;
|
||||
namespace ReactorMaintenance.Simulation.Difficulties;
|
||||
|
||||
public class NormalBalancing : Balancing
|
||||
{
|
||||
@@ -30,6 +30,7 @@ public class NormalBalancing : Balancing
|
||||
public override float SourceIntensity => 8;
|
||||
public override float DistanceAmountFalloff => 0.5f;
|
||||
public override float DistanceIntensityFalloff => 0.4f;
|
||||
|
||||
public override IReadOnlyList<JunctionRatioPreset> TwoOutflowJunctionRatios { get; } = [
|
||||
new("0/4", [0, 1]),
|
||||
new("1/3", [0.25f, 0.75f]),
|
||||
@@ -37,12 +38,14 @@ public class NormalBalancing : Balancing
|
||||
new("3/1", [0.75f, 0.25f]),
|
||||
new("4/0", [1, 0])
|
||||
];
|
||||
|
||||
public override IReadOnlyList<JunctionRatioPreset> ThreeOutflowJunctionRatios { get; } = [
|
||||
new("0/3/3", [0, 0.5f, 0.5f]),
|
||||
new("3/0/3", [0.5f, 0, 0.5f]),
|
||||
new("3/3/0", [0.5f, 0.5f, 0]),
|
||||
new("2/2/2", [1f / 3f, 1f / 3f, 1f / 3f])
|
||||
];
|
||||
|
||||
public override float ConsumerRequiredAmount => 2.5f;
|
||||
public override float ConsumerRequiredIntensity => 2.5f;
|
||||
public override float LeakBaseAmount => 0.5f;
|
||||
@@ -64,4 +67,4 @@ public class NormalBalancing : Balancing
|
||||
public override int RemedyBlockTurns => 2;
|
||||
public override int HeatShieldSteps => 3;
|
||||
public override int InventoryCapacityPerRemedy => 3;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class GridPositionExtensions
|
||||
{
|
||||
@@ -14,4 +14,4 @@ public static class GridPositionExtensions
|
||||
{
|
||||
return Math.Abs(position.X - other.X) + Math.Abs(position.Y - other.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,4 +31,4 @@ public sealed record JunctionFlow
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,4 +94,4 @@ public static class JunctionFlowAnalyzer
|
||||
}
|
||||
|
||||
private sealed record SourceBranch(GridPosition Position, int? Distance);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record JunctionRatioPreset(string Label, float[] Weights);
|
||||
public sealed record JunctionRatioPreset(string Label, float[] Weights);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EEditorTool
|
||||
{
|
||||
@@ -160,4 +160,4 @@ public static class LevelEditor
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class LevelStateExtensions
|
||||
{
|
||||
@@ -113,4 +113,4 @@ public static class LevelStateExtensions
|
||||
{
|
||||
return edgeA == a && edgeB == b || edgeA == b && edgeB == a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class LevelStateFactory
|
||||
{
|
||||
@@ -51,4 +51,4 @@ public static class LevelStateFactory
|
||||
{
|
||||
return Enumerable.Range(0, width * height).Select(_ => new PropState()).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record DoorState
|
||||
{
|
||||
public GridPosition A { get; init; } = new(0, 0);
|
||||
public GridPosition B { get; init; } = new(0, 0);
|
||||
public EDoorState State { get; init; } = EDoorState.Closed;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EBand
|
||||
{
|
||||
Safe,
|
||||
Caution,
|
||||
Critical
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ECarrierType
|
||||
{
|
||||
Fuel,
|
||||
Coolant,
|
||||
Electricity
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ECellTerrain
|
||||
{
|
||||
Floor,
|
||||
Wall
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EConsumerServiceState
|
||||
{
|
||||
@@ -7,4 +7,4 @@ public enum EConsumerServiceState
|
||||
Starved,
|
||||
Supplied,
|
||||
Producing
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EDoorState
|
||||
{
|
||||
Open,
|
||||
Closed
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EForecastKind
|
||||
{
|
||||
@@ -7,4 +7,4 @@ public enum EForecastKind
|
||||
ConsumerStarved,
|
||||
HazardGrowth,
|
||||
RuleEvent
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ELevelState
|
||||
{
|
||||
@@ -8,4 +8,4 @@ public enum ELevelState
|
||||
Ready,
|
||||
Lost,
|
||||
Won
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ENetworkValueKind
|
||||
{
|
||||
Amount,
|
||||
Intensity
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EPropSwitchState
|
||||
{
|
||||
Disabled,
|
||||
Enabled
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EPropType
|
||||
{
|
||||
@@ -10,4 +10,4 @@ public enum EPropType
|
||||
AllSeeingEyeTerminal,
|
||||
RemedySupply,
|
||||
ReactorControl
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERemedyType
|
||||
{
|
||||
@@ -6,4 +6,4 @@ public enum ERemedyType
|
||||
CoolantNeutralizer,
|
||||
ElectricityNeutralizer,
|
||||
HeatShield
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERuleEffectKind
|
||||
{
|
||||
@@ -15,4 +15,4 @@ public enum ERuleEffectKind
|
||||
RemoveInventory,
|
||||
MarkTerminalLoss,
|
||||
EmitWarning
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERuleEventPhase
|
||||
{
|
||||
StartOfSimulation,
|
||||
EndOfTurn
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERulePredicateKind
|
||||
{
|
||||
@@ -14,4 +14,4 @@ public enum ERulePredicateKind
|
||||
RobotAt,
|
||||
RobotInventoryAtLeast,
|
||||
AllSeeingEyeUnlocked
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ESurfaceInteractionVerb
|
||||
{
|
||||
@@ -8,4 +8,4 @@ public enum ESurfaceInteractionVerb
|
||||
Quench,
|
||||
Short,
|
||||
Ignite
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ESurfaceQuantity
|
||||
{
|
||||
@@ -6,4 +6,4 @@ public enum ESurfaceQuantity
|
||||
Coolant,
|
||||
Electricity,
|
||||
Heat
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EUndergroundState
|
||||
{
|
||||
Absent,
|
||||
Intact,
|
||||
Leaking
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record Forecast(EForecastKind Kind, GridPosition? Position, int Turns, string Message);
|
||||
public sealed record Forecast(EForecastKind Kind, GridPosition? Position, int Turns, string Message);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record GlobalState
|
||||
{
|
||||
@@ -9,4 +9,4 @@ public sealed record GlobalState
|
||||
public bool AllSeeingEyeUnlocked { get; init; }
|
||||
public bool TerminalLoss { get; init; }
|
||||
public IReadOnlyList<string> Warnings { get; init; } = Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record GridPosition(int X, int Y);
|
||||
public sealed record GridPosition(int X, int Y);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record LeakState
|
||||
{
|
||||
@@ -6,4 +6,4 @@ public sealed record LeakState
|
||||
public GridPosition UndergroundPosition { get; init; } = new(0, 0);
|
||||
public GridPosition AccessPosition { get; init; } = new(0, 0);
|
||||
public bool Repaired { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record LevelState
|
||||
{
|
||||
@@ -23,4 +23,4 @@ public sealed record LevelState
|
||||
public RobotState Robot { get; init; } = new();
|
||||
public GlobalState Global { get; init; } = new();
|
||||
public IReadOnlyList<Forecast> Forecasts { get; init; } = Array.Empty<Forecast>();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record PropState
|
||||
{
|
||||
@@ -12,4 +12,4 @@ public sealed record PropState
|
||||
public int ReactorId { get; init; }
|
||||
|
||||
public bool IsEnabled => SwitchState == EPropSwitchState.Enabled;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ReactorBinding
|
||||
{
|
||||
@@ -9,4 +9,4 @@ public sealed record ReactorBinding
|
||||
public GridPosition ElectricityConsumerPosition { get; init; } = new(0, 0);
|
||||
public bool Ready { get; init; }
|
||||
public bool Activated { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RobotState
|
||||
{
|
||||
@@ -8,4 +8,4 @@ public sealed record RobotState
|
||||
public int ElectricityNeutralizers { get; init; }
|
||||
public int HeatShields { get; init; }
|
||||
public int HeatImmunitySteps { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RuleEffect
|
||||
{
|
||||
@@ -10,4 +10,4 @@ public sealed record RuleEffect
|
||||
public float Amount { get; init; }
|
||||
public EPropSwitchState PropSwitchState { get; init; }
|
||||
public string Message { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RuleEventState
|
||||
{
|
||||
@@ -11,4 +11,4 @@ public sealed record RuleEventState
|
||||
public IReadOnlyList<RulePredicate> Predicates { get; init; } = Array.Empty<RulePredicate>();
|
||||
public IReadOnlyList<RuleEffect> Effects { get; init; } = Array.Empty<RuleEffect>();
|
||||
public string ForecastText { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RulePredicate
|
||||
{
|
||||
@@ -15,4 +15,4 @@ public sealed record RulePredicate
|
||||
public EBand Band { get; init; }
|
||||
public int InventoryCount { get; init; }
|
||||
public bool BoolValue { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record SurfaceState
|
||||
{
|
||||
@@ -9,4 +9,4 @@ public sealed record SurfaceState
|
||||
public int FuelBlockTurns { get; init; }
|
||||
public int CoolantBlockTurns { get; init; }
|
||||
public int ElectricityBlockTurns { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record UndergroundCell
|
||||
{
|
||||
@@ -8,4 +8,4 @@ public sealed record UndergroundCell
|
||||
|
||||
public bool IsPresent => State != EUndergroundState.Absent;
|
||||
public bool CarriesFlow => State is EUndergroundState.Intact or EUndergroundState.Leaking;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ValidationIssue(string Message, GridPosition? Position = null);
|
||||
public sealed record ValidationIssue(string Message, GridPosition? Position = null);
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ValidationReport
|
||||
{
|
||||
public IReadOnlyList<ValidationIssue> Errors { get; init; } = Array.Empty<ValidationIssue>();
|
||||
public IReadOnlyList<ValidationIssue> Warnings { get; init; } = Array.Empty<ValidationIssue>();
|
||||
public bool IsValid => Errors.Count == 0;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class RobotStateExtensions
|
||||
{
|
||||
@@ -33,4 +33,4 @@ public static class RobotStateExtensions
|
||||
{
|
||||
return Math.Clamp(value, 0, Balancing.Current.InventoryCapacityPerRemedy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed class SimulationEngine
|
||||
{
|
||||
@@ -43,4 +43,4 @@ public sealed class SimulationEngine
|
||||
}
|
||||
|
||||
private readonly SimulationCoreSystem m_Core = new();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record SurfaceInteractionEffect
|
||||
{
|
||||
@@ -8,4 +8,4 @@ public sealed record SurfaceInteractionEffect
|
||||
public ESurfaceQuantity Quantity { get; init; }
|
||||
public float Amount { get; init; }
|
||||
public float SecondaryAmount { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class SurfaceStateExtensions
|
||||
{
|
||||
@@ -25,4 +25,4 @@ public static class SurfaceStateExtensions
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(carrier), carrier, "Unsupported carrier.")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
internal sealed class SimulationCoreSystem
|
||||
{
|
||||
@@ -703,5 +703,4 @@ internal sealed class SimulationCoreSystem
|
||||
}
|
||||
|
||||
private readonly LevelValidator m_Validator = new();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
@@ -717,4 +717,4 @@ public sealed partial class MainWindow
|
||||
private CanvasBitmap? m_RobotSprite;
|
||||
private CanvasBitmap? m_LeakSprite;
|
||||
private CanvasBitmap? m_HeatSprite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user