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,14 +9,17 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
{
protected override List<Placement> FilterCandidates(List<Placement> candidates, Module module, Space space)
{
float width = space.rrPlacement.size.x - 1;
float length = space.rrPlacement.size.y - 1;
float width = space.rrPlacement.size.x;
float length = space.rrPlacement.size.y;
candidates.RemoveAll(candidate =>
{
var xRel = candidate.position.x / width;
var zRel = candidate.position.z / length;
var bottomLeft = candidate.BottomLeft;
var center = new Vector2(bottomLeft.x, bottomLeft.z) +
new Vector2(candidate.size.x / 2f, candidate.size.y / 2f);
var xRel = center.x / width;
var zRel = center.y / length;
return candidate.orientation !=
(zRel > xRel
? zRel > 1 - xRel