From bfc0c57dd8aec4893050f7b9231f1de2f1311218 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 3 Mar 2025 19:56:05 -0600 Subject: [PATCH] simplified mob aI --- src/engine/mobileAI/Behaviours/StandardMob.java | 7 +++++-- src/engine/mobileAI/MobAI.java | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/engine/mobileAI/Behaviours/StandardMob.java b/src/engine/mobileAI/Behaviours/StandardMob.java index ba79649b..d411cb4d 100644 --- a/src/engine/mobileAI/Behaviours/StandardMob.java +++ b/src/engine/mobileAI/Behaviours/StandardMob.java @@ -20,13 +20,17 @@ public class StandardMob { return; } + HashSet inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER); + + if(inRange.isEmpty()) + return; + if (mob.isMoving()) { mob.setLoc(mob.getMovementLoc()); mob.updateLocation(); } if(mob.combatTarget == null) { - HashSet inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER); if (!inRange.isEmpty()) { CheckForAggro(mob); return; @@ -34,7 +38,6 @@ public class StandardMob { }else{ CheckToDropCombatTarget(mob); if(mob.combatTarget == null){ - HashSet inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER); CheckForAggro(mob); return; } diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 86bd5fcb..50b7ee08 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -633,8 +633,10 @@ public class MobAI { break; } if(override){ - if(!mob.isSiege()) + if(!mob.isSiege()) { StandardMob.run(mob); + return; + } } //always check the respawn que, respawn 1 mob max per second to not flood the client