From fd03b263d1349aca58d8d571f4e7bdd60b3ad77f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 23 Jun 2024 20:14:51 -0500 Subject: [PATCH] pets follow owners through teleporting --- src/engine/mobileAI/MobAI.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index dba43220..794dcb6e 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -625,8 +625,8 @@ public class MobAI { //check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting - if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) - CheckToSendMobHome(mob); + + CheckToSendMobHome(mob); return; } @@ -643,14 +643,9 @@ public class MobAI { if (mob.playerAgroMap.isEmpty()) { if(mob.getCombatTarget() != null) mob.setCombatTarget(null); - if(mob.isPet()) - mob.teleport(mob.getOwner().loc); return; } - if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) - CheckToSendMobHome(mob); - if (mob.getCombatTarget() != null) { if (mob.getCombatTarget().isAlive() == false) { @@ -914,6 +909,11 @@ public class MobAI { private static void CheckToSendMobHome(Mob mob) { + if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){ + if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60) + mob.teleport(mob.getOwner().loc); + return; + } try { if (mob.BehaviourType.isAgressive) { @@ -925,9 +925,6 @@ public class MobAI { } } - if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f)) - return; - if (mob.isPlayerGuard() && !mob.despawned) { City current = ZoneManager.getCityAtLocation(mob.getLoc());