mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Movement: Restore overriding walk/run mode on individual waypoint level for legacy escort scripts
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user