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 {
ZONE(875), ZONE(875),
PLACEMENT(876); PLACEMENT(876);
public final float extents; public final float halfExtents;
CityBoundsType(float extents) { CityBoundsType(float halfExtents) {
this.extents = extents; this.halfExtents = halfExtents;
} }
} }

4
src/engine/InterestManagement/HeightMap.java

@ -119,8 +119,8 @@ public class HeightMap {
this.heightMapID = 999999; this.heightMapID = 999999;
this.maxHeight = 5; // for real... this.maxHeight = 5; // for real...
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents; int halfExtentsX = (int) Enum.CityBoundsType.ZONE.halfExtents;
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents; int halfExtentsY = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.zoneLoadID = 0; this.zoneLoadID = 0;
this.seaLevel = 0; this.seaLevel = 0;

2
src/engine/gameManager/ZoneManager.java

@ -411,7 +411,7 @@ public enum ZoneManager {
treeBounds = Bounds.borrow(); 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(); zoneList = currentZone.getNodes();

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

@ -51,7 +51,7 @@ public class MovementUtilities {
//Guards recall distance = 814. //Guards recall distance = 814.
if (tol != null) { 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 {
dispatch = Dispatch.borrow(sourcePlayer, gtsm); dispatch = Dispatch.borrow(sourcePlayer, gtsm);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); 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); DispatchMessage.dispatchMsgToAll(czm);
break; break;

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

@ -661,7 +661,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if (!building.getBlueprint().isSiegeEquip()) if (!building.getBlueprint().isSiegeEquip())
continue; continue;
if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.extents)) if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.halfExtents))
continue; continue;
if (building.getGuild() == null) if (building.getGuild() == null)
@ -807,7 +807,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Update guild binds and tags // Update guild binds and tags
//load the new city on the clients //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); DispatchMessage.dispatchMsgToAll(czm);
GuildManager.updateAllGuildBinds(playerNation, cityObject); GuildManager.updateAllGuildBinds(playerNation, cityObject);

4
src/engine/objects/Building.java

@ -446,14 +446,14 @@ public class Building extends AbstractWorldObject {
if (this.getBlueprint() != null && this.getBlueprint().isSiegeEquip() && this.protectionState.equals(ProtectionState.PROTECTED)) { if (this.getBlueprint() != null && this.getBlueprint().isSiegeEquip() && this.protectionState.equals(ProtectionState.PROTECTED)) {
if (this.getGuild() != null) { if (this.getGuild() != null) {
if (this.getGuild().getOwnedCity() != 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(); return this.getGuild().getOwnedCity();
} else { } else {
Bane bane = Bane.getBaneByAttackerGuild(this.getGuild()); Bane bane = Bane.getBaneByAttackerGuild(this.getGuild());
if (bane != null) { if (bane != null) {
if (bane.getCity() != 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(); return bane.getCity();
} }
} }

6
src/engine/objects/City.java

@ -583,7 +583,7 @@ public class City extends AbstractWorldObject {
Bounds cityBounds = Bounds.borrow(); 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. 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); 0.0f);
this.setBounds(cityBounds); this.setBounds(cityBounds);
@ -869,7 +869,7 @@ public class City extends AbstractWorldObject {
public boolean isLocationWithinSiegeBounds(Vector3fImmutable insideLoc) { 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 // 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<>(); currentMemory = new HashSet<>();
for (AbstractWorldObject playerObject : currentPlayers) { for (AbstractWorldObject playerObject : currentPlayers) {

12
src/engine/objects/Zone.java

@ -116,8 +116,8 @@ public class Zone extends AbstractGameObject {
if (zone.playerCityID > 0) { if (zone.playerCityID > 0) {
writer.put((byte) 1); // Player City - True writer.put((byte) 1); // Player City - True
writer.putFloat(Enum.CityBoundsType.ZONE.extents); writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
writer.putFloat(Enum.CityBoundsType.ZONE.extents); writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
} else } else
writer.put((byte) 0); // Player City - False writer.put((byte) 0); // Player City - False
@ -173,7 +173,7 @@ public class Zone extends AbstractGameObject {
// Player cities are assigned default value // Player cities are assigned default value
if (this.loadNum == 0) { 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; return;
} }
@ -184,7 +184,7 @@ public class Zone extends AbstractGameObject {
if (zoneSize != null) if (zoneSize != null)
this.bounds.setBounds(new Vector2f(this.absX, this.absZ), zoneSize, 0.0f); this.bounds.setBounds(new Vector2f(this.absX, this.absZ), zoneSize, 0.0f);
else 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(); HeightMap heightMap = this.getHeightMap();
@ -197,8 +197,8 @@ public class Zone extends AbstractGameObject {
this.minBlend = Bounds.borrow(); this.minBlend = Bounds.borrow();
this.maxBlend = 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.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.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 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