From d72b741fbf6ad5e8ade1bd82c9705ce13a1085f6 Mon Sep 17 00:00:00 2001 From: acidmanifesto Date: Mon, 25 Oct 2021 04:16:24 -0400 Subject: [PATCH] feat(Core): CreatureUnitRelocationWorker reworked (#8672) This is further support of void MoveInLineOfSight(Unit* who) override of creature AIs. Currently before this PR, src scripted creatures of void MoveInLineOfSight(Unit* who) override would only follow void MoveInLineOfSight(Unit* who) override if they were hostile and nothing else. With this PR we create it with any aggression stance\faction stance, which will open up while improving upon only the future scripting of the core. - Ellminates restricting HasReactState(REACT_AGGRESSIVE) only to requirements of creatures to use void MoveInLineOfSight(Unit* who) override to having no React State requirements. --- src/server/game/Grids/Notifiers/GridNotifiers.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index e7884b27b..6e0099335 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -150,18 +150,19 @@ void VisibleChangesNotifier::Visit(DynamicObjectMapType& m) inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) { if (!u->IsAlive() || !c->IsAlive() || c == u || u->IsInFlight()) + { return; + } - if (c->HasReactState(REACT_AGGRESSIVE) && !c->HasUnitState(UNIT_STATE_SIGHTLESS)) + if (!c->HasUnitState(UNIT_STATE_SIGHTLESS)) { if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true)) { c->AI()->MoveInLineOfSight_Safe(u); } - else + else if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true)) { - if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true)) - c->AI()->TriggerAlert(u); + c->AI()->TriggerAlert(u); } } }