Centralize simulation balancing values
This commit is contained in:
@@ -4,13 +4,13 @@ public sealed class PipeBurstHazard : Hazard
|
||||
{
|
||||
public override IEnumerable<Forecast> Predict(LevelState level, int turns)
|
||||
{
|
||||
for (var y = 0; y < level.Height; y++)
|
||||
for (var y = Balancing.FirstGridCoordinate; y < level.Height; y++)
|
||||
{
|
||||
for (var x = 0; x < level.Width; x++)
|
||||
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, Flow: 0, LeakRate: >= 3 })
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user