Core/Units: renamed SetInFront to SetOrientationTowards to clarify its actual functionality and added comments to SetOrientationTowards, SetFacingTo and SetFacingToObject
This commit is contained in:
1 parent
0a480f3ae8
commit
c9afa1a6ed
13 files changed
+21
-23
No files matched your search
@@ -472,14 +472,14 @@ void Unit::Update(uint32 p_time)
|
||||
ObjectGuid const channelGuid = GetChannelObjectGuid();
|
||||
if (!channelGuid.IsEmpty() && channelGuid != GetGUID())
|
||||
if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*this, channelGuid))
|
||||
SetOrientation(GetAngle(objectTarget)); // use SetOrientation instead of SetInFront because channeling may apply no turn unit states.
|
||||
SetOrientationTowards(objectTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjectGuid const targetGuid = GetTarget();
|
||||
if (!targetGuid.IsEmpty() && targetGuid != GetGUID())
|
||||
if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*this, targetGuid))
|
||||
SetInFront(objectTarget);
|
||||
SetOrientationTowards(objectTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13948,10 +13948,9 @@ bool CharmInfo::IsReturning()
|
||||
return _isReturning;
|
||||
}
|
||||
|
||||
void Unit::SetInFront(WorldObject const* target)
|
||||
void Unit::SetOrientationTowards(WorldObject const* target)
|
||||
{
|
||||
if (!HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
SetOrientation(GetAngle(target));
|
||||
SetOrientation(GetAngle(target));
|
||||
}
|
||||
|
||||
void Unit::SetFacingTo(float ori, bool force)
|
||||
|
||||
@@ -1365,8 +1365,11 @@ class TC_GAME_API Unit : public WorldObject
|
||||
bool SetFeatherFall(bool enable, bool packetOnly = false);
|
||||
virtual bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true);
|
||||
|
||||
void SetInFront(WorldObject const* target);
|
||||
// Sets the internal orientation value to face the provided target. Does NOT have clientside effects.
|
||||
void SetOrientationTowards(WorldObject const* target);
|
||||
// Launches a spline to face the given orientation.
|
||||
void SetFacingTo(float const ori, bool force = true);
|
||||
// Launches a spline to face the given object
|
||||
void SetFacingToObject(WorldObject const* object, bool force = true);
|
||||
|
||||
bool IsAlive() const { return (m_deathState == ALIVE); }
|
||||
|
||||
@@ -345,13 +345,13 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
{
|
||||
if (unit_target)
|
||||
{
|
||||
pet->SetInFront(unit_target);
|
||||
pet->SetOrientationTowards(unit_target);
|
||||
if (Player* player = unit_target->ToPlayer())
|
||||
pet->SendUpdateToPlayer(player);
|
||||
}
|
||||
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
|
||||
{
|
||||
pet->SetInFront(unit_target2);
|
||||
pet->SetOrientationTowards(unit_target2);
|
||||
if (Player* player = unit_target2->ToPlayer())
|
||||
pet->SendUpdateToPlayer(player);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ bool ChaseMovementGenerator::Update(Unit* owner, uint32 diff)
|
||||
if (Creature* cOwner = owner->ToCreature())
|
||||
cOwner->SetCannotReachTarget(false);
|
||||
|
||||
owner->SetInFront(target);
|
||||
owner->ClearUnitState(UNIT_STATE_CHASE_MOVE);
|
||||
DoMovementInform(owner, target);
|
||||
return true;
|
||||
|
||||
@@ -40,9 +40,6 @@ void RotateMovementGenerator::Initialize(Unit* owner)
|
||||
if (!owner->IsStopped())
|
||||
owner->StopMoving();
|
||||
|
||||
if (owner->GetVictim())
|
||||
owner->SetInFront(owner->GetVictim());
|
||||
|
||||
owner->AddUnitState(UNIT_STATE_ROTATING);
|
||||
owner->AttackStop();
|
||||
}
|
||||
|
||||
@@ -197,8 +197,8 @@ public:
|
||||
++IntroPhase;
|
||||
break;
|
||||
case 1:
|
||||
me->SetInFront(Madrigosa);
|
||||
Madrigosa->SetInFront(me);
|
||||
me->SetOrientationTowards(Madrigosa);
|
||||
Madrigosa->SetOrientationTowards(me);
|
||||
Madrigosa->AI()->Talk(YELL_MADR_INTRO, me);
|
||||
IntroPhaseTimer = 9000;
|
||||
++IntroPhase;
|
||||
|
||||
@@ -551,7 +551,7 @@ class spell_alysrazor_turn_monstrosity : public SpellScriptLoader
|
||||
float angle = 0.0f;
|
||||
if (Unit* bird = GetCaster()->GetVehicleBase())
|
||||
{
|
||||
bird->SetInFront(GetHitUnit());
|
||||
bird->SetOrientationTowards(GetHitUnit());
|
||||
angle = bird->GetOrientation();
|
||||
}
|
||||
|
||||
|
||||
@@ -532,8 +532,8 @@ public:
|
||||
return 1000;
|
||||
case 2:
|
||||
Talk(GEEZLE_SAY_1, Spark);
|
||||
Spark->SetInFront(me);
|
||||
me->SetInFront(Spark);
|
||||
Spark->SetOrientationTowards(me);
|
||||
me->SetOrientationTowards(Spark);
|
||||
return 5000;
|
||||
case 3:
|
||||
Spark->AI()->Talk(SPARK_SAY_2);
|
||||
|
||||
@@ -2505,7 +2505,7 @@ class spell_mimiron_summon_flames_spread : public SpellScriptLoader
|
||||
|
||||
void OnHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->SetInFront(GetHitUnit());
|
||||
GetCaster()->SetOrientationTowards(GetHitUnit());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -960,7 +960,7 @@ public:
|
||||
case 8:
|
||||
if (arthas && talbot)
|
||||
{
|
||||
arthas->SetInFront(me); //The client doesen't update with the new orientation :l
|
||||
arthas->SetOrientationTowards(me); //The client doesen't update with the new orientation :l
|
||||
talbot->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
arthas->AI()->Talk(SAY_LICH_2);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public:
|
||||
void LockRageclaw(Creature* rageclaw)
|
||||
{
|
||||
// pointer check not needed
|
||||
me->SetInFront(rageclaw);
|
||||
rageclaw->SetInFront(me);
|
||||
me->SetOrientationTowards(rageclaw);
|
||||
rageclaw->SetOrientationTowards(me);
|
||||
|
||||
DoCast(rageclaw, SPELL_LEFT_CHAIN, true);
|
||||
DoCast(rageclaw, SPELL_RIGHT_CHAIN, true);
|
||||
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
player->GroupEventHappens(ESCAPE_FROM_FIREWING_POINT_A, me);
|
||||
else if (player->GetTeam() == HORDE)
|
||||
player->GroupEventHappens(ESCAPE_FROM_FIREWING_POINT_H, me);
|
||||
me->SetInFront(player);
|
||||
me->SetOrientationTowards(player);
|
||||
break;
|
||||
case 30:
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);
|
||||
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
{
|
||||
if (me->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()) && me->IsWithinDistInMap(player, 30.0f))
|
||||
{
|
||||
me->SetInFront(player);
|
||||
me->SetOrientationTowards(player);
|
||||
Active = false;
|
||||
|
||||
switch (emote)
|
||||
|
||||
Reference in new issue
Block a user