diff options
| author | treeston <treeston.mmoc@gmail.com> | 2016-09-20 20:19:15 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-03-02 20:47:29 +0100 |
| commit | 205ec4c3bf26d74fefa2452baae714c56d956956 (patch) | |
| tree | 0841a7c4bcf3e13bfa6df282520898960b9009f5 /src/server/game/Entities | |
| parent | b94642fb49305192f44387e520d1410b1552094f (diff) | |
Core/Unit: Standardize SetFacingTo and SetFacingToObject behavior while moving. Both now fail while moving unless arg2 bool is true.
Movement/SplineChain: Bump value range for DB chainId up to uint16 (0 to 65535) from uint8 (0 to 255). Turns out sniffs generate far more chains than I expected.
(cherry picked from commit 2170541a51ced3c15675b8854e0ae49461884f8c)
Code style follow-up, I blame Notepad++.
(cherry picked from commit 7860da0de6e53c7740862cae18840c9d399dda7f)
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 6 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 11 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 958d97e785e..cbb026fb665 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2800,10 +2800,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) bool canTurnDuringCast = !focusSpell->GetSpellInfo()->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) - SetFacingTo(GetAngle(target)); + SetFacingToObject(target); else if (!canTurnDuringCast) if (Unit* victim = GetVictim()) - SetFacingTo(GetAngle(victim)); // ensure orientation is correct at beginning of cast + SetFacingToObject(victim); // ensure orientation is correct at beginning of cast if (!canTurnDuringCast) AddUnitState(UNIT_STATE_CANNOT_TURN); @@ -2849,7 +2849,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) if (!m_suppressedTarget.IsEmpty()) { if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) - SetFacingTo(GetAngle(objTarget)); + SetFacingToObject(objTarget); } else SetFacingTo(m_suppressedOrientation); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bd104032a10..6ea885e8d78 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15271,8 +15271,11 @@ void Unit::SetInFront(WorldObject const* target) SetOrientation(GetAngle(target)); } -void Unit::SetFacingTo(float ori) +void Unit::SetFacingTo(float ori, bool force) { + if (!force && !IsStopped()) + return; + Movement::MoveSplineInit init(this); init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false); if (GetTransport()) @@ -15281,10 +15284,10 @@ void Unit::SetFacingTo(float ori) init.Launch(); } -void Unit::SetFacingToObject(WorldObject const* object) +void Unit::SetFacingToObject(WorldObject const* object, bool force) { - // never face when already moving - if (!IsStopped()) + // do not face when already moving + if (!force && !IsStopped()) 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 054db0ef5eb..0337939cdbe 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1711,8 +1711,8 @@ class TC_GAME_API Unit : public WorldObject void SendSetVehicleRecId(uint32 vehicleId); void SetInFront(WorldObject const* target); - void SetFacingTo(float ori); - void SetFacingToObject(WorldObject const* object); + void SetFacingTo(float ori, bool force = false); + void SetFacingToObject(WorldObject const* object, bool force = false); void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference); void SendClearThreatListOpcode(); |
