Core/Movement: add velocity field to waypoint_data to allow specifying custom speed value for waypoints and cyclic splines

* standartized member naming in WaypointNode and WaypointPath struct
This commit is contained in:
Ovahlord committed 2020-09-24 14:30:48 +02:00
1 parent 8bbe17c684
commit 361ac2292b
12 files changed
+144 -133

No files matched your search

+12 -12
View File
@@ -73,7 +73,7 @@ void SmartAI::StartPath(bool run/* = false*/, uint32 pathId/* = 0*/, bool repeat
return;
}
if (_path.nodes.empty())
if (_path.Nodes.empty())
return;
_currentWaypointNode = nodeId;
@@ -101,19 +101,19 @@ bool SmartAI::LoadPath(uint32 entry)
return false;
WaypointPath const* path = sSmartWaypointMgr->GetPath(entry);
if (!path || path->nodes.empty())
if (!path || path->Nodes.empty())
{
GetScript()->SetPathId(0);
return false;
}
_path.id = path->id;
_path.nodes = path->nodes;
for (WaypointNode& waypoint : _path.nodes)
_path.Id = path->Id;
_path.Nodes = path->Nodes;
for (WaypointNode& waypoint : _path.Nodes)
{
Trinity::NormalizeMapCoord(waypoint.x);
Trinity::NormalizeMapCoord(waypoint.y);
waypoint.moveType = _run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
Trinity::NormalizeMapCoord(waypoint.X);
Trinity::NormalizeMapCoord(waypoint.Y);
waypoint.MoveType = _run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
}
GetScript()->SetPathId(entry);
@@ -197,7 +197,7 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
void SmartAI::EndPath(bool fail)
{
RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
_path.nodes.clear();
_path.Nodes.clear();
_waypointPauseTimer = 0;
if (_escortNPCFlags)
@@ -459,7 +459,7 @@ void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId)
}
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
if (_currentWaypointNode == _path.nodes.size())
if (_currentWaypointNode == _path.Nodes.size())
_waypointPathEnded = true;
else
SetRun(_run);
@@ -790,8 +790,8 @@ void SmartAI::SetRun(bool run)
me->SetWalk(!run);
_run = run;
for (auto& node : _path.nodes)
node.moveType = run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
for (auto& node : _path.Nodes)
node.MoveType = run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
}
void SmartAI::SetDisableGravity(bool fly)