system enabled

This commit is contained in:
2023-10-26 20:04:11 -05:00
parent 7af63d1519
commit 136c8c4756
6 changed files with 153 additions and 45 deletions
+10 -24
View File
@@ -270,32 +270,18 @@ public class Regions {
return BuildingManager.getBuildingFromCache(region.parentBuildingID);
}
public static Regions GetRegionForTeleport(Vector3fImmutable location) {
public static Regions getRegionAtLocation(Vector3fImmutable location) {
Regions region = null;
//Find 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);
Building building = BuildingManager.getBuildingAtLocation(location);
if(building != null) {
//look for region in the building we are in
for (Regions regionCycle : building.getBounds().getRegions()) {
float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y;
if(regionHeight < 10)
regionHeight = 10;
if (regionCycle.isPointInPolygon(location) && Math.abs(regionCycle.highLerp.y - location.y) < regionHeight)
region = regionCycle;
}
//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;
}