From c374984445290c6aa333018a093bdec3f4ec000a Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Sat, 7 Dec 2024 18:06:48 -0300 Subject: [PATCH] Fix monter follow creature --- src/monster.cpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 7ebaa59f80..49ce6902de 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -584,26 +584,31 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - if (!isSummon()) { - Direction dir = DIRECTION_NONE; - - if (isFleeing()) { - getDistanceStep(followCreature->getPosition(), dir, true); - } else if (fpp.maxTargetDist > 1) { - if (!getDistanceStep(followCreature->getPosition(), dir)) { - // if we can't get anything then let the A* calculate - updateFollowCreaturePath(fpp); - return; - } - } + if (isSummon()) { + // summon must follow the orders of master. + updateFollowCreaturePath(fpp); + onFollowCreatureComplete(); + return; + } - if (dir != DIRECTION_NONE) { - listWalkDir.clear(); - listWalkDir.push_back(dir); + auto dir = DIRECTION_NONE; - hasFollowPath = true; - startAutoWalk(); + if (isFleeing()) { + getDistanceStep(followCreature->getPosition(), dir, true); + } else if (fpp.maxTargetDist > 1) { + if (!getDistanceStep(followCreature->getPosition(), dir)) { + // if we can't get anything then let the A* calculate + updateFollowCreaturePath(fpp); + return; } + } + + if (dir != DIRECTION_NONE) { + listWalkDir.clear(); + listWalkDir.push_back(dir); + + hasFollowPath = true; + startAutoWalk(); } else { updateFollowCreaturePath(fpp); }