Fix editor link validation regressions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user