From 6aff5307c7d48be295ed90312c772ac9fb23a5b8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 7 Nov 2023 12:48:12 -0500 Subject: [PATCH] Update to bake logic --- src/engine/gameManager/BuildingManager.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 99672379..09b77ec4 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -986,13 +986,24 @@ public enum BuildingManager { Path2D.Float stencilPath = new Path2D.Float(); + // Add building offset to vertices + for (Vector2f vertex : meshEntry) - stencilPath.moveTo(vertex.x, vertex.y); + vertex.addLocal(building.getLoc().x, building.getLoc().y); - // enclose the path + // Move to start of path stencilPath.moveTo(meshEntry.get(0).x, meshEntry.get(0).y); + // Draw path + + for (int i = 1; i < meshEntry.size(); i++) + stencilPath.lineTo(meshEntry.get(i).x, meshEntry.get(i).y); + + // enclose the path + + stencilPath.closePath(); + // subtract stencil from zone navmesh Area stencilArea = new Area(stencilPath); @@ -1000,6 +1011,7 @@ public enum BuildingManager { } //add in all the regions to the navMesh + for (Regions region : building.getBounds().getRegions()) building.parentZone.navMesh.add(region.getArea()); }