TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FollowMovementGenerator< T > Class Template Reference

#include <TargetedMovementGenerator.h>

Public Member Functions

 FollowMovementGenerator (Unit *target)
 
 FollowMovementGenerator (Unit *target, float offset, float angle)
 
 ~FollowMovementGenerator ()
 
MovementGeneratorType GetMovementGeneratorType () const override
 
void DoInitialize (T *)
 
void DoFinalize (T *)
 
void DoReset (T *)
 
void MovementInform (T *)
 
bool EnableWalking () const
 
bool _lostTarget (T *) const
 
void _reachTarget (T *)
 
template<>
bool EnableWalking () const
 
template<>
bool EnableWalking () const
 
template<>
void DoInitialize (Player *owner)
 
template<>
void DoInitialize (Creature *owner)
 
template<>
void MovementInform (Creature *unit)
 
- Public Member Functions inherited from TargetedMovementGeneratorMedium< T, FollowMovementGenerator< T > >
bool DoUpdate (T *, uint32)
 
UnitGetTarget () const
 
void unitSpeedChanged () override
 
bool IsReachable () const
 
- Public Member Functions inherited from MovementGeneratorMedium< T, FollowMovementGenerator< T > >
void Initialize (Unit *u) override
 
void Finalize (Unit *u) override
 
void Reset (Unit *u) override
 
bool Update (Unit *u, uint32 time_diff) override
 
- Public Member Functions inherited from MovementGenerator
virtual ~MovementGenerator ()
 
virtual bool GetResetPosition (Unit *, float &, float &, float &)
 
- Public Member Functions inherited from TargetedMovementGeneratorBase
 TargetedMovementGeneratorBase (Unit *target)
 
void stopFollowing ()
 

Static Public Member Functions

static void _clearUnitStateMove (T *u)
 
static void _addUnitStateMove (T *u)
 

Private Member Functions

void _updateSpeed (T *owner)
 
template<>
void _updateSpeed (Player *)
 
template<>
void _updateSpeed (Creature *owner)
 

Additional Inherited Members

- Protected Member Functions inherited from TargetedMovementGeneratorMedium< T, FollowMovementGenerator< T > >
 TargetedMovementGeneratorMedium (Unit *target, float offset, float angle)
 
 ~TargetedMovementGeneratorMedium ()
 
void _setTargetLocation (T *owner, bool updateDestination)
 
- Protected Attributes inherited from TargetedMovementGeneratorMedium< T, FollowMovementGenerator< T > >
PathGeneratori_path
 
TimeTrackerSmall i_recheckDistance
 
float i_offset
 
float i_angle
 
bool i_recalculateTravel
 
bool i_targetReached
 
- Protected Attributes inherited from TargetedMovementGeneratorBase
FollowerReference i_target
 

Constructor & Destructor Documentation

template<class T>
FollowMovementGenerator< T >::FollowMovementGenerator ( Unit target)
inline
Definition: TargetedMovementGenerator.h:38
template<class T>
FollowMovementGenerator< T >::FollowMovementGenerator ( Unit target,
float  offset,
float  angle 
)
inline
Definition: TargetedMovementGenerator.h:38
template<class T>
FollowMovementGenerator< T >::~FollowMovementGenerator ( )
inline
98 { }

Member Function Documentation

template<class T>
static void FollowMovementGenerator< T >::_addUnitStateMove ( T *  u)
inlinestatic
108 { u->AddUnitState(UNIT_STATE_FOLLOW_MOVE); }
Definition: Unit.h:576
template<class T>
static void FollowMovementGenerator< T >::_clearUnitStateMove ( T *  u)
inlinestatic
107 { u->ClearUnitState(UNIT_STATE_FOLLOW_MOVE); }
Definition: Unit.h:576
template<class T>
bool FollowMovementGenerator< T >::_lostTarget ( T *  ) const
inline
110 { return false; }
template<class T>
void FollowMovementGenerator< T >::_reachTarget ( T *  )
inline
111 { }
template<class T>
void FollowMovementGenerator< T >::_updateSpeed ( T *  owner)
private
template<>
void FollowMovementGenerator< Player >::_updateSpeed ( Player )
private
256 {
257  // nothing to do for Player
258 }
template<>
void FollowMovementGenerator< Creature >::_updateSpeed ( Creature owner)
private

