forked from MagicBane/Server
building and region lookup completed
This commit is contained in:
@@ -949,7 +949,7 @@ public enum BuildingManager {
|
||||
building.isDeranking.compareAndSet(true, false);
|
||||
}
|
||||
public static Building getBuildingAtLocation(Vector3fImmutable loc){
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc,128,MBServerStatics.MASK_BUILDING)){
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc,64,MBServerStatics.MASK_BUILDING)){
|
||||
Building building = (Building)awo;
|
||||
if(building == null)
|
||||
continue;
|
||||
@@ -958,7 +958,9 @@ public enum BuildingManager {
|
||||
float minZ = building.loc.z - building.getBounds().getHalfExtents().y;
|
||||
float maxZ = building.loc.z + building.getBounds().getHalfExtents().y;
|
||||
|
||||
if(loc.x > minX && loc.x < maxX && loc.z > minZ && loc.x < maxZ)
|
||||
boolean meetsX = loc.x > minX && loc.x < maxX;
|
||||
boolean meetsY = loc.z > minZ && loc.z < maxZ;
|
||||
if(meetsX && meetsY)
|
||||
return building;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user