AzerothCore 3.3.5a
OpenSource WoW Emulator
No Matches
MotionTransport Class Reference

#include "Transport.h"

Inheritance diagram for MotionTransport:
Transport GameObject TransportBase WorldObject GridObject< GameObject > MovableMapObject Object WorldLocation Position

Public Member Functions

 ~MotionTransport () override
bool CreateMoTrans (ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
void CleanupsBeforeDelete (bool finalCleanup=true) override
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &) override
void Update (uint32 diff) override
void DelayedUpdate (uint32 diff)
void UpdatePosition (float x, float y, float z, float o)
void AddPassenger (WorldObject *passenger, bool withAll=false) override
void RemovePassenger (WorldObject *passenger, bool withAll=false) override
CreatureCreateNPCPassenger (ObjectGuid::LowType guid, CreatureData const *data)
GameObjectCreateGOPassenger (ObjectGuid::LowType guid, GameObjectData const *data)
void LoadStaticPassengers ()
PassengerSet const & GetStaticPassengers () const
void UnloadStaticPassengers ()
void UnloadNonStaticPassengers ()
void SetPassengersLoaded (bool loaded)
bool PassengersLoaded () const
KeyFrameVec const & GetKeyFrames () const
void EnableMovement (bool enabled)
TransportTemplate const * GetTransportTemplate () const
uint32 GetPeriod () const
void SetPeriod (uint32 period)
std::string GetDebugInfo () const override
- Public Member Functions inherited from Transport
 Transport ()
void CalculatePassengerPosition (float &x, float &y, float &z, float *o=nullptr) const override
 This method transforms supplied transport offsets into global coordinates.
void CalculatePassengerOffset (float &x, float &y, float &z, float *o=nullptr) const override
 This method transforms supplied global coordinates into local offsets.
