Core/Movement: Restore overriding walk/run mode on individual waypoint level for legacy escort scripts

This commit is contained in:
Shauren
2026-01-01 00:13:40 +01:00
parent 5c0de6977c
commit ef97fb4ea7
4 changed files with 14 additions and 15 deletions

View File

@@ -257,8 +257,7 @@ void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientati
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
WaypointNode& waypoint = _path.Nodes.emplace_back(id, x, y, z, orientation, waitTime);
waypoint.MoveType = run ? WaypointMoveType::Run : WaypointMoveType::Walk;
_path.Nodes.emplace_back(id, x, y, z, orientation, waitTime, run ? WaypointMoveType::Run : WaypointMoveType::Walk);
}
void EscortAI::ResetPath()

View File

@@ -554,7 +554,7 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature* owner, bool relaun
&& (lastWaypointForSegment->Delay || (_isReturningToStart ? _currentNode == 0 : _currentNode == path->Nodes.size() - 1)))
init.SetFacing(*lastWaypointForSegment->Orientation);
switch (path->MoveType)
switch (lastWaypointForSegment->MoveType.value_or(path->MoveType))
{
case WaypointMoveType::Land:
init.SetAnimation(AnimTier::Ground);

View File

@@ -49,17 +49,17 @@ DEFINE_ENUM_FLAG(WaypointPathFlags);
struct WaypointNode
{
constexpr WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { }
constexpr WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {})
: Id(id), X(x), Y(y), Z(z), Orientation(orientation), Delay(delay), MoveType(WaypointMoveType::Walk) { }
constexpr WaypointNode() = default;
constexpr WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = {}, Optional<Milliseconds> delay = {}, Optional<WaypointMoveType> moveType = {})
: Id(id), X(x), Y(y), Z(z), Orientation(orientation), Delay(delay), MoveType(moveType) { }
uint32 Id;
float X;
float Y;
float Z;
Optional<float> Orientation;
Optional<Milliseconds> Delay;
WaypointMoveType MoveType;
uint32 Id = 0;
float X = 0.0f;
float Y = 0.0f;
float Z = 0.0f;
Optional<float> Orientation = {};
Optional<Milliseconds> Delay = {};
Optional<WaypointMoveType> MoveType = {};
};
struct WaypointPath

View File

@@ -355,8 +355,8 @@ void WaypointPath::BuildSegments()
{
++ContinuousSegments.back().second;
// split on delay
if (i + 1 != Nodes.size() && Nodes[i].Delay)
// split on delay or different move type
if (i + 1 != Nodes.size() && (Nodes[i].Delay || Nodes[i].MoveType != Nodes[i + 1].MoveType))
ContinuousSegments.emplace_back(i, 1);
}
}