Core/Misc: waypoint movement
Port From (https://github.com/TrinityCore/TrinityCore/commit/bf12bae46746149d870cd3e52ccd610f0a975047)
This commit is contained in:
@@ -67,9 +67,9 @@ namespace Game.Entities
|
||||
|
||||
LootModes m_LootMode; // Bitmask (default: LOOT_MODE_DEFAULT) that determines what loot will be lootable
|
||||
|
||||
//WaypointMovementGenerator vars
|
||||
uint m_waypointID;
|
||||
uint m_path_id;
|
||||
// Waypoint path
|
||||
uint _waypointPathId;
|
||||
(uint nodeId, uint pathId) _currentWaypointNodeInfo;
|
||||
|
||||
//Formation var
|
||||
CreatureGroup m_formation;
|
||||
|
||||
@@ -53,6 +53,8 @@ namespace Game.Entities
|
||||
ResetLootMode(); // restore default loot mode
|
||||
|
||||
m_homePosition = new WorldLocation();
|
||||
|
||||
_currentWaypointNodeInfo = new();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -2334,7 +2336,7 @@ namespace Game.Entities
|
||||
|
||||
//Load Path
|
||||
if (cainfo.path_id != 0)
|
||||
m_path_id = cainfo.path_id;
|
||||
_waypointPathId = cainfo.path_id;
|
||||
|
||||
if (cainfo.auras != null)
|
||||
{
|
||||
@@ -3200,12 +3202,12 @@ namespace Game.Entities
|
||||
public void GetTransportHomePosition(out float x, out float y, out float z, out float ori) { m_transportHomePosition.GetPosition(out x, out y, out z, out ori); }
|
||||
public Position GetTransportHomePosition() { return m_transportHomePosition; }
|
||||
|
||||
public uint GetWaypointPath() { return m_path_id; }
|
||||
public void LoadPath(uint pathid) { m_path_id = pathid; }
|
||||
|
||||
public uint GetCurrentWaypointID() { return m_waypointID; }
|
||||
public void UpdateWaypointID(uint wpID) { m_waypointID = wpID; }
|
||||
public uint GetWaypointPath() { return _waypointPathId; }
|
||||
public void LoadPath(uint pathid) { _waypointPathId = pathid; }
|
||||
|
||||
public (uint nodeId, uint pathId) GetCurrentWaypointInfo() { return _currentWaypointNodeInfo; }
|
||||
public void UpdateCurrentWaypointInfo(uint nodeId, uint pathId) { _currentWaypointNodeInfo = (nodeId, pathId); }
|
||||
|
||||
public CreatureGroup GetFormation() { return m_formation; }
|
||||
public void SetFormation(CreatureGroup formation) { m_formation = formation; }
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
if (pair.Value.point_1 != 0)
|
||||
if (m_leader.GetCurrentWaypointID() == pair.Value.point_1 - 1 || m_leader.GetCurrentWaypointID() == pair.Value.point_2 - 1)
|
||||
if (m_leader.GetCurrentWaypointInfo().nodeId == pair.Value.point_1 - 1 || m_leader.GetCurrentWaypointInfo().nodeId == pair.Value.point_2 - 1)
|
||||
pair.Value.follow_angle = (float)Math.PI * 2 - pair.Value.follow_angle;
|
||||
|
||||
float angle = pair.Value.follow_angle;
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Game.Entities
|
||||
init.Stop();
|
||||
}
|
||||
|
||||
public void PauseMovement(uint timer = 0, MovementSlot slot = 0)
|
||||
public void PauseMovement(uint timer = 0, MovementSlot slot = 0, bool forced = true)
|
||||
{
|
||||
if (slot >= MovementSlot.Max)
|
||||
return;
|
||||
@@ -168,7 +168,8 @@ namespace Game.Entities
|
||||
if (movementGenerator != null)
|
||||
movementGenerator.Pause(timer);
|
||||
|
||||
StopMoving();
|
||||
if (forced)
|
||||
StopMoving();
|
||||
}
|
||||
|
||||
public void ResumeMovement(uint timer = 0, MovementSlot slot = 0)
|
||||
|
||||
Reference in New Issue
Block a user