Browse Source

value is halfExtent

combat-2
MagicBot 1 year ago
parent
commit
8ece4caf1c
  1. 6
      src/engine/Enum.java
  2. 4
      src/engine/InterestManagement/HeightMap.java
  3. 2
      src/engine/gameManager/ZoneManager.java
  4. 2
      src/engine/mobileAI/utilities/MovementUtilities.java
  5. 2
      src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java
  6. 4
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java
  7. 4
      src/engine/objects/Building.java
  8. 6
      src/engine/objects/City.java
  9. 12
      src/engine/objects/Zone.java

6
src/engine/Enum.java

@ -2310,10 +2310,10 @@ public class Enum { @@ -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;
}
}

4
src/engine/InterestManagement/HeightMap.java

@ -119,8 +119,8 @@ public class HeightMap { @@ -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;

2
src/engine/gameManager/ZoneManager.java

@ -411,7 +411,7 @@ public enum ZoneManager { @@ -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();

2
src/engine/mobileAI/utilities/MovementUtilities.java

@ -51,7 +51,7 @@ public class MovementUtilities { @@ -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));
}
}

2
src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java

@ -117,7 +117,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { @@ -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;

4
src/engine/net/client/handlers/PlaceAssetMsgHandler.java

@ -661,7 +661,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { @@ -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 { @@ -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);

4
src/engine/objects/Building.java

@ -446,14 +446,14 @@ public class Building extends AbstractWorldObject { @@ -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();
}
}

6
src/engine/objects/City.java

@ -583,7 +583,7 @@ public class City extends AbstractWorldObject { @@ -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 { @@ -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 { @@ -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) {

12
src/engine/objects/Zone.java

@ -116,8 +116,8 @@ public class Zone extends AbstractGameObject { @@ -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 { @@ -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 { @@ -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 { @@ -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);
}
}

Loading…
Cancel
Save