Make sure we are not in the process of a map change (IsInWorld)

262 {
263  // pet only sync speed with owner
265  if (!owner->IsPet() || !owner->IsInWorld() || !i_target.isValid() || i_target->GetGUID() != owner->GetOwnerGUID())
266  return;
267 
268  owner->UpdateSpeed(MOVE_RUN, true);
269  owner->UpdateSpeed(MOVE_WALK, true);
270  owner->UpdateSpeed(MOVE_SWIM, true);
271 }
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
FollowerReference i_target
Definition: TargetedMovementGenerator.h:34
Definition: Unit.h:599
Definition: Unit.h:602
bool IsPet() const
Definition: Unit.h:1403
Definition: Unit.h:600
bool isValid() const
Definition: Reference.h:78
bool IsInWorld() const
Definition: Object.h:100
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1698

+ Here is the call graph for this function:

template<class T >
template void FollowMovementGenerator< T >::DoFinalize ( T *  )
291 {
292  owner->ClearUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE);
293  _updateSpeed(owner);
294 }
void _updateSpeed(T *owner)
Definition: Unit.h:559
Definition: Unit.h:576
template<class T>
void FollowMovementGenerator< T >::DoInitialize ( T *  )
template<>
void FollowMovementGenerator< Player >::DoInitialize ( Player owner)
275 {
276  owner->AddUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE);
277  _updateSpeed(owner);
278  _setTargetLocation(owner, true);
279 }
void _updateSpeed(T *owner)
Definition: Unit.h:559
Definition: Unit.h:576
template<>
void FollowMovementGenerator< Creature >::DoInitialize ( Creature owner)
283 {
285  _updateSpeed(owner);
286  _setTargetLocation(owner, true);
287 }
void AddUnitState(uint32 f)
Definition: Unit.h:1394
void _updateSpeed(T *owner)
Definition: Unit.h:559
Definition: Unit.h:576

+ Here is the call graph for this function:

template<class T >
template void FollowMovementGenerator< T >::DoReset ( T *  )
298 {
299  DoInitialize(owner);
300 }
template<class T>
bool FollowMovementGenerator< T >::EnableWalking ( ) const
template<>
bool FollowMovementGenerator< Creature >::EnableWalking ( ) const
244 {
245  return i_target.isValid() && i_target->IsWalking();
246 }
FollowerReference i_target
Definition: TargetedMovementGenerator.h:34
bool isValid() const
Definition: Reference.h:78
template<>
bool FollowMovementGenerator< Player >::EnableWalking ( ) const
250 {
251  return false;
252 }
template<class T>
MovementGeneratorType FollowMovementGenerator< T >::GetMovementGeneratorType ( ) const
inlineoverridevirtual

Implements MovementGenerator.

100 { return FOLLOW_MOTION_TYPE; }
Definition: MotionMaster.h:52
template<class T >
void FollowMovementGenerator< T >::MovementInform ( T *  )
303 { }
template<>
void FollowMovementGenerator< Creature >::MovementInform ( Creature unit)
307 {
308  // Pass back the GUIDLow of the target. If it is pet's owner then PetAI will handle
309  if (unit->AI())
311 }
FollowerReference i_target
Definition: TargetedMovementGenerator.h:34
CreatureAI * AI() const
Definition: Creature.h:525
ObjectGuid const & GetGUID() const
Definition: Object.h:105
virtual void MovementInform(uint32, uint32)
Definition: CreatureAI.h:143
TO * getTarget() const
Definition: Reference.h:94
Definition: MotionMaster.h:52
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: