18 lines
773 B
C#
18 lines
773 B
C#
namespace ReactorMaintenance.Simulation;
|
|
|
|
public sealed class PipeBurstHazard : Hazard
|
|
{
|
|
public override IEnumerable<Forecast> Predict(LevelState level, int turns)
|
|
{
|
|
for (var y = Balancing.FirstGridCoordinate; y < level.Height; y++)
|
|
{
|
|
for (var x = Balancing.FirstGridCoordinate; x < level.Width; x++)
|
|
{
|
|
var position = new GridPosition(x, y);
|
|
var cell = level.GetCell(position);
|
|
if (cell is { HasPipe: true, PipeOpen: false } && cell.Flow == Balancing.BrokenPipeFlow && cell.LeakRate >= Balancing.BurstLeakRate)
|
|
yield return new(EFailureKind.PipeBurst, position, turns, $"PIPE BURST PREDICTED AT {x},{y} IN {turns} TURNS");
|
|
}
|
|
}
|
|
}
|
|
} |