mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Entities/Unit: Add overload to NearTeleportTo taking Position const&.
This commit is contained in:
@@ -348,6 +348,9 @@ class WorldLocation : public Position
|
||||
explicit WorldLocation(uint32 _mapId = MAPID_INVALID, float _x = 0.f, float _y = 0.f, float _z = 0.f, float _o = 0.f)
|
||||
: Position(_x, _y, _z, _o), m_mapId(_mapId) { }
|
||||
|
||||
WorldLocation(uint32 mapId, Position const& position)
|
||||
: Position(position), m_mapId(mapId) { }
|
||||
|
||||
WorldLocation(WorldLocation const& loc)
|
||||
: Position(loc), m_mapId(loc.GetMapId()) { }
|
||||
|
||||
|
||||
@@ -15876,16 +15876,18 @@ bool Unit::IsFalling() const
|
||||
return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR) || movespline->isFalling();
|
||||
}
|
||||
|
||||
void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/)
|
||||
void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
|
||||
{
|
||||
DisableSpline();
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
|
||||
{
|
||||
WorldLocation target(GetMapId(), pos);
|
||||
ToPlayer()->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Position pos = {x, y, z, orientation};
|
||||
SendTeleportPacket(pos);
|
||||
UpdatePosition(x, y, z, orientation, true);
|
||||
UpdatePosition(pos, true);
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
}
|
||||
@@ -16109,7 +16111,7 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SendTeleportPacket(Position& pos)
|
||||
void Unit::SendTeleportPacket(Position const& pos)
|
||||
{
|
||||
// SMSG_MOVE_UPDATE_TELEPORT is sent to nearby players to signal the teleport
|
||||
// MSG_MOVE_TELEPORT is sent to self in order to trigger MSG_MOVE_TELEPORT_ACK and update the position server side
|
||||
|
||||
@@ -1592,8 +1592,9 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void SendSpellDamageResist(Unit* target, uint32 spellId);
|
||||
void SendSpellDamageImmune(Unit* target, uint32 spellId);
|
||||
|
||||
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
|
||||
void SendTeleportPacket(Position& pos);
|
||||
void NearTeleportTo(Position const& pos, bool casting = false);
|
||||
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false) { NearTeleportTo(Position(x, y, z, orientation), casting); }
|
||||
void SendTeleportPacket(Position const& pos);
|
||||
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false);
|
||||
// returns true if unit's position really changed
|
||||
virtual bool UpdatePosition(const Position &pos, bool teleport = false);
|
||||
|
||||
Reference in New Issue
Block a user