diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-06-06 22:30:04 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-06-06 22:30:04 +0200 |
| commit | 47d54bf5e20617d04055e1102e7688fb93e9f985 (patch) | |
| tree | 3d6bb3d03c3252ef24686e5251da34e617c846a2 /src/server/game/Entities/Unit | |
| parent | cb265e02aa38c17e203191b68966879a1ccb7b31 (diff) | |
Core/Movement: Fixed fall damage when teleporting together with transport
Closes #14672
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a3eaa245435..f16366e50e9 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13837,20 +13837,25 @@ void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/) } } -void Unit::SendTeleportPacket(Position const& pos) +void Unit::SendTeleportPacket(Position const& pos, bool teleportingTransport /*= false*/) { // MSG_MOVE_TELEPORT is sent to nearby players to signal the teleport // MSG_MOVE_TELEPORT_ACK is sent to self in order to trigger ACK and update the position server side MovementInfo teleportMovementInfo = m_movementInfo; teleportMovementInfo.pos.Relocate(pos); - Position transportPos = pos; + Position transportPos = m_movementInfo.transport.pos; if (TransportBase* transportBase = GetDirectTransport()) { - float x, y, z, o; - pos.GetPosition(x, y, z, o); - transportBase->CalculatePassengerOffset(x, y, z, &o); - transportPos.Relocate(x, y, z, o); + // if its the transport that is teleported then we have old transport position here and cannot use it to calculate offsets + // assume that both transport teleport and teleport within transport cannot happen at the same time + if (!teleportingTransport) + { + float x, y, z, o; + pos.GetPosition(x, y, z, o); + transportBase->CalculatePassengerOffset(x, y, z, &o); + transportPos.Relocate(x, y, z, o); + } } WorldPacket moveUpdateTeleport(MSG_MOVE_TELEPORT, 38); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 6c6d8457a0e..2c58b250b3c 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1620,7 +1620,7 @@ class TC_GAME_API Unit : public WorldObject 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); + void SendTeleportPacket(Position const& pos, bool teleportingTransport = false); 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); |
