forked from MagicBane/Server
region support for teleporting
This commit is contained in:
@@ -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) {
|
||||||
//find regions that intersect x and z, check if object can enter.
|
region = BuildingManager.GetRegion(building, location.x, location.y, location.z);
|
||||||
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.
|
|
||||||
//check for highest level index.
|
|
||||||
if (region != null && toEnter.highLerp.y > region.highLerp.y)
|
|
||||||
region = toEnter;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//find regions that intersect x and z, check if object can enter.
|
||||||
|
//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.
|
||||||
|
//check for highest level index.
|
||||||
|
// if (region != null && toEnter.highLerp.y > region.highLerp.y)
|
||||||
|
// region = toEnter;
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user