Browse Source

region support for teleporting

master
FatBoy-DOTC 1 year ago
parent
commit
3f274b1bf8
  1. 24
      src/engine/objects/Regions.java

24
src/engine/objects/Regions.java

@ -275,25 +275,27 @@ public class Regions {
//Find building //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; Building building = (Building) awo;
if (!Bounds.collide(location, building.getBounds())) if (!Bounds.collide(location, building.getBounds()))
continue; 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. //find regions that intersect x and z, check if object can enter.
for (Regions toEnter : building.getBounds().getRegions()) { //for (Regions toEnter : building.getBounds().getRegions()) {
if (toEnter.isPointInPolygon(location)) { // if (toEnter.isPointInPolygon(location)) {
if (region == null) // if (region == null)
region = toEnter; // region = toEnter;
else // we're using a low level to high level tree structure, database not always in order low to high. // 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. //check for highest level index.
if (region != null && toEnter.highLerp.y > region.highLerp.y) // if (region != null && toEnter.highLerp.y > region.highLerp.y)
region = toEnter; // region = toEnter;
} // }
} // }
} }
return region; return region;
} }

Loading…
Cancel
Save