virtual void AddPassenger (WorldObject *passenger, bool withAll=false)=0
virtual void RemovePassenger (WorldObject *passenger, bool withAll=false)=0
PassengerSet const & GetPassengers () const
uint32 GetPathProgress () const
void SetPathProgress (uint32 val)
- Public Member Functions inherited from GameObject
 GameObject ()
 ~GameObject () override
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
void AddToWorld () override
void RemoveFromWorld () override
void CleanupsBeforeDelete (bool finalCleanup=true) override
uint32 GetDynamicFlags () const override
void ReplaceAllDynamicFlags (uint32 flag) override
virtual bool Create (ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0)
void Update (uint32 p_time) override
GameObjectTemplate const * GetGOInfo () const
GameObjectTemplateAddon const * GetTemplateAddon () const
GameObjectData const * GetGameObjectData () const
GameObjectValue const * GetGOValue () const
bool IsTransport () const
bool IsDestructibleBuilding () const
ObjectGuid::LowType GetSpawnId () const
void SetLocalRotationAngles (float z_rot, float y_rot, float x_rot)
void SetLocalRotation (G3D::Quat const &rot)
void SetTransportPathRotation (float qx, float qy, float qz, float qw)
G3D::Quat const & GetLocalRotation () const
int64 GetPackedLocalRotation () const
G3D::Quat GetWorldRotation () const
std::string const & GetNameForLocaleIdx (LocaleConstant locale_idx) const override
void SaveToDB (bool saveAddon=false)
void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon=false)
bool LoadFromDB (ObjectGuid::LowType guid, Map *map)
bool LoadGameObjectFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true)
void DeleteFromDB ()
void SetOwnerGUID (ObjectGuid owner)
ObjectGuid GetOwnerGUID () const
UnitGetOwner () const
void SetSpellId (uint32 id)
uint32 GetSpellId () const
time_t GetRespawnTime () const
time_t GetRespawnTimeEx () const
void SetRespawnTime (int32 respawn)
void SetRespawnDelay (int32 respawn)
void Respawn ()
bool isSpawned () const
bool isSpawnedByDefault () const
void SetSpawnedByDefault (bool b)
uint32 GetRespawnDelay () const
void Refresh ()
void DespawnOrUnsummon (Milliseconds delay=0ms, Seconds forcedRespawnTime=0s)
void Delete ()
void GetFishLoot (Loot *loot, Player *loot_owner)
void GetFishLootJunk (Loot *loot, Player *loot_owner)
GameobjectTypes GetGoType () const
void SetGoType (GameobjectTypes type)
GOState GetGoState () const
void SetGoState (GOState state)
uint8 GetGoArtKit () const
void SetGoArtKit (uint8 artkit)
uint8 GetGoAnimProgress () const
void SetGoAnimProgress (uint8 animprogress)
void SetPhaseMask (uint32 newPhaseMask, bool update) override
void EnableCollision (bool enable)
GameObjectFlags GetGameObjectFlags () const
bool HasGameObjectFlag (GameObjectFlags flags) const
void SetGameObjectFlag (GameObjectFlags flags)
void RemoveGameObjectFlag (GameObjectFlags flags)
void ReplaceAllGameObjectFlags (GameObjectFlags flags)
void Use (Unit *user)
LootState getLootState () const
void SetLootState (LootState s, Unit *unit=nullptr)
uint16 GetLootMode () const
bool HasLootMode (uint16 lootMode) const
void SetLootMode (uint16 lootMode)
void AddLootMode (uint16 lootMode)
void RemoveLootMode (uint16 lootMode)
void ResetLootMode ()
void AddToSkillupList (ObjectGuid playerGuid)
bool IsInSkillupList (ObjectGuid playerGuid) const
void AddUniqueUse (Player *player)
void AddUse ()
uint32 GetUseCount () const
uint32 GetUniqueUseCount () const
void SaveRespawnTime () override
void SaveRespawnTime (uint32 forceDelay)
PlayerGetLootRecipient () const
GroupGetLootRecipientGroup () const
void SetLootRecipient (Creature *creature)
void SetLootRecipient (Map *map)
bool IsLootAllowedFor (Player const *player) const
bool HasLootRecipient () const
void SetLootGenerationTime ()
uint32 GetLootGenerationTime () const
GameObjectGetLinkedTrap ()
void SetLinkedTrap (GameObject *linkedTrap)
bool hasQuest (uint32 quest_id) const override
bool hasInvolvedQuest (uint32 quest_id) const override
bool ActivateToQuest (Player *target) const
void UseDoorOrButton (uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
void ResetDoorOrButton ()
void TriggeringLinkedGameObject (uint32 trapEntry, Unit *target)
bool IsNeverVisible () const override
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
bool IsInvisibleDueToDespawn () const override
uint8 getLevelForTarget (WorldObject const *target) const override
GameObjectLookupFishingHoleAround (float range)
void CastSpell (Unit *target, uint32 spell)
void SendCustomAnim (uint32 anim)
bool IsInRange (float x, float y, float z, float radius) const
void SendMessageToSetInRange (WorldPacket const *data, float dist, bool, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const override
void ModifyHealth (int32 change, Unit *attackerOrHealer=nullptr, uint32 spellId=0)
void SetDestructibleBuildingModifyState (bool allow)
void SetDestructibleState (GameObjectDestructibleState state, Player *eventInvoker=nullptr, bool setHealth=false)
GameObjectDestructibleState GetDestructibleState () const
void EventInform (uint32 eventId)
virtual uint32 GetScriptId () const
GameObjectAIAI () const
std::string const & GetAIName () const
void SetDisplayId (uint32 displayid)
uint32 GetDisplayId () const
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr) const
void SetPosition (float x, float y, float z, float o)
void SetPosition (const Position &pos)
bool IsStaticTransport () const
bool IsMotionTransport () const
TransportToTransport ()
Transport const * ToTransport () const
StaticTransportToStaticTransport ()
StaticTransport const * ToStaticTransport () const
MotionTransportToMotionTransport ()
MotionTransport const * ToMotionTransport () const
float GetStationaryX () const override
float GetStationaryY () const override
float GetStationaryZ () const override
float GetStationaryO () const override
float GetInteractionDistance () const
void UpdateModelPosition ()
bool IsAtInteractDistance (Position const &pos, float radius) const
bool IsAtInteractDistance (Player const *player, SpellInfo const *spell=nullptr) const
bool IsWithinDistInMap (Player const *player) const
SpellInfo const * GetSpellForLock (Player const *player) const
void SaveInstanceData (uint8 state)
void UpdateInstanceData (uint8 state)
bool FindStateSavedOnInstance ()
bool ValidateGameobjectType ()
uint8 GetStateSavedOnInstance ()
bool IsInstanceGameobject ()
uint8 GameobjectStateToInt (GOState *state)
bool IsAbleToSaveOnDb ()
void UpdateSaveToDb (bool enable)
void SavingStateOnDB ()
std::string GetDebugInfo () const override
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
virtual void Update (uint32)
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
void AddToWorld () override
void RemoveFromWorld () override
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
void MovePosition (Position &pos, float dist, float angle)
Position GetNearPosition (float dist, float angle)
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
Position GetFirstCollisionPosition (float dist, float angle)
Position GetRandomNearPosition (float radius)
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
float GetObjectSize () const
virtual float GetCombatReach () const
void UpdateGroundPositionZ (float x, float y, float &z) const
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Position GetRandomPoint (const Position &srcPos, float distance) const
uint32 GetInstanceId () const
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
uint32 GetPhaseMask () const
bool InSamePhase (WorldObject const *obj) const
bool InSamePhase (uint32 phasemask) const
uint32 GetZoneId () const
uint32 GetAreaId () const
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
bool IsOutdoors () const
LiquidData const & GetLiquidData () const
InstanceScriptGetInstanceScript () const
std::string const & GetName () const
void SetName (std::string const &newname)
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
float GetDistance (WorldObject const *obj) const
float GetDistance (const Position &pos) const
float GetDistance (float x, float y, float z) const
float GetDistance2d (WorldObject const *obj) const
float GetDistance2d (float x, float y) const
float GetDistanceZ (WorldObject const *obj) const
bool IsSelfOrInSameMap (WorldObject const *obj) const
bool IsInMap (WorldObject const *obj) const
bool IsWithinDist3d (float x, float y, float z, float dist) const
bool IsWithinDist3d (const Position *pos, float dist) const
bool IsWithinDist2d (float x, float y, float dist) const
bool IsWithinDist2d (const Position *pos, float dist) const
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
bool isInFront (WorldObject const *target, float arc=M_PI) const
bool isInBack (WorldObject const *target, float arc=M_PI) const
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
virtual uint8 getLevelForTarget (WorldObject const *) const
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
void SendObjectDeSpawnAnim (ObjectGuid guid)
virtual void SaveRespawnTime ()
void AddObjectToRemoveList ()
float GetGridActivationRange () const
float GetVisibilityRange () const
virtual float GetSightRange (WorldObject const *target=nullptr) const
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
void SendPlayMusic (uint32 Music, bool OnlySelf)
virtual void SetMap (Map *map)
virtual void ResetMap ()
MapGetMap () const
MapFindMap () const
void SetZoneScript ()
void ClearZoneScript ()
ZoneScriptGetZoneScript () const
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
PlayerSelectNearestPlayer (float distance=0) const
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
void DestroyForNearbyPlayers ()
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
void SetPositionDataUpdate ()
void UpdatePositionData ()
void AddToObjectUpdate () override
void RemoveFromObjectUpdate () override
void AddToNotify (uint16 f)
void RemoveFromNotify (uint16 f)
bool isNeedNotify (uint16 f) const
uint16 GetNotifyFlags () const
bool NotifyExecuted (uint16 f) const
void SetNotified (uint16 f)
void ResetAllNotifies ()
bool isActiveObject () const
void setActive (bool isActiveObject)
bool IsFarVisible () const
bool IsVisibilityOverridden () const
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
void SetWorldObject (bool apply)
bool IsPermanentWorldObject () const
bool IsWorldObject () const
bool IsInWintergrasp () const
TransportGetTransport () const
float GetTransOffsetX () const
float GetTransOffsetY () const
float GetTransOffsetZ () const
float GetTransOffsetO () const
uint32 GetTransTime () const
int8 GetTransSeat () const
virtual ObjectGuid GetTransGUID () const
void SetTransport (Transport *t)
virtual float GetStationaryX () const
virtual float GetStationaryY () const
virtual float GetStationaryZ () const
virtual float GetStationaryO () const
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
float GetFloorZ () const
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
virtual float GetCollisionHeight () const
virtual float GetCollisionWidth () const
virtual float GetCollisionRadius () const
void AddAllowedLooter (ObjectGuid guid)
void ResetAllowedLooters ()
void SetAllowedLooters (GuidUnorderedSet const looters)
bool HasAllowedLooter (ObjectGuid guid) const
GuidUnorderedSet const & GetAllowedLooters () const
std::string GetDebugInfo () const override
- Public Member Functions inherited from Object
virtual ~Object ()
bool IsInWorld () const
virtual void AddToWorld ()
virtual void RemoveFromWorld ()
ObjectGuid GetGUID () const
PackedGuid const & GetPackGUID () const
uint32 GetEntry () const
void SetEntry (uint32 entry)
float GetObjectScale () const
virtual void SetObjectScale (float scale)
virtual uint32 GetDynamicFlags () const
bool HasDynamicFlag (uint32 flag) const
virtual void SetDynamicFlag (uint32 flag)
virtual void RemoveDynamicFlag (uint32 flag)
virtual void ReplaceAllDynamicFlags (uint32 flag)
TypeID GetTypeId () const
bool isType (uint16 mask) const
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
void SendUpdateToPlayer (Player *player)
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
int32 GetInt32Value (uint16 index) const
uint32 GetUInt32Value (uint16 index) const
uint64 GetUInt64Value (uint16 index) const
float GetFloatValue (uint16 index) const
uint8 GetByteValue (uint16 index, uint8 offset) const
uint16 GetUInt16Value (uint16 index, uint8 offset) const
ObjectGuid GetGuidValue (uint16 index) const
void SetInt32Value (uint16 index, int32 value)
void SetUInt32Value (uint16 index, uint32 value)
void UpdateUInt32Value (uint16 index, uint32 value)
void SetUInt64Value (uint16 index, uint64 value)
void SetFloatValue (uint16 index, float value)
void SetByteValue (uint16 index, uint8 offset, uint8 value)
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
void SetInt16Value (uint16 index, uint8 offset, int16 value)
void SetGuidValue (uint16 index, ObjectGuid value)
void SetStatFloatValue (uint16 index, float value)
void SetStatInt32Value (uint16 index, int32 value)
bool AddGuidValue (uint16 index, ObjectGuid value)
bool RemoveGuidValue (uint16 index, ObjectGuid value)
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
void SetFlag (uint16 index, uint32 newFlag)
void RemoveFlag (uint16 index, uint32 oldFlag)
void ToggleFlag (uint16 index, uint32 flag)
bool HasFlag (uint16 index, uint32 flag) const
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
void SetFlag64 (uint16 index, uint64 newFlag)
void RemoveFlag64 (uint16 index, uint64 oldFlag)
void ToggleFlag64 (uint16 index, uint64 flag)
bool HasFlag64 (uint16 index, uint64 flag) const
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
void ClearUpdateMask (bool remove)
uint16 GetValuesCount () const
virtual bool hasQuest (uint32) const
virtual bool hasInvolvedQuest (uint32) const
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
void SetFieldNotifyFlag (uint16 flag)
void RemoveFieldNotifyFlag (uint16 flag)
void ForceValuesUpdateAtIndex (uint32)
bool IsPlayer () const
PlayerToPlayer ()
Player const * ToPlayer () const
CreatureToCreature ()
Creature const * ToCreature () const
UnitToUnit ()
Unit const * ToUnit () const
GameObjectToGameObject ()
GameObject const * ToGameObject () const
CorpseToCorpse ()
Corpse const * ToCorpse () const
DynamicObjectToDynObject ()
DynamicObject const * ToDynObject () const
virtual std::string GetDebugInfo () const
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 WorldLocation (uint32 mapId, Position const &position)
void WorldRelocate (const WorldLocation &loc)
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
void SetMapId (uint32 mapId)
uint32 GetMapId () const
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
void GetWorldLocation (WorldLocation *location) const
WorldLocation GetWorldLocation () const
std::string GetDebugInfo () const
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 Position (Position const &loc)
 Position (Position &&)=default
Positionoperator= (const Position &)=default
Positionoperator= (Position &&)=default
bool operator== (Position const &a) const
bool operator!= (Position const &a)
 operator G3D::Vector3 () const
void Relocate (float x, float y)
void Relocate (float x, float y, float z)
void Relocate (float x, float y, float z, float orientation)
void Relocate (const Position &pos)
void Relocate (const Position *pos)
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
void RelocateOffset (const Position &offset)
void SetOrientation (float orientation)
float GetPositionX () const
float GetPositionY () const
float GetPositionZ () const
float GetOrientation () const
void GetPosition (float &x, float &y) const
void GetPosition (float &x, float &y, float &z) const
void GetPosition (float &x, float &y, float &z, float &o) const
Position GetPosition () const
Position::PositionXYZStreamer PositionXYZStream ()
Position::PositionXYZOStreamer PositionXYZOStream ()
bool IsPositionValid () const
float GetExactDist2dSq (const float x, const float y) const
float GetExactDist2dSq (Position const &pos) const
float GetExactDist2dSq (Position const *pos) const
float GetExactDist2d (const float x, const float y) const
float GetExactDist2d (Position const &pos) const
float GetExactDist2d (Position const *pos) const
float GetExactDistSq (float x, float y, float z) const
float GetExactDistSq (Position const &pos) const
float GetExactDistSq (Position const *pos) const
float GetExactDist (float x, float y, float z) const
float GetExactDist (Position const &pos) const
float GetExactDist (Position const *pos) const
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
Position GetPositionWithOffset (Position const &offset) const
float GetAngle (const Position *pos) const
float GetAngle (float x, float y) const
float GetAbsoluteAngle (float x, float y) const
float GetAbsoluteAngle (Position const &pos) const
float GetAbsoluteAngle (Position const *pos) const
float GetRelativeAngle (const Position *pos) const
float GetRelativeAngle (float x, float y) const
float ToAbsoluteAngle (float relAngle) const
void GetSinCos (float x, float y, float &vsin, float &vcos) const
bool IsInDist2d (float x, float y, float dist) const
bool IsInDist2d (const Position *pos, float dist) const
bool IsInDist (float x, float y, float z, float dist) const
bool IsInDist (const Position *pos, float dist) const
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
bool HasInLine (Position const *pos, float width) const
std::string ToString () const
- Public Member Functions inherited from GridObject< GameObject >
bool IsInGrid () const
void AddToGrid (GridRefMgr< GameObject > &m)
void RemoveFromGrid ()
virtual void CalculatePassengerPosition (float &x, float &y, float &z, float *o=nullptr) const =0
 This method transforms supplied transport offsets into global coordinates.
virtual void CalculatePassengerOffset (float &x, float &y, float &z, float *o=nullptr) const =0
 This method transforms supplied global coordinates into local offsets.

Private Member Functions

 MotionTransport ()
void MoveToNextWaypoint ()
float CalculateSegmentPos (float perc)
bool TeleportTransport (uint32 newMapid, float x, float y, float z, float o)
void DelayedTeleportTransport ()
void UpdatePassengerPositions (PassengerSet &passengers)
void DoEventIfAny (KeyFrame const &node, bool departure)
bool IsMoving () const
 Helpers to know if stop frame was reached.
void SetMoving (bool val)

Private Attributes

TransportTemplate const * _transportInfo
KeyFrameVec::const_iterator _currentFrame
KeyFrameVec::const_iterator _nextFrame
TimeTrackerSmall _positionChangeTimer
bool _isMoving
bool _pendingStop
bool _triggeredArrivalEvent
 These are needed to properly control events triggering only once for each frame.
bool _triggeredDepartureEvent
PassengerSet _staticPassengers
std::mutex Lock
bool _passengersLoaded
bool _delayedTeleport


MotionTransportTransportMgr::CreateTransport (uint32, ObjectGuid::LowType, Map *)

Additional Inherited Members

- Public Types inherited from Transport
typedef std::set< WorldObject * > PassengerSet
- Static Public Member Functions inherited from GameObject
static void SetGoArtKit (uint8 artkit, GameObject *go, ObjectGuid::LowType lowguid=0)
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
- Public Attributes inherited from GameObject
Loot loot
uint32 m_groupLootTimer
uint32 lootingGroupLowGUID
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
uint32 LastUsedScriptID
MovementInfo m_movementInfo
ElunaEventProcessor * elunaEvents
- Public Attributes inherited from Object
DataMap CustomData
- Public Attributes inherited from WorldLocation
uint32 m_mapId
- Public Attributes inherited from Position
float m_positionX = 0
float m_positionY = 0
float m_positionZ = 0
float m_orientation = 0
- Static Public Attributes inherited from GameObject
static std::unordered_map< int, goEventFlaggameObjectToEventFlag = { }
- Protected Types inherited from GameObject
typedef std::map< uint32, ObjectGuidChairSlotAndUser
- Protected Member Functions inherited from GameObject
bool AIM_Initialize ()
GameObjectModelCreateModel ()
void UpdateModel ()
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
void SetLocationMapId (uint32 _mapId)
void SetLocationInstanceId (uint32 _instanceId)
virtual bool IsNeverVisible () const
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
virtual bool IsInvisibleDueToDespawn () const
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
- Protected Member Functions inherited from Object
 Object ()
void _InitValues ()
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
std::string _ConcatFields (uint16 startIndex, uint16 size) const
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
virtual void AddToObjectUpdate ()=0
virtual void RemoveFromObjectUpdate ()=0
void AddToObjectUpdateIfNeeded ()
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
- Protected Member Functions inherited from TransportBase
 TransportBase ()=default
virtual ~TransportBase ()=default
- Static Protected Member Functions inherited from TransportBase
static void CalculatePassengerPosition (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO)
static void CalculatePassengerOffset (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO)
- Protected Attributes inherited from Transport
PassengerSet _passengers
- Protected Attributes inherited from GameObject
uint32 m_spellId
time_t m_respawnTime
uint32 m_respawnDelayTime
uint32 m_despawnDelay
Seconds m_despawnRespawnTime
Seconds m_restockTime
LootState m_lootState
bool m_spawnedByDefault
uint32 m_cooldownTime
std::unordered_map< ObjectGuid, int32m_SkillupList
ObjectGuid m_ritualOwnerGUID
GuidSet m_unique_users
uint32 m_usetimes
ChairSlotAndUser ChairListSlots
ObjectGuid::LowType m_spawnId
 For new or temporary gameobjects is 0 for saved it is lowguid.
GameObjectTemplate const * m_goInfo
GameObjectData const * m_goData
GameObjectValue m_goValue
bool m_allowModifyDestructibleBuilding
int64 m_packedRotation
G3D::Quat m_localRotation
Position m_stationaryPosition
ObjectGuid m_lootRecipient
ObjectGuid::LowType m_lootRecipientGroup
uint16 m_LootMode
uint32 m_lootGenerationTime
ObjectGuid m_linkedTrap
ObjectGuid _lootStateUnitGUID
- Protected Attributes inherited from WorldObject
std::string m_name
bool m_isActive
bool m_isFarVisible
Optional< float > m_visibilityDistanceOverride
const bool m_isWorldObject
uint32 _zoneId
uint32 _areaId
float _floorZ
bool _outdoors
LiquidData _liquidData
bool _updatePositionData
- Protected Attributes inherited from Object
uint16 m_objectType
TypeID m_objectTypeId
uint16 m_updateFlag
union {
   int32 *   m_int32Values
   uint32 *   m_uint32Values
   float *   m_floatValues
UpdateMask _changesMask
uint16 m_valuesCount
uint16 _fieldNotifyFlags
bool m_objectUpdated

Detailed Description

Constructor & Destructor Documentation

◆ MotionTransport()

MotionTransport::MotionTransport ( )
Definition: UpdateData.h:48
Definition: UpdateData.h:43
Definition: UpdateData.h:40
Definition: UpdateData.h:45
uint16 m_updateFlag
Definition: Object.h:231
Definition: Transport.h:31
bool _triggeredArrivalEvent
These are needed to properly control events triggering only once for each frame.
Definition: Transport.h:102
bool _delayedTeleport
Definition: Transport.h:108
bool _isMoving
Definition: Transport.h:98
bool _pendingStop
Definition: Transport.h:99
TransportTemplate const * _transportInfo
Definition: Transport.h:94
bool _passengersLoaded
Definition: Transport.h:107
bool _triggeredDepartureEvent
Definition: Transport.h:103


◆ ~MotionTransport()

MotionTransport::~MotionTransport ( )
42 ASSERT(_passengers.empty());
#define ASSERT
Definition: Errors.h:68
PassengerSet _passengers
Definition: Transport.h:44
void UnloadStaticPassengers()
Definition: Transport.cpp:430

References Transport::_passengers, ASSERT, and UnloadStaticPassengers().

Member Function Documentation

◆ AddPassenger()

void MotionTransport::AddPassenger ( WorldObject passenger,
bool  withAll = false 

Implements Transport.

265 std::lock_guard<std::mutex> guard(Lock);
266 if (_passengers.insert(passenger).second)
267 {
268 if (Player* plr = passenger->ToPlayer())
269 sScriptMgr->OnAddPassenger(ToTransport(), plr);
271 if (withAll)
272 {
273 if (Transport* t = passenger->GetTransport()) // SHOULD NEVER HAPPEN
274 t->RemovePassenger(passenger, false);
276 float x, y, z, o;
277 passenger->GetPosition(x, y, z, o);
278 CalculatePassengerOffset(x, y, z, &o);
280 passenger->SetTransport(this);
282 passenger->m_movementInfo.transport.guid = GetGUID();
283 passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o);
284 if (passenger->ToUnit())
285 {
287 }
288 }
289 }
Definition: Unit.h:561
Definition: Unit.h:352
#define sScriptMgr
Definition: ScriptMgr.h:2702
Transport * ToTransport()
Definition: GameObject.h:325
Player * ToPlayer()
Definition: Object.h:195
ObjectGuid GetGUID() const
Definition: Object.h:107
Unit * ToUnit()
Definition: Object.h:200
uint32 flags
Definition: Object.h:267
struct MovementInfo::TransportInfo transport
ObjectGuid guid
Definition: Object.h:284
Position pos
Definition: Object.h:285
void SetTransport(Transport *t)
Definition: Object.h:593
Transport * GetTransport() const
Definition: Object.h:585
MovementInfo m_movementInfo
Definition: Object.h:595
void GetPosition(float &x, float &y) const
Definition: Position.h:122
void Relocate(float x, float y)
Definition: Position.h:73
Definition: Player.h:1046
Definition: Transport.h:29
void CalculatePassengerOffset(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied global coordinates into local offsets.
Definition: Transport.h:33
std::mutex Lock
Definition: Transport.h:106
void AddUnitState(uint32 f)
Definition: Unit.h:1397

References Transport::_passengers, Unit::AddUnitState(), Transport::CalculatePassengerOffset(), MovementInfo::flags, Object::GetGUID(), Position::GetPosition(), WorldObject::GetTransport(), MovementInfo::TransportInfo::guid, Lock, WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::TransportInfo::pos, Position::Relocate(), WorldObject::SetTransport(), sScriptMgr, Object::ToPlayer(), GameObject::ToTransport(), Object::ToUnit(), MovementInfo::transport, and UNIT_STATE_IGNORE_PATHFINDING.

Referenced by Battleground::AddCreature(), and PassengerController::SummonCreatures().

◆ BuildUpdate()

void MotionTransport::BuildUpdate ( UpdateDataMapType data_map,

Reimplemented from WorldObject.

127 Map::PlayerList const& players = GetMap()->GetPlayers();
128 if (players.IsEmpty())
129 return;
131 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
132 BuildFieldsUpdate(itr->GetSource(), data_map);
134 ClearUpdateMask(true);
bool IsEmpty() const
Definition: LinkedList.h:97
Definition: LinkedList.h:139
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:545
void ClearUpdateMask(bool remove)
Definition: Object.cpp:533
Map * GetMap() const
Definition: Object.h:517
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37

References MapRefMgr::begin(), Object::BuildFieldsUpdate(), Object::ClearUpdateMask(), MapRefMgr::end(), WorldObject::GetMap(), Map::GetPlayers(), and LinkedListHead::IsEmpty().

◆ CalculateSegmentPos()

float MotionTransport::CalculateSegmentPos ( float  perc)
476 KeyFrame const& frame = *_currentFrame;
477 const float speed = float(m_goInfo->moTransport.moveSpeed);
478 const float accel = float(m_goInfo->moTransport.accelRate);
479 float timeSinceStop = frame.TimeFrom + (now - (1.0f / IN_MILLISECONDS) * frame.DepartureTime);
480 float timeUntilStop = frame.TimeTo - (now - (1.0f / IN_MILLISECONDS) * frame.DepartureTime);
481 float segmentPos, dist;
482 float accelTime = _transportInfo->accelTime;
483 float accelDist = _transportInfo->accelDist;
484 // calculate from nearest stop, less confusing calculation...
485 if (timeSinceStop < timeUntilStop)
486 {
487 if (timeSinceStop < accelTime)
488 dist = 0.5f * accel * timeSinceStop * timeSinceStop;
489 else
490 dist = accelDist + (timeSinceStop - accelTime) * speed;
491 segmentPos = dist - frame.DistSinceStop;
492 }
493 else
494 {
495 if (timeUntilStop < _transportInfo->accelTime)
496 dist = 0.5f * accel * timeUntilStop * timeUntilStop;
497 else
498 dist = accelDist + (timeUntilStop - accelTime) * speed;
499 segmentPos = frame.DistUntilStop - dist;
500 }
502 return segmentPos / frame.NextDistFromPrev;
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:398
uint32 moveSpeed
Definition: GameObjectData.h:218
uint32 accelRate
Definition: GameObjectData.h:219
struct GameObjectTemplate::@215::@230 moTransport
KeyFrameVec::const_iterator _currentFrame
Definition: Transport.h:95
Definition: TransportMgr.h:42
float DistUntilStop
Definition: TransportMgr.h:53
float NextDistFromPrev
Definition: TransportMgr.h:63
float DistSinceStop
Definition: TransportMgr.h:52
uint32 DepartureTime
Definition: TransportMgr.h:59
float TimeFrom
Definition: TransportMgr.h:55
float TimeTo
Definition: TransportMgr.h:56
float accelDist
Definition: TransportMgr.h:80
float accelTime
Definition: TransportMgr.h:79

References _currentFrame, _transportInfo, TransportTemplate::accelDist, GameObjectTemplate::accelRate, TransportTemplate::accelTime, KeyFrame::DepartureTime, KeyFrame::DistSinceStop, KeyFrame::DistUntilStop, IN_MILLISECONDS, GameObject::m_goInfo, GameObjectTemplate::moTransport, GameObjectTemplate::moveSpeed, KeyFrame::NextDistFromPrev, KeyFrame::TimeFrom, and KeyFrame::TimeTo.

Referenced by Update().

◆ CleanupsBeforeDelete()

void MotionTransport::CleanupsBeforeDelete ( bool  finalCleanup = true)

Reimplemented from GameObject.

113 while (!_passengers.empty())
114 {
115 WorldObject* obj = *_passengers.begin();
116 RemovePassenger(obj);
117 obj->SetTransport(nullptr);
120 }
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition: GameObject.cpp:105
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:321
void Reset()
Definition: Object.h:275
Definition: Object.h:393
void RemovePassenger(WorldObject *passenger, bool withAll=false) override
Definition: Transport.cpp:292

References Transport::_passengers, GameObject::CleanupsBeforeDelete(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), MovementInfo::transport, and UnloadStaticPassengers().

◆ CreateGOPassenger()

GameObject * MotionTransport::CreateGOPassenger ( ObjectGuid::LowType  guid,
GameObjectData const *  data 
367 Map* map = GetMap();
368 GameObject* go = new GameObject();
369 ASSERT(!sObjectMgr->IsGameObjectStaticTransport(data->id));
371 if (!go->LoadGameObjectFromDB(guid, map, false))
372 {
373 delete go;
374 return nullptr;
375 }
377 float x = data->posX;
378 float y = data->posY;
379 float z = data->posZ;
380 float o = data->orientation;
382 go->SetTransport(this);
384 go->m_movementInfo.transport.pos.Relocate(x, y, z, o);
385 CalculatePassengerPosition(x, y, z, &o);
386 go->Relocate(x, y, z, o);
388 if (!go->IsPositionValid())
389 {
390 LOG_ERROR("entities.transport", "GameObject ({}) not created. Suggested coordinates aren't valid (X: {} Y: {})",
391 go->GetGUID().ToString(), go->GetPositionX(), go->GetPositionY());
392 delete go;
393 return nullptr;
394 }
396 if (!map->AddToMap(go))
397 {
398 delete go;
399 return nullptr;
400 }
402 _staticPassengers.insert(go);
403 return go;
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
#define sObjectMgr
Definition: ObjectMgr.h:1640
Definition: GameObject.h:122
Definition: GameObject.cpp:42
bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition: GameObject.cpp:1120
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
std::string ToString() const
Definition: ObjectGuid.cpp:47
bool IsPositionValid() const
Definition: Position.cpp:175
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied transport offsets into global coordinates.
Definition: Transport.h:32
PassengerSet _staticPassengers
Definition: Transport.h:105
Definition: Map.h:312
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:557

References _staticPassengers, Map::AddToMap(), ASSERT, Transport::CalculatePassengerPosition(), GameObject::GameObject(), Object::GetGUID(), WorldObject::GetMap(), Position::GetPositionX(), Position::GetPositionY(), MovementInfo::TransportInfo::guid, GameObjectData::id, Position::IsPositionValid(), GameObject::LoadGameObjectFromDB(), LOG_ERROR, WorldObject::m_movementInfo, GameObjectData::orientation, MovementInfo::TransportInfo::pos, GameObjectData::posX, GameObjectData::posY, GameObjectData::posZ, Position::Relocate(), WorldObject::SetTransport(), sObjectMgr, ObjectGuid::ToString(), and MovementInfo::transport.

Referenced by LoadStaticPassengers().

◆ CreateMoTrans()

bool MotionTransport::CreateMoTrans ( ObjectGuid::LowType  guidlow,
uint32  entry,
uint32  mapid,
float  x,
float  y,
float  z,
float  ang,
uint32  animprogress 
48 Relocate(x, y, z, ang);
50 if (!IsPositionValid())
51 {
52 LOG_ERROR("entities.transport", "Transport (GUID: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})",
53 guidlow, x, y);
54 return false;
55 }
57 Object::_Create(guidlow, 0, HighGuid::Mo_Transport);
59 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
61 if (!goinfo)
62 {
63 LOG_ERROR("entities.transport", "Transport not created: entry in `gameobject_template` not found, guidlow: {} map: {} (X: {} Y: {} Z: {}) ang: {}", guidlow, mapid, x, y, z, ang);
64 return false;
65 }
67 m_goInfo = goinfo;
69 TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
70 if (!tInfo)
71 {
72 LOG_ERROR("entities.transport", "Transport {} (name: {}) will not be created, missing `transport_template` entry.", entry, goinfo->name);
73 return false;
74 }
76 _transportInfo = tInfo;
78 // initialize waypoints
79 _nextFrame = tInfo->keyFrames.begin();
84 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
85 {
86 SetUInt32Value(GAMEOBJECT_FACTION, addon->faction);
88 }
90 SetObjectScale(goinfo->size);
92 SetPeriod(tInfo->pathTime);
93 SetEntry(goinfo->entry);
94 SetDisplayId(goinfo->displayId);
97 SetGoAnimProgress(animprogress);
98 SetName(goinfo->name);
100 // pussywizard: no WorldRotation for MotionTransports
101 SetLocalRotation(G3D::Quat());
102 // pussywizard: no PathRotation for MotionTransports
103 SetTransportPathRotation(0.0f, 0.0f, 0.0f, 1.0f);
107 return true;
Definition: GameObjectData.h:691
Definition: GameObjectData.h:690
Definition: UpdateFields.h:402
#define sTransportMgr
Definition: TransportMgr.h:163
Definition: SharedDefines.h:1547
Definition: SharedDefines.h:1574
void SetGoState(GOState state)
Definition: GameObject.cpp:2467
void SetTransportPathRotation(float qx, float qy, float qz, float qw)
Definition: GameObject.cpp:2244
void SetLocalRotation(G3D::Quat const &rot)
Definition: GameObject.cpp:2230
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:212
GameObjectModel * CreateModel()
Definition: GameObject.cpp:3001
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:206
GameObjectModel * m_model
Definition: GameObject.h:316
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.cpp:909
void SetDisplayId(uint32 displayid)
Definition: GameObject.cpp:2635
void ReplaceAllGameObjectFlags(GameObjectFlags flags)
Definition: GameObject.h:222
Definition: GameObjectData.h:32
uint32 entry
Definition: GameObjectData.h:33
uint32 canBeStopped
Definition: GameObjectData.h:225
std::string name
Definition: GameObjectData.h:36
float size
Definition: GameObjectData.h:40
uint32 displayId
Definition: GameObjectData.h:35
Definition: GameObjectData.h:665
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134
void SetEntry(uint32 entry)
Definition: Object.h:110
virtual void SetObjectScale(float scale)
Definition: Object.h:113
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void SetName(std::string const &newname)
Definition: Object.h:447
void SetPathProgress(uint32 val)
Definition: Transport.h:41
void SetPeriod(uint32 period)
Definition: Transport.h:79
KeyFrameVec::const_iterator _nextFrame
Definition: Transport.h:96
Definition: TransportMgr.h:71
uint32 pathTime
Definition: TransportMgr.h:77
KeyFrameVec keyFrames
Definition: TransportMgr.h:78

References Object::_Create(), _currentFrame, _nextFrame, _transportInfo, _triggeredArrivalEvent, _triggeredDepartureEvent, GameObjectTemplate::canBeStopped, GameObject::CreateModel(), GameObjectTemplate::displayId, GameObjectTemplate::entry, GAMEOBJECT_FACTION, GAMEOBJECT_TYPE_MO_TRANSPORT, GameObject::GetTemplateAddon(), GO_STATE_ACTIVE, GO_STATE_READY, Position::IsPositionValid(), TransportTemplate::keyFrames, LOG_ERROR, GameObject::m_goInfo, GameObject::m_model, GameObjectTemplate::moTransport, GameObjectTemplate::name, TransportTemplate::pathTime, Position::Relocate(), GameObject::ReplaceAllGameObjectFlags(), GameObject::SetDisplayId(), Object::SetEntry(), GameObject::SetGoAnimProgress(), GameObject::SetGoState(), GameObject::SetGoType(), GameObject::SetLocalRotation(), WorldObject::SetName(), Object::SetObjectScale(), Transport::SetPathProgress(), SetPeriod(), GameObject::SetTransportPathRotation(), Object::SetUInt32Value(), GameObjectTemplate::size, sObjectMgr, and sTransportMgr.

Referenced by TransportMgr::CreateTransport().

◆ CreateNPCPassenger()

Creature * MotionTransport::CreateNPCPassenger ( ObjectGuid::LowType  guid,
CreatureData const *  data 

@HACK - transport models are not added to map's dynamic LoS calculations because the current GameObjectModel cannot be moved without recreating

319 Map* map = GetMap();
320 Creature* creature = new Creature();
322 if (!creature->LoadCreatureFromDB(guid, map, false))
323 {
324 delete creature;
325 return nullptr;
326 }
328 float x = data->posX;
329 float y = data->posY;
330 float z = data->posZ;
331 float o = data->orientation;
333 creature->SetTransport(this);
335 creature->m_movementInfo.transport.guid = GetGUID();
336 creature->m_movementInfo.transport.pos.Relocate(x, y, z, o);
337 CalculatePassengerPosition(x, y, z, &o);
338 creature->Relocate(x, y, z, o);
339 creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
346 if (!creature->IsPositionValid())
347 {
348 LOG_ERROR("entities.transport", "Creature ({}) not created. Suggested coordinates aren't valid (X: {} Y: {})",
349 creature->GetGUID().ToString(), creature->GetPositionX(), creature->GetPositionY());
350 delete creature;
351 return nullptr;
352 }
354 if (!map->AddToMap(creature))
355 {
356 delete creature;
357 return nullptr;
358 }
360 _staticPassengers.insert(creature);
361 sScriptMgr->OnAddCreaturePassenger(this, creature);
362 return creature;
Definition: Creature.h:46
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:328
void SetTransportHomePosition(float x, float y, float z, float o)
Definition: Creature.h:333
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool gridLoad=false, bool allowDuplicate=false)
Definition: Creature.cpp:1661
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:2272

References _staticPassengers, Map::AddToMap(), Unit::AddUnitMovementFlag(), Unit::AddUnitState(), Transport::CalculatePassengerPosition(), Object::GetGUID(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), MovementInfo::TransportInfo::guid, Position::IsPositionValid(), Creature::LoadCreatureFromDB(), LOG_ERROR, WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, CreatureData::orientation, MovementInfo::TransportInfo::pos, CreatureData::posX, CreatureData::posY, CreatureData::posZ, Position::Relocate(), Creature::SetHomePosition(), WorldObject::SetTransport(), Creature::SetTransportHomePosition(), sScriptMgr, ObjectGuid::ToString(), MovementInfo::transport, and UNIT_STATE_IGNORE_PATHFINDING.

Referenced by LoadStaticPassengers().

◆ DelayedTeleportTransport()

void MotionTransport::DelayedTeleportTransport ( )
537 if (!_delayedTeleport)
538 return;
540 _delayedTeleport = false;
542 uint32 newMapId = _nextFrame->Node->mapid;
543 float x = _nextFrame->Node->x,
544 y = _nextFrame->Node->y,
545 z = _nextFrame->Node->z,
546 o = _nextFrame->InitialOrientation;
548 PassengerSet _passengersCopy = _passengers;
549 for (PassengerSet::iterator itr = _passengersCopy.begin(); itr != _passengersCopy.end(); )
550 {
551 WorldObject* obj = (*itr++);
553 if (_passengers.find(obj) == _passengers.end())
554 continue;
556 switch (obj->GetTypeId())
557 {
558 case TYPEID_UNIT:
559 _passengers.erase(obj);
560 if (!obj->ToCreature()->IsPet())
562 break;
564 _passengers.erase(obj);
565 obj->ToGameObject()->Delete();
566 break;
568 _passengers.erase(obj);
569 if (Unit* caster = obj->ToDynObject()->GetCaster())
570 if (Spell* s = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
571 if (obj->ToDynObject()->GetSpellId() == s->GetSpellInfo()->Id)
572 {
573 s->SendChannelUpdate(0);
574 s->SendInterrupted(0);
575 caster->RemoveOwnedAura(s->GetSpellInfo()->Id, caster->GetGUID());
576 }
578 break;
580 {
581 float destX, destY, destZ, destO;
582 obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
583 TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);
584 if (!obj->ToPlayer()->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
585 _passengers.erase(obj);
586 }
587 break;
588 default:
589 break;
590 }
591 }
593 Map* newMap = sMapMgr->CreateBaseMap(newMapId);
594 GetMap()->RemoveFromMap<MotionTransport>(this, false);
595 newMap->LoadGrid(x, y); // xinef: load before adding passengers to new map
596 SetMap(newMap);
598 Relocate(x, y, z, o);
std::uint32_t uint32
Definition: Define.h:108
Definition: ObjectGuid.h:40
Definition: ObjectGuid.h:39
Definition: ObjectGuid.h:37
Definition: ObjectGuid.h:38
Definition: Player.h:815
Definition: Unit.h:980
#define sMapMgr
Definition: MapMgr.h:221
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2108
Unit * GetCaster() const
Definition: DynamicObject.h:55
uint32 GetSpellId() const
Definition: DynamicObject.h:58
void Delete()
Definition: GameObject.cpp:976
DynamicObject * ToDynObject()
Definition: Object.h:208
TypeID GetTypeId() const
Definition: Object.h:121
GameObject * ToGameObject()
Definition: Object.h:202
Creature * ToCreature()
Definition: Object.h:197
virtual void SetMap(Map *map)
Definition: Object.cpp:2071
void AddObjectToRemoveList()
Definition: Object.cpp:2115
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1311
std::set< WorldObject * > PassengerSet
Definition: Transport.h:35
Definition: Transport.h:48
void LoadStaticPassengers()
Definition: Transport.cpp:406
Definition: Unit.h:1290
bool IsPet() const
Definition: Unit.h:1413
virtual void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const =0
This method transforms supplied transport offsets into global coordinates.
void LoadGrid(float x, float y)
Definition: Map.cpp:494
void RemoveFromMap(T *, bool)
Definition: Map.cpp:942
Definition: Spell.h:284

References _delayedTeleport, _nextFrame, Transport::_passengers, WorldObject::AddObjectToRemoveList(), Map::AddToMap(), TransportBase::CalculatePassengerPosition(), CURRENT_CHANNELED_SPELL, GameObject::Delete(), Creature::DespawnOrUnsummon(), DynamicObject::GetCaster(), WorldObject::GetMap(), Position::GetPosition(), DynamicObject::GetSpellId(), Object::GetTypeId(), Unit::IsPet(), Map::LoadGrid(), LoadStaticPassengers(), WorldObject::m_movementInfo, MovementInfo::TransportInfo::pos, Position::Relocate(), Map::RemoveFromMap(), WorldObject::SetMap(), sMapMgr, TELE_TO_NOT_LEAVE_TRANSPORT, Player::TeleportTo(), Object::ToCreature(), Object::ToDynObject(), Object::ToGameObject(), Object::ToPlayer(), MovementInfo::transport, TYPEID_DYNAMICOBJECT, TYPEID_GAMEOBJECT, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by DelayedUpdate().

◆ DelayedUpdate()

void MotionTransport::DelayedUpdate ( uint32  diff)
241 if (GetKeyFrames().size() <= 1)
242 return;
KeyFrameVec const & GetKeyFrames() const
Definition: Transport.h:74
void DelayedTeleportTransport()
Definition: Transport.cpp:535

References DelayedTeleportTransport(), and GetKeyFrames().

Referenced by Map::DelayedUpdate().

◆ DoEventIfAny()

void MotionTransport::DoEventIfAny ( KeyFrame const &  node,
bool  departure 
657 if (uint32 eventid = departure ? node.Node->departureEventID : node.Node->arrivalEventID)
658 {
659 //LOG_DEBUG("maps.script", "Taxi {} event {} of node {} of {} path", departure ? "departure" : "arrival", eventid, node.Node->index, GetName());
660 GetMap()->ScriptsStart(sEventScripts, eventid, this, this);
661 EventInform(eventid);
662 }
ScriptMapMap sEventScripts
Definition: ObjectMgr.cpp:60
void EventInform(uint32 eventId)
Definition: GameObject.cpp:2182
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
Definition: MapScripts.cpp:34

References TaxiPathNodeEntry::arrivalEventID, TaxiPathNodeEntry::departureEventID, GameObject::EventInform(), WorldObject::GetMap(), KeyFrame::Node, Map::ScriptsStart(), and sEventScripts.

Referenced by Update().

◆ EnableMovement()

◆ GetDebugInfo()

std::string MotionTransport::GetDebugInfo ( ) const

Reimplemented from GameObject.

1010 std::stringstream sstr;
1011 sstr << GameObject::GetDebugInfo();
1012 return sstr.str();
std::string GetDebugInfo() const override
Definition: GameObject.cpp:3132

References GameObject::GetDebugInfo().

◆ GetKeyFrames()

KeyFrameVec const & MotionTransport::GetKeyFrames ( ) const

◆ GetPeriod()

uint32 MotionTransport::GetPeriod ( ) const
Definition: UpdateFields.h:403
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305

References GAMEOBJECT_LEVEL, and Object::GetUInt32Value().

Referenced by Update().

◆ GetStaticPassengers()

PassengerSet const & MotionTransport::GetStaticPassengers ( ) const
68{ return _staticPassengers; }

References _staticPassengers.

◆ GetTransportTemplate()

TransportTemplate const * MotionTransport::GetTransportTemplate ( ) const
76{ return _transportInfo; }

References _transportInfo.

◆ IsMoving()

bool MotionTransport::IsMoving ( ) const

Helpers to know if stop frame was reached.

91{ return _isMoving; }

References _isMoving.

Referenced by Update().

◆ LoadStaticPassengers()

void MotionTransport::LoadStaticPassengers ( )
408 if (PassengersLoaded())
409 return;
411 if (uint32 mapId = GetGOInfo()->moTransport.mapID)
412 {
413 CellObjectGuidsMap const& cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetSpawnMode());
414 CellGuidSet::const_iterator guidEnd;
415 for (CellObjectGuidsMap::const_iterator cellItr = cells.begin(); cellItr != cells.end(); ++cellItr)
416 {
417 // Creatures on transport
418 guidEnd = cellItr->second.creatures.end();
419 for (CellGuidSet::const_iterator guidItr = cellItr->second.creatures.begin(); guidItr != guidEnd; ++guidItr)
420 CreateNPCPassenger(*guidItr, sObjectMgr->GetCreatureData(*guidItr));
422 // GameObjects on transport
423 guidEnd = cellItr->second.gameobjects.end();
424 for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr)
425 CreateGOPassenger(*guidItr, sObjectMgr->GetGameObjectData(*guidItr));
426 }
427 }
std::unordered_map< uint32, CellObjectGuids > CellObjectGuidsMap
Definition: ObjectMgr.h:484
uint32 mapID
Definition: GameObjectData.h:223
bool PassengersLoaded() const
Definition: Transport.h:72
Creature * CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const *data)
Definition: Transport.cpp:317
GameObject * CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const *data)
Definition: Transport.cpp:365
void SetPassengersLoaded(bool loaded)
Definition: Transport.h:71

References CreateGOPassenger(), CreateNPCPassenger(), GameObject::GetGOInfo(), WorldObject::GetMap(), GameObjectTemplate::mapID, PassengersLoaded(), SetPassengersLoaded(), and sObjectMgr.

Referenced by DelayedTeleportTransport(), Update(), and UpdatePosition().

◆ MoveToNextWaypoint()

void MotionTransport::MoveToNextWaypoint ( )
464 // Clear events flagging
468 // Set frames
470 if (_nextFrame == GetKeyFrames().end())
471 _nextFrame = GetKeyFrames().begin();

References _currentFrame, _nextFrame, _triggeredArrivalEvent, _triggeredDepartureEvent, and GetKeyFrames().

Referenced by Update().

◆ PassengersLoaded()

bool MotionTransport::PassengersLoaded ( ) const
72{ return _passengersLoaded; }

References _passengersLoaded.

Referenced by LoadStaticPassengers().

◆ RemovePassenger()

void MotionTransport::RemovePassenger ( WorldObject passenger,
bool  withAll = false 

Implements Transport.

294 std::lock_guard<std::mutex> guard(Lock);
295 if (_passengers.erase(passenger) || _staticPassengers.erase(passenger))
296 {
297 if (Player* plr = passenger->ToPlayer())
298 {
299 sScriptMgr->OnRemovePassenger(ToTransport(), plr);
300 plr->SetFallInformation(GameTime::GetGameTime().count(), plr->GetPositionZ());
301 }
303 if (withAll)
304 {
305 passenger->SetTransport(nullptr);
306 passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
307 passenger->m_movementInfo.transport.guid.Clear();
308 passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
309 if (passenger->ToUnit())
310 {
312 }
313 }
314 }
Seconds GetGameTime()
Definition: GameTime.cpp:38
void Clear()
Definition: ObjectGuid.h:140
void ClearUnitState(uint32 f)
Definition: Unit.h:1399

References Transport::_passengers, _staticPassengers, ObjectGuid::Clear(), Unit::ClearUnitState(), MovementInfo::flags, GameTime::GetGameTime(), MovementInfo::TransportInfo::guid, Lock, WorldObject::m_movementInfo, MovementInfo::TransportInfo::pos, Position::Relocate(), WorldObject::SetTransport(), sScriptMgr, Object::ToPlayer(), GameObject::ToTransport(), Object::ToUnit(), MovementInfo::transport, and UNIT_STATE_IGNORE_PATHFINDING.

Referenced by CleanupsBeforeDelete().

◆ SetMoving()

void MotionTransport::SetMoving ( bool  val)
92{ _isMoving = val; }

References _isMoving.

Referenced by Update().

◆ SetPassengersLoaded()

void MotionTransport::SetPassengersLoaded ( bool  loaded)

◆ SetPeriod()

void MotionTransport::SetPeriod ( uint32  period)

◆ TeleportTransport()

bool MotionTransport::TeleportTransport ( uint32  newMapid,
float  x,
float  y,
float  z,
float  o 
507 Map const* oldMap = GetMap();
509 if (oldMap->GetId() != newMapid)
510 {
511 _delayedTeleport = true;
513 return true;
514 }
515 else
516 {
517 // Teleport players, they need to know it
518 for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
519 {
520 if ((*itr)->GetTypeId() == TYPEID_PLAYER)
521 {
522 float destX, destY, destZ, destO;
523 (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
524 TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);
526 (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
527 }
528 }
530 UpdatePosition(x, y, z, o);
531 return false;
532 }
void UpdatePosition(float x, float y, float z, float o)
Definition: Transport.cpp:247
uint32 GetId() const
Definition: Map.h:378

References _delayedTeleport, Transport::_passengers, TransportBase::CalculatePassengerPosition(), Map::GetId(), WorldObject::GetMap(), TYPEID_PLAYER, UnloadStaticPassengers(), and UpdatePosition().

Referenced by Update().

◆ UnloadNonStaticPassengers()

void MotionTransport::UnloadNonStaticPassengers ( )
442 for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); )
443 {
444 if ((*itr)->GetTypeId() == TYPEID_PLAYER)
445 {
446 ++itr;
447 continue;
448 }
449 PassengerSet::iterator itr2 = itr++;
450 (*itr2)->AddObjectToRemoveList();
451 }

References Transport::_passengers, and TYPEID_PLAYER.

Referenced by ResetEncounterEvent::Execute().

◆ UnloadStaticPassengers()

void MotionTransport::UnloadStaticPassengers ( )
432 SetPassengersLoaded(false);
433 while (!_staticPassengers.empty())
434 {
435 WorldObject* obj = *_staticPassengers.begin();
436 obj->AddObjectToRemoveList(); // also removes from _staticPassengers
437 }

References _staticPassengers, WorldObject::AddObjectToRemoveList(), and SetPassengersLoaded().

Referenced by CleanupsBeforeDelete(), TeleportTransport(), and ~MotionTransport().

◆ Update()

void MotionTransport::Update ( uint32  diff)

Reimplemented from GameObject.

139 uint32 const positionUpdateDelay = 1;
141 if (AI())
142 AI()->UpdateAI(diff);
143 else if (!AIM_Initialize())
144 LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport");
146 if (GetKeyFrames().size() <= 1)
147 return;
149 if (IsMoving() || !_pendingStop)
152 uint32 timer = GetPathProgress() % GetPeriod();
154 // Set current waypoint
155 // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime
156 // ... arrive | ... delay ... | departure
157 // event / event /
158 for (;;)
159 {
160 if (timer >= _currentFrame->ArriveTime)
161 {
163 {
166 }
168 if (timer < _currentFrame->DepartureTime)
169 {
170 SetMoving(false);
172 {
177 }
178 break; // its a stop frame and we are waiting
179 }
180 }
182 if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent)
183 {
184 DoEventIfAny(*_currentFrame, true); // departure event
186 }
188 // not waiting anymore
189 SetMoving(true);
191 // Enable movement
192 if (GetGOInfo()->moTransport.canBeStopped)
195 if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime)
196 break; // found current waypoint
200 sScriptMgr->OnRelocate(this, _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z);
202 //LOG_DEBUG("entities.transport", "Transport {} ({}) moved to node {} {} {} {} {}", GetEntry(), GetName(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z);
204 // Departure event
205 if (_currentFrame->IsTeleportFrame())
206 if (TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z, _nextFrame->InitialOrientation))
207 return; // Update more in new map thread
208 }
210 // Set position
213 {
214 _positionChangeTimer.Reset(positionUpdateDelay);
215 if (IsMoving())
216 {
217 float t = CalculateSegmentPos(float(timer) * 0.001f);
218 G3D::Vector3 pos, dir;
219 _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos);
220 _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir);
221 UpdatePosition(pos.x, pos.y, pos.z, NormalizeOrientation(std::atan2(dir.y, dir.x) + M_PI));
222 }
223 else
224 {
225 /* There are four possible scenarios that trigger loading/unloading passengers:
226 1. transport moves from inactive to active grid
227 2. the grid that transport is currently in becomes active
228 3. transport moves from active to inactive grid
229 4. the grid that transport is currently in unloads
230 */
231 if (_staticPassengers.empty() && GetMap()->IsGridLoaded(GetPositionX(), GetPositionY())) // 2.
233 }
234 }
236 sScriptMgr->OnTransportUpdate(this, diff);
void Update(int32 diff)
Definition: Timer.h:239
void Reset(int32 interval)
Definition: Timer.h:249
bool Passed() const
Definition: Timer.h:244
virtual void UpdateAI(uint32)
Definition: GameObjectAI.h:42
GOState GetGoState() const
Definition: GameObject.h:207
GameObjectAI * AI() const
Definition: GameObject.h:310
bool AIM_Initialize()
Definition: GameObject.cpp:86
static float NormalizeOrientation(float o)
Definition: Position.h:233
uint32 GetPathProgress() const
Definition: Transport.h:40
bool IsMoving() const
Helpers to know if stop frame was reached.
Definition: Transport.h:91
void MoveToNextWaypoint()
Definition: Transport.cpp:462
float CalculateSegmentPos(float perc)
Definition: Transport.cpp:474
uint32 GetPeriod() const
Definition: Transport.h:78
TimeTrackerSmall _positionChangeTimer
Definition: Transport.h:97
void DoEventIfAny(KeyFrame const &node, bool departure)
Definition: Transport.cpp:655
void SetMoving(bool val)
Definition: Transport.h:92
bool TeleportTransport(uint32 newMapid, float x, float y, float z, float o)
Definition: Transport.cpp:505

