mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Movement: allow waypoints to have orientation values of 0
This commit is contained in:
2
sql/updates/world/4.3.4/2021_02_05_00_world.sql
Normal file
2
sql/updates/world/4.3.4/2021_02_05_00_world.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `waypoint_data` CHANGE `orientation` `orientation` FLOAT DEFAULT NULL NULL;
|
||||
UPDATE `waypoint_data` SET `orientation`= NULL WHERE `orientation`= 0;
|
||||
@@ -214,9 +214,8 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature* creature, bool rel
|
||||
init.MoveTo(waypoint.X, waypoint.Y, waypoint.Z);
|
||||
}
|
||||
|
||||
//! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table
|
||||
if (waypoint.Orientation && waypoint.Delay > 0)
|
||||
init.SetFacing(waypoint.Orientation);
|
||||
if (waypoint.Orientation.is_initialized() && waypoint.Delay > 0)
|
||||
init.SetFacing(*waypoint.Orientation);
|
||||
|
||||
switch (waypoint.MoveType)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Define.h"
|
||||
#include "G3D/Vector3.h"
|
||||
#include "Optional.h"
|
||||
#include <vector>
|
||||
|
||||
enum WaypointMoveType
|
||||
@@ -34,7 +35,7 @@ enum WaypointMoveType
|
||||
|
||||
struct WaypointNode
|
||||
{
|
||||
WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), Orientation(0.f), Velocity(0.f), Delay(0), EventId(0), MoveType(WAYPOINT_MOVE_TYPE_RUN), EventChance(0) { }
|
||||
WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), Velocity(0.f), Delay(0), EventId(0), MoveType(WAYPOINT_MOVE_TYPE_RUN), EventChance(0) { }
|
||||
WaypointNode(uint32 id, float x, float y, float z, float orientation = 0.f, float velocity = 0.f, uint32 delay = 0) :
|
||||
Id(id), X(x), Y(y), Z(z), Orientation(orientation), Velocity(velocity), Delay(delay)
|
||||
{
|
||||
@@ -44,7 +45,8 @@ struct WaypointNode
|
||||
}
|
||||
|
||||
uint32 Id;
|
||||
float X, Y, Z, Orientation;
|
||||
float X, Y, Z;
|
||||
Optional<float> Orientation;
|
||||
float Velocity;
|
||||
int32 Delay;
|
||||
uint32 EventId;
|
||||
|
||||
@@ -43,7 +43,10 @@ void WaypointMgr::Load()
|
||||
float x = fields[2].GetFloat();
|
||||
float y = fields[3].GetFloat();
|
||||
float z = fields[4].GetFloat();
|
||||
float o = fields[5].GetFloat();
|
||||
Optional<float> o;
|
||||
if (!fields[5].IsNull())
|
||||
o = fields[5].GetFloat();
|
||||
|
||||
float velocity = fields[6].GetFloat();
|
||||
|
||||
Trinity::NormalizeMapCoord(x);
|
||||
@@ -54,7 +57,8 @@ void WaypointMgr::Load()
|
||||
waypoint.X = x;
|
||||
waypoint.Y = y;
|
||||
waypoint.Z = z;
|
||||
waypoint.Orientation = o;
|
||||
if (o.is_initialized())
|
||||
waypoint.Orientation = o;
|
||||
waypoint.Velocity = velocity;
|
||||
waypoint.MoveType = fields[7].GetUInt32();
|
||||
|
||||
@@ -163,7 +167,10 @@ void WaypointMgr::ReloadPath(uint32 id)
|
||||
float x = fields[1].GetFloat();
|
||||
float y = fields[2].GetFloat();
|
||||
float z = fields[3].GetFloat();
|
||||
float o = fields[4].GetFloat();
|
||||
Optional<float> o;
|
||||
if (!fields[4].IsNull())
|
||||
o = fields[4].GetFloat();
|
||||
|
||||
float velocity = fields[5].GetFloat();
|
||||
|
||||
Trinity::NormalizeMapCoord(x);
|
||||
@@ -174,7 +181,8 @@ void WaypointMgr::ReloadPath(uint32 id)
|
||||
waypoint.X = x;
|
||||
waypoint.Y = y;
|
||||
waypoint.Z = z;
|
||||
waypoint.Orientation = o;
|
||||
if (o.is_initialized())
|
||||
waypoint.Orientation = o;
|
||||
waypoint.Velocity = velocity;
|
||||
waypoint.MoveType = fields[6].GetUInt32();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user