added barracks list to city object

This commit is contained in:
2023-04-20 21:23:42 -05:00
parent aa8f59f6f7
commit cfe8d20d2b
9 changed files with 231 additions and 397 deletions
+20 -23
View File
@@ -707,43 +707,31 @@ public class Building extends AbstractWorldObject {
if (this.parentZone != null) {
this.parentZone.zoneBuildingSet.remove(this);
if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)){
this.RemoveFromBarracksList();
}
zone.zoneBuildingSet.add(this);
} else
zone.zoneBuildingSet.add(this);
else if (this.parentZone != null)
else if (this.parentZone != null) {
this.parentZone.zoneBuildingSet.remove(this);
if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)){
this.RemoveFromBarracksList();
}
}
if (this.parentZone == null) {
this.parentZone = zone;
this.setLoc(new Vector3fImmutable(this.statLat + zone.absX, this.statAlt + zone.absY, this.statLon + zone.absZ));
} else
this.parentZone = zone;
if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)){
AddToBarracksList();
}
}
//Sets the relative position to a parent zone
public final void setRelPos(Zone zone, float locX, float locY, float locZ) {
//update ZoneManager's zone building list
if (zone != null)
if (this.parentZone != null) {
if (zone.getObjectUUID() != this.parentZone.getObjectUUID()) {
this.parentZone.zoneBuildingSet.remove(this);
zone.zoneBuildingSet.add(this);
}
} else
zone.zoneBuildingSet.add(this);
else if (this.parentZone != null)
this.parentZone.zoneBuildingSet.remove(this);
this.statLat = locX;
this.statAlt = locY;
this.statLon = locZ;
this.parentZone = zone;
}
public float getStatLat() {
return statLat;
}
@@ -1757,4 +1745,13 @@ public class Building extends AbstractWorldObject {
return false;
return this.taxDateTime != null;
}
public void AddToBarracksList(){
City playerCity = ZoneManager.getCityAtLocation(this.loc);
if(playerCity != null){
playerCity.cityBarracks.add(this);
}
}
public void RemoveFromBarracksList(){
}
}
+1
View File
@@ -91,6 +91,7 @@ public class City extends AbstractWorldObject {
public volatile boolean protectionEnforced = true;
private String hash;
public ArrayList<Building>cityBarracks;
/**
* ResultSet Constructor
+1 -1
View File
@@ -1343,7 +1343,7 @@ public class Mob extends AbstractIntelligenceAgent {
}
public boolean canRespawn() {
return System.currentTimeMillis() > this.deathTime;
return System.currentTimeMillis() > this.deathTime + (spawnTime * 1000);
}
@Override