diff options
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 9 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 6 |
5 files changed, 18 insertions, 17 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index ca9fb578be5..9bc5a397ea5 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -162,9 +162,9 @@ void CreatureAI::TriggerAlert(Unit const* who) const me->SendAIReaction(AI_REACTION_ALERT); // Face the unit (stealthed player) and set distracted state for 5 seconds - me->SetFacingTo(me->GetAngle(who->GetPositionX(), who->GetPositionY()), true); - me->StopMoving(); me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS); + me->StopMoving(); + me->SetFacingTo(me->GetAngle(who)); } void CreatureAI::EnterEvadeMode(EvadeReason why) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d7b72571aa5..375997fe636 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -658,10 +658,10 @@ void Creature::Update(uint32 diff) if (m_suppressedTarget) { if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) - SetFacingToObject(objTarget); + SetFacingToObject(objTarget, false); } else - SetFacingTo(m_suppressedOrientation); + SetFacingTo(m_suppressedOrientation, false); m_shouldReacquireTarget = false; } @@ -3037,10 +3037,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) bool const canTurnDuringCast = !spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); // Face the target - we need to do this before the unit state is modified for no-turn spells if (target) - SetFacingToObject(target); + SetFacingToObject(target, false); else if (!canTurnDuringCast) if (Unit* victim = GetVictim()) - SetFacingToObject(victim); // ensure orientation is correct at beginning of cast + SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast if (!canTurnDuringCast) AddUnitState(UNIT_STATE_CANNOT_TURN); @@ -3086,10 +3086,10 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) if (m_suppressedTarget) { if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) - SetFacingToObject(objTarget); + SetFacingToObject(objTarget, false); } else - SetFacingTo(m_suppressedOrientation); + SetFacingTo(m_suppressedOrientation, false); } else // tell the creature that it should reacquire its actual target after the delay expires (this is handled in ::Update) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f5026a8c799..9f8b3900144 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2090,7 +2090,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr return; // ignore ranged case if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) - SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) + SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) // melee attack spell cast at main hand attack only - no normal melee dmg dealt if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra) @@ -2138,7 +2138,7 @@ void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BA return; // ignore ranged case if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) - SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) + SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) CalcDamageInfo damageInfo; damageInfo.attacker = this; @@ -14189,7 +14189,8 @@ void Unit::SetInFront(WorldObject const* target) void Unit::SetFacingTo(float ori, bool force) { - if (!force && !IsStopped()) + // do not face when already moving + if (!force && (!IsStopped() || !movespline->Finalized())) return; Movement::MoveSplineInit init(this); @@ -14203,7 +14204,7 @@ void Unit::SetFacingTo(float ori, bool force) void Unit::SetFacingToObject(WorldObject const* object, bool force) { // do not face when already moving - if (!force && !IsStopped()) + if (!force && (!IsStopped() || !movespline->Finalized())) return; /// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is. diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 32788df4569..9267c18d4d2 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1649,8 +1649,8 @@ class TC_GAME_API Unit : public WorldObject virtual bool SetHover(bool enable, bool packetOnly = false); void SetInFront(WorldObject const* target); - void SetFacingTo(float ori, bool force = false); - void SetFacingToObject(WorldObject const* object, bool force = false); + void SetFacingTo(float const ori, bool force = true); + void SetFacingToObject(WorldObject const* object, bool force = true); void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference); void SendClearThreatListOpcode(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ed5b54f227d..b45a9702600 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2490,11 +2490,11 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/) if (unitTarget->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING)) return; - unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget)); - unitTarget->ClearUnitState(UNIT_STATE_MOVING); - if (unitTarget->GetTypeId() == TYPEID_UNIT) unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); + + unitTarget->StopMoving(); + unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget)); } void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/) |
