Skip to content

Commit

Permalink
Core/AI: Fully move react state check from CreatureUnitRelocationWork…
Browse files Browse the repository at this point in the history
…er to CreatureAI::MoveInLineOfSight. This means that AI for passive/defensive creatures can now once again use MoveInLineOfSight (and fixes that weird thing where triggers decided it would be funny to attack players).

(cherry picked from commit 8e6fb3b)
  • Loading branch information
Treeston authored and Shauren committed Apr 5, 2016
1 parent 9d48229 commit 845f81d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/game/AI/CreatureAI.cpp
Expand Up @@ -133,7 +133,7 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) // non-combat pets should just stand there and look good;)
return;

if (me->CanStartAttack(who, false))
if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who, false))
AttackStart(who);
//else if (who->GetVictim() && me->IsFriendlyTo(who)
// && me->IsWithinDistInMap(who, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Grids/Notifiers/GridNotifiers.cpp
Expand Up @@ -131,7 +131,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
if (!u->IsAlive() || !c->IsAlive() || c == u || u->IsInFlight())
return;

if ((c->HasReactState(REACT_AGGRESSIVE) || c->IsTrigger()) && !c->HasUnitState(UNIT_STATE_SIGHTLESS))
if (!c->HasUnitState(UNIT_STATE_SIGHTLESS))
{
if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true))
c->AI()->MoveInLineOfSight_Safe(u);
Expand Down

0 comments on commit 845f81d

Please sign in to comment.