forked from MagicBane/Server
auto update NPC slot location and reload on mesh change for buildings
This commit is contained in:
@@ -12,6 +12,7 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.CityRecord;
|
||||
@@ -394,7 +395,7 @@ public class Building extends AbstractWorldObject {
|
||||
this.rank = newRank;
|
||||
|
||||
// New rank means new mesh
|
||||
|
||||
int oldMeshID = this.meshUUID;
|
||||
newMeshUUID = this.getBlueprint().getMeshForRank(this.rank);
|
||||
this.meshUUID = newMeshUUID;
|
||||
|
||||
@@ -428,6 +429,15 @@ public class Building extends AbstractWorldObject {
|
||||
BuildingManager.cleanupHirelings(this);
|
||||
|
||||
this.isDeranking.compareAndSet(true, false);
|
||||
|
||||
if(oldMeshID != this.meshUUID) {
|
||||
//move NPCs to new slot locations if the mesh was changed and force reload them
|
||||
int index = 0;
|
||||
for (AbstractCharacter hireling : this.hirelings.keySet()) {
|
||||
hireling.setLoc(BuildingManager._slotLocations.get(newMeshUUID).get(index).getLocation());
|
||||
InterestManager.reloadCharacter(hireling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final int getOwnerUUID() {
|
||||
|
||||
Reference in New Issue
Block a user