diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index c0fef5e5c17..22da44dd4f7 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -297,6 +297,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u m_goValue.Transport.PathProgress -= m_goValue.Transport.PathProgress % GetTransportPeriod(); // align to period m_goValue.Transport.CurrentSeg = 0; m_goValue.Transport.StateUpdateTimer = 0; + m_goValue.Transport.CurrentStopFrameIndex = 0; m_goValue.Transport.StopFrames = new std::vector(); m_goValue.Transport.StopFrames->push_back(0); // assign default stop frame @@ -2240,9 +2241,15 @@ void GameObject::SetTransportState(GOState state, uint32 stopFrame /*= 0*/) ASSERT(state < GOState(GO_STATE_TRANSPORT_STOPPED + MAX_GO_STATE_TRANSPORT_STOP_FRAMES)); ASSERT(stopFrame < m_goValue.Transport.StopFrames->size()); - // If we return to stop frame 0 we are going to use the passed transport travel time to get back - uint32 stopFrameTime = stopFrame ? m_goValue.Transport.StopFrames->at(stopFrame) : m_goValue.Transport.PathProgress; + uint32 stopFrameTime = m_goValue.Transport.StopFrames->at(stopFrame); + + // If we return to StopFrame 0 we are going to use the sum of passed transport frames to get a valid travel time to avoid "teleports" + if (!stopFrame) + for (uint8 i = 0; i <= m_goValue.Transport.CurrentStopFrameIndex; i++) + stopFrameTime += m_goValue.Transport.StopFrames->at(i); + m_goValue.Transport.PathProgress = getMSTime() + stopFrameTime; + m_goValue.Transport.CurrentStopFrameIndex = stopFrame; SetGoState(GOState(GO_STATE_TRANSPORT_STOPPED + stopFrame)); } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 0b82b915935..781f18a53b2 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -41,6 +41,7 @@ union GameObjectValue struct { uint32 PathProgress; + uint32 CurrentStopFrameIndex; TransportAnimation const* AnimationInfo; uint32 CurrentSeg; std::vector* StopFrames;