Core/Movement: Allow waypoints to use 0 as valid facing value
Port From (https://github.com/TrinityCore/TrinityCore/commit/8501fb572a38b7d278c6e37d7b32164c63771550)
This commit is contained in:
@@ -352,7 +352,9 @@ namespace Game.AI
|
||||
float x = result.Read<float>(2);
|
||||
float y = result.Read<float>(3);
|
||||
float z = result.Read<float>(4);
|
||||
float o = result.Read<float>(5);
|
||||
float? o = null;
|
||||
if (!result.IsNull(5))
|
||||
o = result.Read<float>(5);
|
||||
uint delay = result.Read<uint>(6);
|
||||
|
||||
if (lastEntry != entry)
|
||||
|
||||
@@ -351,9 +351,8 @@ namespace Game.Movement
|
||||
//! but formationDest contains global coordinates
|
||||
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 != 0 && waypoint.delay != 0)
|
||||
init.SetFacing(waypoint.orientation);
|
||||
if (waypoint.orientation.HasValue && waypoint.delay != 0)
|
||||
init.SetFacing(waypoint.orientation.Value);
|
||||
|
||||
switch (waypoint.moveType)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,9 @@ namespace Game
|
||||
float x = result.Read<float>(2);
|
||||
float y = result.Read<float>(3);
|
||||
float z = result.Read<float>(4);
|
||||
float o = result.Read<float>(5);
|
||||
float? o = null;
|
||||
if (!result.IsNull(5))
|
||||
o = result.Read<float>(5);
|
||||
|
||||
GridDefines.NormalizeMapCoord(ref x);
|
||||
GridDefines.NormalizeMapCoord(ref y);
|
||||
@@ -100,7 +102,9 @@ namespace Game
|
||||
float x = result.Read<float>(1);
|
||||
float y = result.Read<float>(2);
|
||||
float z = result.Read<float>(3);
|
||||
float o = result.Read<float>(4);
|
||||
float? o = null;
|
||||
if (!result.IsNull(4))
|
||||
o = result.Read<float>(4);
|
||||
|
||||
GridDefines.NormalizeMapCoord(ref x);
|
||||
GridDefines.NormalizeMapCoord(ref y);
|
||||
@@ -141,7 +145,7 @@ namespace Game
|
||||
public class WaypointNode
|
||||
{
|
||||
public WaypointNode() { moveType = WaypointMoveType.Run; }
|
||||
public WaypointNode(uint _id, float _x, float _y, float _z, float _orientation = 0.0f, uint _delay = 0)
|
||||
public WaypointNode(uint _id, float _x, float _y, float _z, float? _orientation = null, uint _delay = 0)
|
||||
{
|
||||
id = _id;
|
||||
x = _x;
|
||||
@@ -155,7 +159,8 @@ namespace Game
|
||||
}
|
||||
|
||||
public uint id;
|
||||
public float x, y, z, orientation;
|
||||
public float x, y, z;
|
||||
public float? orientation;
|
||||
public uint delay;
|
||||
public uint eventId;
|
||||
public WaypointMoveType moveType;
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace Game.Scripting
|
||||
|
||||
WaypointPath path = _waypointStore[entry];
|
||||
path.id = entry;
|
||||
path.nodes.Add(new WaypointNode(id, x, y, z, 0.0f, waitTime));
|
||||
path.nodes.Add(new WaypointNode(id, x, y, z, null, waitTime));
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user