Document code style and normalize files
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum CellKind
|
||||
public enum ECellKind
|
||||
{
|
||||
Empty,
|
||||
Floor,
|
||||
@@ -13,7 +13,7 @@ public enum CellKind
|
||||
ControlTerminal
|
||||
}
|
||||
|
||||
public enum PipeMedium
|
||||
public enum EPipeMedium
|
||||
{
|
||||
None,
|
||||
Pressure,
|
||||
@@ -21,7 +21,7 @@ public enum PipeMedium
|
||||
Fuel
|
||||
}
|
||||
|
||||
public enum FailureKind
|
||||
public enum EFailureKind
|
||||
{
|
||||
PipeBurst,
|
||||
Ignition,
|
||||
@@ -45,8 +45,7 @@ public sealed record HazardState
|
||||
{
|
||||
public HazardState Clamp()
|
||||
{
|
||||
return this with
|
||||
{
|
||||
return this with {
|
||||
Heat = Rules.Clamp(Heat),
|
||||
Smoke = Rules.Clamp(Smoke),
|
||||
FuelVapor = Rules.Clamp(FuelVapor),
|
||||
@@ -69,8 +68,8 @@ public sealed record HazardState
|
||||
|
||||
public sealed record CellState
|
||||
{
|
||||
public CellKind Kind { get; init; } = CellKind.Floor;
|
||||
public PipeMedium Pipe { get; init; }
|
||||
public ECellKind Kind { get; init; } = ECellKind.Floor;
|
||||
public EPipeMedium Pipe { get; init; }
|
||||
public int Flow { get; init; }
|
||||
public int Pressure { get; init; }
|
||||
public int Integrity { get; init; } = 10;
|
||||
@@ -79,9 +78,8 @@ public sealed record CellState
|
||||
public bool Powered { get; init; }
|
||||
public bool DoorLocked { get; init; }
|
||||
public HazardState Hazards { get; init; } = new();
|
||||
|
||||
public bool IsWalkable => Kind != CellKind.Wall && Kind != CellKind.Empty;
|
||||
public bool HasPipe => Pipe != PipeMedium.None;
|
||||
public bool IsWalkable => Kind != ECellKind.Wall && Kind != ECellKind.Empty;
|
||||
public bool HasPipe => Pipe != EPipeMedium.None;
|
||||
}
|
||||
|
||||
public sealed record GlobalState
|
||||
@@ -97,7 +95,7 @@ public sealed record GlobalState
|
||||
public string Status { get; init; } = "STABILIZE SYSTEMS";
|
||||
}
|
||||
|
||||
public sealed record Forecast(FailureKind Kind, GridPosition? Position, int Turns, string Message);
|
||||
public sealed record Forecast(EFailureKind Kind, GridPosition? Position, int Turns, string Message);
|
||||
|
||||
public sealed record LevelState
|
||||
{
|
||||
@@ -108,12 +106,15 @@ public sealed record LevelState
|
||||
|
||||
var cells = CreateCells(width, height);
|
||||
for (var y = 0; y < height; y++)
|
||||
for (var x = 0; x < width; x++)
|
||||
if (x == 0 || y == 0 || x == width - 1 || y == height - 1)
|
||||
cells[y * width + x] = cells[y * width + x] with { Kind = CellKind.Wall };
|
||||
|
||||
return new()
|
||||
{
|
||||
for (var x = 0; x < width; x++)
|
||||
{
|
||||
if (x == 0 || y == 0 || x == width - 1 || y == height - 1)
|
||||
cells[y * width + x] = cells[y * width + x] with { Kind = ECellKind.Wall };
|
||||
}
|
||||
}
|
||||
|
||||
return new() {
|
||||
Name = name,
|
||||
Width = width,
|
||||
Height = height,
|
||||
|
||||
Reference in New Issue
Block a user