Core/Movement: Added Velocity field to waypoint_path table

Port From (https://github.com/TrinityCore/TrinityCore/commit/e8f7d4153622aea70ac74fb73e134d51cdac821d)
This commit is contained in:
Hondacrx
2024-08-04 16:40:44 -04:00
parent ff7e37f708
commit 65007add12
2 changed files with 16 additions and 1 deletions
@@ -430,6 +430,9 @@ namespace Game.Movement
break; break;
} }
if (_path.Velocity.HasValue && !_speed.HasValue)
_speed = _path.Velocity;
if (_speed.HasValue) if (_speed.HasValue)
init.SetVelocity(_speed.Value); init.SetVelocity(_speed.Value);
+13 -1
View File
@@ -76,7 +76,6 @@ namespace Game
uint pathId = fields.Read<uint>(0); uint pathId = fields.Read<uint>(0);
WaypointPath path = new(); WaypointPath path = new();
path.Id = pathId;
path.MoveType = (WaypointMoveType)fields.Read<byte>(1); path.MoveType = (WaypointMoveType)fields.Read<byte>(1);
if (path.MoveType >= WaypointMoveType.Max) if (path.MoveType >= WaypointMoveType.Max)
@@ -84,7 +83,19 @@ namespace Game
Log.outError(LogFilter.Sql, $"PathId {pathId} in `waypoint_path` has invalid MoveType {path.MoveType}, ignoring"); Log.outError(LogFilter.Sql, $"PathId {pathId} in `waypoint_path` has invalid MoveType {path.MoveType}, ignoring");
return; return;
} }
path.Id = pathId;
path.Flags = (WaypointPathFlags)fields.Read<byte>(2); path.Flags = (WaypointPathFlags)fields.Read<byte>(2);
if (!fields.IsNull(3))
{
float velocity = fields.Read<float>(3);
if (velocity > 0.0f)
path.Velocity = velocity;
else
Log.outError(LogFilter.Sql, $"PathId {pathId} in `waypoint_path` has invalid velocity {velocity}, using default velocity instead");
}
path.Nodes.Clear(); path.Nodes.Clear();
_pathStorage.Add(pathId, path); _pathStorage.Add(pathId, path);
@@ -325,6 +336,7 @@ namespace Game
public uint Id; public uint Id;
public WaypointMoveType MoveType; public WaypointMoveType MoveType;
public WaypointPathFlags Flags = WaypointPathFlags.None; public WaypointPathFlags Flags = WaypointPathFlags.None;
public float? Velocity;
} }
public enum WaypointMoveType public enum WaypointMoveType