mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-17 21:50:50 -04:00
Core/Position: Refactor GetAngle -> GetAbsoluteAngle because code clarity is good.
(cherry picked from commit 4692e10ca2)
This commit is contained in:
@@ -590,19 +590,6 @@ bool Unit::IsWithinBoundaryRadius(const Unit* obj) const
|
||||
return IsInDist(obj, objBoundaryRadius);
|
||||
}
|
||||
|
||||
void Unit::GetRandomContactPoint(Unit const* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
|
||||
{
|
||||
float combat_reach = GetCombatReach();
|
||||
if (combat_reach < 0.1f) // sometimes bugged for players
|
||||
combat_reach = DEFAULT_PLAYER_COMBAT_REACH;
|
||||
|
||||
uint32 attacker_number = uint32(getAttackers().size());
|
||||
if (attacker_number > 0)
|
||||
--attacker_number;
|
||||
GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin) * (float)rand_norm(),
|
||||
GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI/2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
|
||||
}
|
||||
|
||||
void Unit::SetVisibleAura(AuraApplication* aurApp)
|
||||
{
|
||||
m_visibleAuras.insert(aurApp);
|
||||
@@ -11727,7 +11714,7 @@ void Unit::JumpTo(WorldObject* obj, float speedZ, bool withOrientation)
|
||||
float x, y, z;
|
||||
obj->GetContactPoint(this, x, y, z);
|
||||
float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
|
||||
GetMotionMaster()->MoveJump(x, y, z, GetAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation);
|
||||
GetMotionMaster()->MoveJump(x, y, z, GetAbsoluteAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation);
|
||||
}
|
||||
|
||||
void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
|
||||
@@ -12302,7 +12289,7 @@ bool CharmInfo::IsReturning()
|
||||
void Unit::SetInFront(WorldObject const* target)
|
||||
{
|
||||
if (!HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
SetOrientation(GetAngle(target));
|
||||
SetOrientation(GetAbsoluteAngle(target));
|
||||
}
|
||||
|
||||
void Unit::SetFacingTo(float ori, bool force)
|
||||
@@ -12328,7 +12315,7 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force)
|
||||
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
|
||||
init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
|
||||
init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user