handle modules larger than 1x1, widen door size to allow walking around it

This commit is contained in:
2022-11-24 19:32:51 +01:00
parent 74fd757d20
commit 2eec53fe87
11 changed files with 649 additions and 43 deletions

View File

@@ -9,10 +9,22 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
{
protected override List<Placement> FilterCandidates(List<Placement> candidates, Module module, Space space)
{
space.AllModules.ForEach(other =>
{
candidates.RemoveAll(candidate => candidate.position.Equals(other.SrPosition));
});
space.AllModules.ForEach(other => // for all other module ...
other.srPlacement.ForEachPosition(otherPosition => // ... positions ...
candidates.RemoveAll(candidate => // ... remove every candidate that ...
{
var remove = false;
candidate.ForEachPosition(position => // ... anywhere inside its bounds ...
{
if (!remove)
{
remove = position.Equals(otherPosition); // ... overlaps with other modules' position
}
});
return remove;
})));
return candidates;
}