61 _nextMoveTime.Reset(timer);
67 _nextMoveTime.Reset(1);
75 _nextMoveTime.Reset(overrideTimer);
77 if (_nextMoveTime.Passed())
78 _nextMoveTime.Reset(1);
86 if (!_path || _path->nodes.empty())
89 ASSERT(_currentNode < _path->nodes.size(),
"WaypointMovementGenerator::GetResetPosition: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
90 WaypointNode const &waypoint = _path->nodes.at(_currentNode);
112 TC_LOG_ERROR(
"sql.sql",
"WaypointMovementGenerator::DoInitialize: couldn't load path for creature ({}) (_pathId: {})", owner->
GetGUID().
ToString(), _pathId);
118 _nextMoveTime.Reset(1000);
129 _nextMoveTime.Reset(1);
135 if (!owner || !owner->
IsAlive())
162 StartMove(owner,
true);
178 StartMove(owner,
true);
180 else if (!_nextMoveTime.Passed())
182 if (UpdateTimer(diff))
191 StartMove(owner,
true);
206 if (_nextMoveTime.Passed())
239 if (!_path || _path->nodes.empty())
242 ASSERT(_currentNode < _path->nodes.size(),
"WaypointMovementGenerator::OnArrived: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
243 WaypointNode const& waypoint = _path->nodes[_currentNode];
247 _nextMoveTime.Reset(waypoint.
delay);
252 uint32 pathId = _path->id;
264 AI->WaypointReached(waypointId, pathId);
278 _nextMoveTime.Reset(1000);
286 if (ComputeNextNode())
288 ASSERT(_currentNode < _path->nodes.size(),
"WaypointMovementGenerator::StartMove: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
292 AI->WaypointStarted(_path->nodes[_currentNode].id, _path->id);
296 WaypointNode const &waypoint = _path->nodes[_currentNode];
297 float x = waypoint.
x;
298 float y = waypoint.
y;
299 float z = waypoint.
z;
308 o -= trans->GetOrientation();
310 trans->CalculatePassengerPosition(x, y, z, &o);
320 AI->WaypointPathEnded(waypoint.
id, _path->id);
330 AI->WaypointStarted(_path->nodes[_currentNode].id, _path->id);
333 ASSERT(_currentNode < _path->nodes.size(),
"WaypointMovementGenerator::StartMove: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
334 WaypointNode const &waypoint = _path->nodes[_currentNode];
348 init.
MoveTo(waypoint.
x, waypoint.
y, waypoint.
z);
379 if ((_currentNode == _path->nodes.size() - 1) && !_repeating)
382 _currentNode = (_currentNode + 1) % _path->nodes.size();
388 std::stringstream sstr;
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
@ MOVEMENTGENERATOR_FLAG_TIMED_PAUSED
@ MOVEMENTGENERATOR_FLAG_INITIALIZATION_PENDING
@ MOVEMENTGENERATOR_FLAG_PAUSED
@ MOVEMENTGENERATOR_FLAG_DEACTIVATED
@ MOVEMENTGENERATOR_FLAG_FINALIZED
@ MOVEMENTGENERATOR_FLAG_TRANSITORY
@ MOVEMENTGENERATOR_FLAG_INTERRUPTED
@ MOVEMENTGENERATOR_FLAG_INFORM_ENABLED
@ MOVEMENTGENERATOR_FLAG_INITIALIZED
@ MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
ScriptMapMap sWaypointScripts
uint32 urand(uint32 min, uint32 max)
@ MOVEMENTFLAG_ONTRANSPORT
@ UNIT_STATE_ROAMING_MOVE
@ UNIT_STATE_LOST_CONTROL
@ WAYPOINT_MOVE_TYPE_LAND
@ WAYPOINT_MOVE_TYPE_TAKEOFF
@ WAYPOINT_MOVE_TYPE_WALK
virtual void MovementInform(uint32, uint32)
void SetHomePosition(float x, float y, float z, float o)
uint32 GetWaypointPath() const
void SignalFormationMovement()
bool IsFormationLeaderMoveAllowed() const
void UpdateCurrentWaypointInfo(uint32 nodeId, uint32 pathId)
bool IsFormationLeader() const
void SetTransportHomePosition(float x, float y, float z, float o)
bool IsMovementPreventedByCasting() const override
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
virtual std::string GetDebugInfo() const
void MoveTo(Vector3 const &destination, bool generatePath=true, bool forceDestination=false)
void DisableTransportPathTransformations()
void SetWalk(bool enable)
void SetFacing(float angle)
void SetAnimation(AnimTier anim)
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
virtual std::string GetDebugInfo() const
void ClearUnitState(uint32 f)
Movement::MoveSpline * movespline
void StopMoving(bool force=false)
void AddUnitState(uint32 f)
bool HasUnitMovementFlag(uint32 f) const
bool SetWalk(bool enable)
ObjectGuid GetTransGUID() const override
bool HasUnitState(const uint32 f) const
Transport * GetTransport() const
float GetOrientation() const
void GetPosition(float &x, float &y) const
Optional< float > orientation