References _currentFrame, _nextFrame, _pendingStop, _positionChangeTimer, _staticPassengers, _triggeredArrivalEvent, _triggeredDepartureEvent, GameObject::AI(), GameObject::AIM_Initialize(), CalculateSegmentPos(), GameObjectTemplate::canBeStopped, DoEventIfAny(), GameObject::GetGOInfo(), GameObject::GetGoState(), GetKeyFrames(), WorldObject::GetMap(), Transport::GetPathProgress(), GetPeriod(), Position::GetPositionX(), Position::GetPositionY(), GO_STATE_ACTIVE, GO_STATE_READY, IsMoving(), LoadStaticPassengers(), LOG_ERROR, MoveToNextWaypoint(), Position::NormalizeOrientation(), TimeTrackerSmall::Passed(), TimeTrackerSmall::Reset(), GameObject::SetGoState(), SetMoving(), Transport::SetPathProgress(), sScriptMgr, TeleportTransport(), TimeTrackerSmall::Update(), GameObjectAI::UpdateAI(), and UpdatePosition().

Referenced by Map::Update().

◆ UpdatePassengerPositions()

void MotionTransport::UpdatePassengerPositions ( PassengerSet passengers)
606 for (PassengerSet::iterator itr = passengers.begin(); itr != passengers.end(); ++itr)
607 {
608 WorldObject* passenger = *itr;
609 // transport teleported but passenger not yet (can happen for players)
610 if (passenger->GetMap() != GetMap())
611 continue;
613 // if passenger is on vehicle we have to assume the vehicle is also on transport and its the vehicle that will be updating its passengers
614 if (Unit* unit = passenger->ToUnit())
615 if (unit->GetVehicle())
616 continue;
618 // Do not use Unit::UpdatePosition here, we don't want to remove auras as if regular movement occurred
619 float x, y, z, o;
620 passenger->m_movementInfo.transport.pos.GetPosition(x, y, z, o);
621 CalculatePassengerPosition(x, y, z, &o);
623 // check if position is valid
624 if (!Acore::IsValidMapCoord(x, y, z))
625 continue;
627 switch (passenger->GetTypeId())
628 {
629 case TYPEID_UNIT:
630 {
631 Creature* creature = passenger->ToCreature();
632 GetMap()->CreatureRelocation(creature, x, y, z, o);
634 creature->GetTransportHomePosition(x, y, z, o);
635 CalculatePassengerPosition(x, y, z, &o);
636 creature->SetHomePosition(x, y, z, o);
637 }
638 break;
640 if (passenger->IsInWorld())
641 GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o);
642 break;
644 GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o);
645 break;
647 GetMap()->DynamicObjectRelocation(passenger->ToDynObject(), x, y, z, o);
648 break;
649 default:
650 break;
651 }
652 }
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:335
bool IsInWorld() const
Definition: Object.h:101
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition: Map.cpp:1003
void GameObjectRelocation(GameObject *go, float x, float y, float z, float o)
Definition: Map.cpp:1047
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition: Map.cpp:1025
void DynamicObjectRelocation(DynamicObject *go, float x, float y, float z, float o)
Definition: Map.cpp:1068

References Transport::CalculatePassengerPosition(), Map::CreatureRelocation(), Map::DynamicObjectRelocation(), Map::GameObjectRelocation(), WorldObject::GetMap(), Position::GetPosition(), Creature::GetTransportHomePosition(), Object::GetTypeId(), Object::IsInWorld(), Acore::IsValidMapCoord(), WorldObject::m_movementInfo, Map::PlayerRelocation(), MovementInfo::TransportInfo::pos, Creature::SetHomePosition(), Object::ToCreature(), Object::ToDynObject(), Object::ToGameObject(), Object::ToPlayer(), Object::ToUnit(), MovementInfo::transport, TYPEID_DYNAMICOBJECT, TYPEID_GAMEOBJECT, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by UpdatePosition().

◆ UpdatePosition()

void MotionTransport::UpdatePosition ( float  x,
float  y,
float  z,
float  o 
249 if (!GetMap()->IsGridLoaded(x, y)) // pussywizard: should not happen, but just in case
250 GetMap()->LoadGrid(x, y);
252 Relocate(x, y, z, o);
257 if (_staticPassengers.empty())
259 else
void UpdateModelPosition()
Definition: GameObject.cpp:2955
void UpdatePassengerPositions(PassengerSet &passengers)
Definition: Transport.cpp:604

References Transport::_passengers, _staticPassengers, WorldObject::GetMap(), Map::LoadGrid(), LoadStaticPassengers(), Position::Relocate(), GameObject::UpdateModelPosition(), and UpdatePassengerPositions().

Referenced by TeleportTransport(), and Update().

Friends And Related Function Documentation

◆ TransportMgr::CreateTransport

Member Data Documentation

◆ _currentFrame

KeyFrameVec::const_iterator MotionTransport::_currentFrame

◆ _delayedTeleport

bool MotionTransport::_delayedTeleport

◆ _isMoving

bool MotionTransport::_isMoving

Referenced by IsMoving(), and SetMoving().

◆ _nextFrame

KeyFrameVec::const_iterator MotionTransport::_nextFrame

◆ _passengersLoaded

bool MotionTransport::_passengersLoaded

◆ _pendingStop

bool MotionTransport::_pendingStop

Referenced by EnableMovement(), and Update().

◆ _positionChangeTimer

TimeTrackerSmall MotionTransport::_positionChangeTimer

Referenced by Update().

◆ _staticPassengers

◆ _transportInfo

TransportTemplate const* MotionTransport::_transportInfo

◆ _triggeredArrivalEvent

bool MotionTransport::_triggeredArrivalEvent

These are needed to properly control events triggering only once for each frame.

Referenced by CreateMoTrans(), MoveToNextWaypoint(), and Update().

◆ _triggeredDepartureEvent

bool MotionTransport::_triggeredDepartureEvent

◆ Lock

std::mutex MotionTransport::Lock

Referenced by AddPassenger(), and RemovePassenger().