Fix editor link validation regressions

This commit is contained in:
2026-05-14 10:31:25 +02:00
parent ec8761f4e8
commit fbc26bb3b8
2 changed files with 6 additions and 2 deletions

View File

@@ -223,7 +223,7 @@ public static class LevelEditor
return SetFloorProp(level, position, new() {
Type = EPropType.SprinklerControl,
SwitchState = EPropSwitchState.Enabled,
LinkedPosition = level.InBounds(linkedValve) && level.GetProp(linkedValve).Type == EPropType.SprinklerValve ? linkedValve : null
LinkedPosition = linkedValve is not null && level.GetProp(linkedValve).Type == EPropType.SprinklerValve ? linkedValve : null
});
}
@@ -238,7 +238,7 @@ public static class LevelEditor
return level;
var unlinkedControl = LevelTraversal.AllPositions(next).FirstOrDefault(candidate => next.GetProp(candidate) is { Type: EPropType.SprinklerControl, LinkedPosition: null });
return next.InBounds(unlinkedControl) && next.GetProp(unlinkedControl).Type == EPropType.SprinklerControl
return unlinkedControl is not null && next.GetProp(unlinkedControl).Type == EPropType.SprinklerControl
? next.SetProp(unlinkedControl, next.GetProp(unlinkedControl) with { LinkedPosition = position })
: next;
}