diff --git a/Client/Entities/EntitiesPed.cs b/Client/Entities/EntitiesPed.cs index 0be282c..8f630e7 100644 --- a/Client/Entities/EntitiesPed.cs +++ b/Client/Entities/EntitiesPed.cs @@ -51,6 +51,7 @@ namespace CoopClient private int[] LastVehicleColors = new int[] { 0, 0 }; public int[] VehicleColors { get; set; } public bool VehicleDead { get; set; } + public float VehicleEngineHealth { get; set; } public int VehicleSeatIndex { get; set; } public Vehicle MainVehicle { get; set; } public Vector3 VehiclePosition { get; set; } @@ -303,6 +304,8 @@ namespace CoopClient return; } + MainVehicle.EngineHealth = VehicleEngineHealth; + if (VehicleDead && !MainVehicle.IsDead) { MainVehicle.Explode(); diff --git a/Client/Networking.cs b/Client/Networking.cs index 2c4ea97..9be1189 100644 --- a/Client/Networking.cs +++ b/Client/Networking.cs @@ -340,6 +340,7 @@ namespace CoopClient player.VehicleSeatIndex = packet.VehSeatIndex; player.VehiclePosition = packet.VehPosition.ToVector(); player.VehicleRotation = packet.VehRotation.ToQuaternion(); + player.VehicleEngineHealth = packet.VehEngineHealth; player.VehicleVelocity = packet.VehVelocity.ToVector(); player.VehicleSpeed = packet.VehSpeed; player.VehicleSteeringAngle = packet.VehSteeringAngle; @@ -488,6 +489,7 @@ namespace CoopClient npc.VehicleSeatIndex = packet.VehSeatIndex; npc.VehiclePosition = packet.VehPosition.ToVector(); npc.VehicleRotation = packet.VehRotation.ToQuaternion(); + npc.VehicleEngineHealth = packet.VehEngineHealth; npc.VehicleVelocity = packet.VehVelocity.ToVector(); npc.VehicleSpeed = packet.VehSpeed; npc.VehicleSteeringAngle = packet.VehSteeringAngle; @@ -516,6 +518,7 @@ namespace CoopClient VehicleSeatIndex = packet.VehSeatIndex, VehiclePosition = packet.VehPosition.ToVector(), VehicleRotation = packet.VehRotation.ToQuaternion(), + VehicleEngineHealth = packet.VehEngineHealth, VehicleVelocity = packet.VehVelocity.ToVector(), VehicleSpeed = packet.VehSpeed, VehicleSteeringAngle = packet.VehSteeringAngle, @@ -593,6 +596,7 @@ namespace CoopClient VehSeatIndex = (int)player.SeatIndex, VehPosition = player.CurrentVehicle.Position.ToLVector(), VehRotation = player.CurrentVehicle.Quaternion.ToLQuaternion(), + VehEngineHealth = player.CurrentVehicle.EngineHealth, VehVelocity = player.CurrentVehicle.Velocity.ToLVector(), VehSpeed = player.CurrentVehicle.Speed, VehSteeringAngle = player.CurrentVehicle.SteeringAngle, @@ -694,6 +698,7 @@ namespace CoopClient VehSeatIndex = (int)npc.SeatIndex, VehPosition = npc.CurrentVehicle.Position.ToLVector(), VehRotation = npc.CurrentVehicle.Quaternion.ToLQuaternion(), + VehEngineHealth = npc.CurrentVehicle.EngineHealth, VehVelocity = npc.CurrentVehicle.Velocity.ToLVector(), VehSpeed = npc.CurrentVehicle.Speed, VehSteeringAngle = npc.CurrentVehicle.SteeringAngle, diff --git a/Client/Packets.cs b/Client/Packets.cs index e7e36d2..c5a7e37 100644 --- a/Client/Packets.cs +++ b/Client/Packets.cs @@ -396,21 +396,24 @@ namespace CoopClient public LQuaternion VehRotation { get; set; } [ProtoMember(8)] - public LVector3 VehVelocity { get; set; } + public float VehEngineHealth { get; set; } [ProtoMember(9)] - public float VehSpeed { get; set; } + public LVector3 VehVelocity { get; set; } [ProtoMember(10)] - public float VehSteeringAngle { get; set; } + public float VehSpeed { get; set; } [ProtoMember(11)] - public int[] VehColors { get; set; } + public float VehSteeringAngle { get; set; } [ProtoMember(12)] - public VehicleDoors[] VehDoors { get; set; } + public int[] VehColors { get; set; } [ProtoMember(13)] + public VehicleDoors[] VehDoors { get; set; } + + [ProtoMember(14)] public byte? Flag { get; set; } = 0; public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) @@ -436,6 +439,7 @@ namespace CoopClient VehSeatIndex = data.VehSeatIndex; VehPosition = data.VehPosition; VehRotation = data.VehRotation; + VehEngineHealth = data.VehEngineHealth; VehVelocity = data.VehVelocity; VehSpeed = data.VehSpeed; VehSteeringAngle = data.VehSteeringAngle; @@ -682,21 +686,24 @@ namespace CoopClient public LQuaternion VehRotation { get; set; } [ProtoMember(10)] - public LVector3 VehVelocity { get; set; } + public float VehEngineHealth { get; set; } [ProtoMember(11)] - public float VehSpeed { get; set; } + public LVector3 VehVelocity { get; set; } [ProtoMember(12)] - public float VehSteeringAngle { get; set; } + public float VehSpeed { get; set; } [ProtoMember(13)] - public int[] VehColors { get; set; } + public float VehSteeringAngle { get; set; } [ProtoMember(14)] - public VehicleDoors[] VehDoors { get; set; } + public int[] VehColors { get; set; } [ProtoMember(15)] + public VehicleDoors[] VehDoors { get; set; } + + [ProtoMember(16)] public byte? Flag { get; set; } = 0; public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) @@ -724,6 +731,7 @@ namespace CoopClient VehSeatIndex = data.VehSeatIndex; VehPosition = data.VehPosition; VehRotation = data.VehRotation; + VehEngineHealth = data.VehEngineHealth; VehVelocity = data.VehVelocity; VehSpeed = data.VehSpeed; VehSteeringAngle = data.VehSteeringAngle; diff --git a/Server/Packets.cs b/Server/Packets.cs index 4d6692d..fbff23c 100644 --- a/Server/Packets.cs +++ b/Server/Packets.cs @@ -328,21 +328,24 @@ namespace CoopServer public LQuaternion VehRotation { get; set; } [ProtoMember(8)] - public LVector3 VehVelocity { get; set; } + public float VehEngineHealth { get; set; } [ProtoMember(9)] - public float VehSpeed { get; set; } + public LVector3 VehVelocity { get; set; } [ProtoMember(10)] - public float VehSteeringAngle { get; set; } + public float VehSpeed { get; set; } [ProtoMember(11)] - public int[] VehColors { get; set; } + public float VehSteeringAngle { get; set; } [ProtoMember(12)] - public VehicleDoors[] VehDoors { get; set; } + public int[] VehColors { get; set; } [ProtoMember(13)] + public VehicleDoors[] VehDoors { get; set; } + + [ProtoMember(14)] public byte? Flag { get; set; } = 0; public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) @@ -368,6 +371,7 @@ namespace CoopServer VehSeatIndex = data.VehSeatIndex; VehPosition = data.VehPosition; VehRotation = data.VehRotation; + VehEngineHealth = data.VehEngineHealth; VehVelocity = data.VehVelocity; VehSpeed = data.VehSpeed; VehSteeringAngle = data.VehSteeringAngle; @@ -614,21 +618,24 @@ namespace CoopServer public LQuaternion VehRotation { get; set; } [ProtoMember(10)] - public LVector3 VehVelocity { get; set; } + public float VehEngineHealth { get; set; } [ProtoMember(11)] - public float VehSpeed { get; set; } + public LVector3 VehVelocity { get; set; } [ProtoMember(12)] - public float VehSteeringAngle { get; set; } + public float VehSpeed { get; set; } [ProtoMember(13)] - public int[] VehColors { get; set; } + public float VehSteeringAngle { get; set; } [ProtoMember(14)] - public VehicleDoors[] VehDoors { get; set; } + public int[] VehColors { get; set; } [ProtoMember(15)] + public VehicleDoors[] VehDoors { get; set; } + + [ProtoMember(16)] public byte? Flag { get; set; } = 0; public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) @@ -656,6 +663,7 @@ namespace CoopServer VehSeatIndex = data.VehSeatIndex; VehPosition = data.VehPosition; VehRotation = data.VehRotation; + VehEngineHealth = data.VehEngineHealth; VehVelocity = data.VehVelocity; VehSpeed = data.VehSpeed; VehSteeringAngle = data.VehSteeringAngle;