AI/SmartAI: Fix an issue where SmartAI creatures would not properly follow their owner on evade. Also fix a bug where creatures with INHABIT_ROOT would get stuck in evade under certain conditions.
This allows us to fix quest 12261 (No Place to Run). Closes #16291.
This commit is contained in:
1 parent
2afb2131c5
commit
2e896a15dd
3 files changed
+15
-5
No files matched your search
@@ -0,0 +1,4 @@
|
||||
-- Fix SAI for quest "No Place to Run" (issue #16291)
|
||||
UPDATE `creature_template` SET `unit_flags`=`unit_flags`&~0x4 WHERE `entry`=27430;
|
||||
UPDATE `smart_scripts` SET `event_flags`=`event_flags`|0x200 WHERE `entryorguid`=2743000 AND `source_type`=9;
|
||||
UPDATE `smart_scripts` SET `event_type`=54,`comment`="Destructive Ward - On Just Summoned - Run Script" WHERE `entryorguid`=27430 AND `id`=0;
|
||||
@@ -449,14 +449,17 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||
AddEscortState(SMART_ESCORT_RETURNING);
|
||||
ReturnToLastOOCPos();
|
||||
}
|
||||
else if (mFollowGuid)
|
||||
else if (Unit* target = mFollowGuid ? ObjectAccessor::GetUnit(*me, mFollowGuid) : nullptr)
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
// evade is not cleared in MoveFollow, so we can't keep it
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
me->GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
|
||||
@@ -44,7 +44,10 @@ void HomeMovementGenerator<Creature>::DoReset(Creature*) { }
|
||||
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature* owner)
|
||||
{
|
||||
if (owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||
{ // if we are ROOT/STUNNED/DISTRACTED even after aura clear, immediately finalize - otherwise we would get stuck in evade
|
||||
arrived = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
float x, y, z, o;
|
||||
@@ -65,6 +68,6 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature* owner)
|
||||
|
||||
bool HomeMovementGenerator<Creature>::DoUpdate(Creature* owner, const uint32 /*time_diff*/)
|
||||
{
|
||||
arrived = owner->movespline->Finalized();
|
||||
arrived = arrived || owner->movespline->Finalized();
|
||||
return !arrived;
|
||||
}
|
||||
Reference in new issue
Block a user