2022-09-08 12:41:56 -07:00
|
|
|
|
using GTA.Math;
|
2022-05-23 15:27:51 +08:00
|
|
|
|
using Lidgren.Network;
|
|
|
|
|
|
|
|
|
|
namespace RageCoop.Core
|
|
|
|
|
{
|
2022-07-01 14:39:43 +08:00
|
|
|
|
internal partial class Packets
|
2022-05-23 15:27:51 +08:00
|
|
|
|
{
|
2022-07-01 14:39:43 +08:00
|
|
|
|
internal class ProjectileSync : Packet
|
2022-05-25 10:09:59 +08:00
|
|
|
|
{
|
2022-09-08 12:41:56 -07:00
|
|
|
|
public override PacketType Type => PacketType.ProjectileSync;
|
2022-05-25 10:09:59 +08:00
|
|
|
|
public int ID { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
public int ShooterID { get; set; }
|
|
|
|
|
public uint WeaponHash { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-30 14:32:38 +08:00
|
|
|
|
public Vector3 Position { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-30 14:32:38 +08:00
|
|
|
|
public Vector3 Rotation { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-30 14:32:38 +08:00
|
|
|
|
public Vector3 Velocity { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-08-14 17:08:43 +08:00
|
|
|
|
public ProjectileDataFlags Flags { get; set; }
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-08 12:37:06 -07:00
|
|
|
|
protected override void Serialize(NetOutgoingMessage m)
|
2022-05-25 10:09:59 +08:00
|
|
|
|
{
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-09-08 12:37:06 -07:00
|
|
|
|
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Write id
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(ID);
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Write ShooterID
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(ShooterID);
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(WeaponHash);
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Write position
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(Position);
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Write rotation
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(Rotation);
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
|
|
|
|
// Write velocity
|
2022-09-08 12:37:06 -07:00
|
|
|
|
m.Write(Velocity);
|
|
|
|
|
m.Write((byte)Flags);
|
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 12:37:06 -07:00
|
|
|
|
public override void Deserialize(NetIncomingMessage m)
|
2022-05-25 10:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
#region NetIncomingMessageToPacket
|
2022-09-08 12:37:06 -07:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
|
|
|
|
// Read id
|
2022-09-08 12:37:06 -07:00
|
|
|
|
ID = m.ReadInt32();
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
|
|
|
|
// Read ShooterID
|
2022-09-08 12:41:56 -07:00
|
|
|
|
ShooterID = m.ReadInt32();
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
2022-09-08 12:41:56 -07:00
|
|
|
|
WeaponHash = m.ReadUInt32();
|
2022-05-25 10:09:59 +08:00
|
|
|
|
|
|
|
|
|
// Read position
|
2022-09-08 12:37:06 -07:00
|
|
|
|
Position = m.ReadVector3();
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Read rotation
|
2022-09-08 12:37:06 -07:00
|
|
|
|
Rotation = m.ReadVector3();
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
// Read velocity
|
2022-09-08 12:41:56 -07:00
|
|
|
|
Velocity = m.ReadVector3();
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-09-08 12:41:56 -07:00
|
|
|
|
Flags = (ProjectileDataFlags)m.ReadByte();
|
2022-05-23 15:27:51 +08:00
|
|
|
|
|
2022-05-25 10:09:59 +08:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
2022-05-23 15:27:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|