forked from MagicBane/Server
value is halfExtent
This commit is contained in:
@@ -2310,10 +2310,10 @@ public class Enum {
|
||||
ZONE(875),
|
||||
PLACEMENT(876);
|
||||
|
||||
public final float extents;
|
||||
public final float halfExtents;
|
||||
|
||||
CityBoundsType(float extents) {
|
||||
this.extents = extents;
|
||||
CityBoundsType(float halfExtents) {
|
||||
this.halfExtents = halfExtents;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@ public class HeightMap {
|
||||
|
||||
this.heightMapID = 999999;
|
||||
this.maxHeight = 5; // for real...
|
||||
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents;
|
||||
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents;
|
||||
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||
this.zoneLoadID = 0;
|
||||
this.seaLevel = 0;
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ public enum ZoneManager {
|
||||
|
||||
|
||||
treeBounds = Bounds.borrow();
|
||||
treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.extents, Enum.CityBoundsType.PLACEMENT.extents), 0.0f);
|
||||
treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.halfExtents, Enum.CityBoundsType.PLACEMENT.halfExtents), 0.0f);
|
||||
|
||||
zoneList = currentZone.getNodes();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MovementUtilities {
|
||||
|
||||
//Guards recall distance = 814.
|
||||
if (tol != null) {
|
||||
return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.extents));
|
||||
return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.halfExtents));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
||||
dispatch = Dispatch.borrow(sourcePlayer, gtsm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents);
|
||||
CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents);
|
||||
DispatchMessage.dispatchMsgToAll(czm);
|
||||
|
||||
break;
|
||||
|
||||
@@ -661,7 +661,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
if (!building.getBlueprint().isSiegeEquip())
|
||||
continue;
|
||||
|
||||
if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.extents))
|
||||
if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.halfExtents))
|
||||
continue;
|
||||
|
||||
if (building.getGuild() == null)
|
||||
@@ -807,7 +807,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Update guild binds and tags
|
||||
//load the new city on the clients
|
||||
|
||||
CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents);
|
||||
CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents);
|
||||
DispatchMessage.dispatchMsgToAll(czm);
|
||||
|
||||
GuildManager.updateAllGuildBinds(playerNation, cityObject);
|
||||
|
||||
@@ -446,14 +446,14 @@ public class Building extends AbstractWorldObject {
|
||||
if (this.getBlueprint() != null && this.getBlueprint().isSiegeEquip() && this.protectionState.equals(ProtectionState.PROTECTED)) {
|
||||
if (this.getGuild() != null) {
|
||||
if (this.getGuild().getOwnedCity() != null) {
|
||||
if (this.getLoc().isInsideCircle(this.getGuild().getOwnedCity().getLoc(), CityBoundsType.ZONE.extents))
|
||||
if (this.getLoc().isInsideCircle(this.getGuild().getOwnedCity().getLoc(), CityBoundsType.ZONE.halfExtents))
|
||||
return this.getGuild().getOwnedCity();
|
||||
} else {
|
||||
Bane bane = Bane.getBaneByAttackerGuild(this.getGuild());
|
||||
|
||||
if (bane != null) {
|
||||
if (bane.getCity() != null) {
|
||||
if (this.getLoc().isInsideCircle(bane.getCity().getLoc(), CityBoundsType.ZONE.extents))
|
||||
if (this.getLoc().isInsideCircle(bane.getCity().getLoc(), CityBoundsType.ZONE.halfExtents))
|
||||
return bane.getCity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
Bounds cityBounds = Bounds.borrow();
|
||||
cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city.
|
||||
new Vector2f(Enum.CityBoundsType.GRID.extents, Enum.CityBoundsType.GRID.extents),
|
||||
new Vector2f(Enum.CityBoundsType.GRID.halfExtents, Enum.CityBoundsType.GRID.halfExtents),
|
||||
0.0f);
|
||||
this.setBounds(cityBounds);
|
||||
|
||||
@@ -869,7 +869,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
public boolean isLocationWithinSiegeBounds(Vector3fImmutable insideLoc) {
|
||||
|
||||
return insideLoc.isInsideCircle(this.getLoc(), CityBoundsType.ZONE.extents);
|
||||
return insideLoc.isInsideCircle(this.getLoc(), CityBoundsType.ZONE.halfExtents);
|
||||
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
// Gather current list of players within the zone bounds
|
||||
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER);
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.halfExtents, MBServerStatics.MASK_PLAYER);
|
||||
currentMemory = new HashSet<>();
|
||||
|
||||
for (AbstractWorldObject playerObject : currentPlayers) {
|
||||
|
||||
@@ -116,8 +116,8 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
if (zone.playerCityID > 0) {
|
||||
writer.put((byte) 1); // Player City - True
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
||||
} else
|
||||
writer.put((byte) 0); // Player City - False
|
||||
|
||||
@@ -173,7 +173,7 @@ public class Zone extends AbstractGameObject {
|
||||
// Player cities are assigned default value
|
||||
|
||||
if (this.loadNum == 0) {
|
||||
bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f);
|
||||
bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents), 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class Zone extends AbstractGameObject {
|
||||
if (zoneSize != null)
|
||||
this.bounds.setBounds(new Vector2f(this.absX, this.absZ), zoneSize, 0.0f);
|
||||
else
|
||||
bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f);
|
||||
bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents), 0.0f);
|
||||
|
||||
HeightMap heightMap = this.getHeightMap();
|
||||
|
||||
@@ -197,8 +197,8 @@ public class Zone extends AbstractGameObject {
|
||||
this.minBlend = Bounds.borrow();
|
||||
this.maxBlend = Bounds.borrow();
|
||||
|
||||
this.minBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
|
||||
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f);
|
||||
this.minBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
|
||||
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user