diff options
Diffstat (limited to 'src/server/game/Entities')
| -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 |
3 files changed, 13 insertions, 12 deletions
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(); |
