Core/Movement: Defined movement force type enum
Port From (https://github.com/TrinityCore/TrinityCore/commit/e2de5000acba888e2ae3177893f6063340902ffd)
This commit is contained in:
@@ -136,4 +136,10 @@ namespace Framework.Constants
|
|||||||
Mount = 1,
|
Mount = 1,
|
||||||
Force = 2
|
Force = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MovementForceType
|
||||||
|
{
|
||||||
|
SingleDirectional = 0, // always in a single direction
|
||||||
|
Gravity = 1 // pushes/pulls away from a single point
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3509,7 +3509,7 @@ namespace Game.Entities
|
|||||||
public Vector3 Direction;
|
public Vector3 Direction;
|
||||||
public uint TransportID;
|
public uint TransportID;
|
||||||
public float Magnitude;
|
public float Magnitude;
|
||||||
public byte Type;
|
public MovementForceType Type;
|
||||||
public int Unused910;
|
public int Unused910;
|
||||||
|
|
||||||
public void Read(WorldPacket data)
|
public void Read(WorldPacket data)
|
||||||
@@ -3519,7 +3519,7 @@ namespace Game.Entities
|
|||||||
Direction = data.ReadVector3();
|
Direction = data.ReadVector3();
|
||||||
TransportID = data.ReadUInt32();
|
TransportID = data.ReadUInt32();
|
||||||
Magnitude = data.ReadFloat();
|
Magnitude = data.ReadFloat();
|
||||||
Type = data.ReadBits<byte>(2);
|
Type = (MovementForceType)data.ReadBits<byte>(2);
|
||||||
bool has910 = data.HasBit();
|
bool has910 = data.HasBit();
|
||||||
if (has910)
|
if (has910)
|
||||||
Unused910 = data.ReadInt32();
|
Unused910 = data.ReadInt32();
|
||||||
|
|||||||
@@ -1481,7 +1481,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public MovementForces GetMovementForces() { return _movementForces; }
|
public MovementForces GetMovementForces() { return _movementForces; }
|
||||||
|
|
||||||
void ApplyMovementForce(ObjectGuid id, Vector3 origin, float magnitude, byte type, Vector3 direction, ObjectGuid transportGuid = default)
|
void ApplyMovementForce(ObjectGuid id, Vector3 origin, float magnitude, MovementForceType type, Vector3 direction, ObjectGuid transportGuid = default)
|
||||||
{
|
{
|
||||||
if (_movementForces == null)
|
if (_movementForces == null)
|
||||||
_movementForces = new MovementForces();
|
_movementForces = new MovementForces();
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ namespace Game.Networking.Packets
|
|||||||
{
|
{
|
||||||
data.WritePackedGuid(movementForce.ID);
|
data.WritePackedGuid(movementForce.ID);
|
||||||
data.WriteVector3(movementForce.Origin);
|
data.WriteVector3(movementForce.Origin);
|
||||||
if (movementForce.Type == 1 && objectPosition != null) // gravity
|
if (movementForce.Type == MovementForceType.Gravity && objectPosition != null) // gravity
|
||||||
{
|
{
|
||||||
Vector3 direction = Vector3.Zero;
|
Vector3 direction = Vector3.Zero;
|
||||||
if (movementForce.Magnitude != 0.0f)
|
if (movementForce.Magnitude != 0.0f)
|
||||||
@@ -322,7 +322,7 @@ namespace Game.Networking.Packets
|
|||||||
|
|
||||||
data.WriteUInt32(movementForce.TransportID);
|
data.WriteUInt32(movementForce.TransportID);
|
||||||
data.WriteFloat(movementForce.Magnitude);
|
data.WriteFloat(movementForce.Magnitude);
|
||||||
data.WriteBits(movementForce.Type, 2);
|
data.WriteBits((byte)movementForce.Type, 2);
|
||||||
data.WriteBit(movementForce.Unused910 != 0);
|
data.WriteBit(movementForce.Unused910 != 0);
|
||||||
data.FlushBits();
|
data.FlushBits();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user