From 3f274b1bf8f7b95904b84ed4bca089ab95521429 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 22 Jul 2023 13:24:58 -0500 Subject: [PATCH] region support for teleporting --- src/engine/objects/Regions.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/engine/objects/Regions.java b/src/engine/objects/Regions.java index aa0c363d..0b51baca 100644 --- a/src/engine/objects/Regions.java +++ b/src/engine/objects/Regions.java @@ -275,25 +275,27 @@ public class Regions { //Find building - for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(location, MBServerStatics.STRUCTURE_LOAD_RANGE, MBServerStatics.MASK_BUILDING)) { + for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(location, 128, MBServerStatics.MASK_BUILDING)) { Building building = (Building) awo; if (!Bounds.collide(location, building.getBounds())) continue; - + if(building != null) { + region = BuildingManager.GetRegion(building, location.x, location.y, location.z); + } //find regions that intersect x and z, check if object can enter. - for (Regions toEnter : building.getBounds().getRegions()) { - if (toEnter.isPointInPolygon(location)) { + //for (Regions toEnter : building.getBounds().getRegions()) { + // if (toEnter.isPointInPolygon(location)) { - if (region == null) - region = toEnter; - else // we're using a low level to high level tree structure, database not always in order low to high. + // if (region == null) + // region = toEnter; + // else // we're using a low level to high level tree structure, database not always in order low to high. //check for highest level index. - if (region != null && toEnter.highLerp.y > region.highLerp.y) - region = toEnter; + // if (region != null && toEnter.highLerp.y > region.highLerp.y) + // region = toEnter; - } - } + // } + // } } return region; }