From ca21c3d26650e3b545d7351d728ea0c1aa5fdc10 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 20 Aug 2023 19:07:26 -0400 Subject: [PATCH] dirtyFlag integration. --- src/engine/InterestManagement/InterestManager.java | 14 ++++++++++++++ src/engine/gameManager/BuildingManager.java | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index ead4ee32..79a4cc19 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -565,4 +565,18 @@ public enum InterestManager implements Runnable { Logger.error("InterestManager.updateAllMobilePlayers: " + player.getObjectUUID(), e); } } + + public static void setObjectDirty(AbstractWorldObject abstractWorldObject) { + + HashSet playerList = WorldGrid.getObjectsInRangePartial(abstractWorldObject.getLoc(), 128, MBServerStatics.MASK_PLAYER); + + if (playerList.isEmpty()) + return; + + for (AbstractWorldObject playerObject : playerList) { + + PlayerCharacter playerCharacter = (PlayerCharacter) playerObject; + playerCharacter.dirtyLoad = true; + } + } } \ No newline at end of file diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 6ccb65e6..29952642 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -12,6 +12,7 @@ package engine.gameManager; import engine.Enum; import engine.Enum.BuildingGroup; import engine.Enum.GameObjectType; +import engine.InterestManagement.InterestManager; import engine.InterestManagement.WorldGrid; import engine.job.JobContainer; import engine.job.JobScheduler; @@ -504,7 +505,7 @@ public enum BuildingManager { npc.setObjectTypeMask(MBServerStatics.MASK_NPC); npc.setLoc(npc.bindLoc); - + InterestManager.setObjectDirty(npc); return true; }