Skip to content

Commit

Permalink
Add rocket boost sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Sardelka9515 committed Aug 17, 2022
1 parent cb73db7 commit 13a6431
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/bin
**/obj
**/packages
**/.vs
**/.vs
**/.vscode
12 changes: 12 additions & 0 deletions RageCoop.Client/Sync/Entities/SyncedVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ internal override void Update()
MainVehicle.RoofState=RoofState;
}

if(MainVehicle.HasRocketBoost){
if(Flags.HasFlag(VehicleDataFlags.IsRocketBoostActive) )
{
if(!MainVehicle.IsRocketBoostActive()){
MainVehicle.SetRocketBoostActive(true);
}
}
else if(MainVehicle.IsRocketBoostActive()){
MainVehicle.SetRocketBoostActive(false);
}
}

Function.Call(Hash.SET_VEHICLE_BRAKE_LIGHTS, MainVehicle.Handle, BrakeLightsOn);
MainVehicle.SetDamageModel(DamageModel);

Expand Down
18 changes: 12 additions & 6 deletions RageCoop.Client/Util/VehicleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ public static VehicleDataFlags GetVehicleFlags(this Vehicle veh)
flags |= VehicleDataFlags.IsTransformed;
}

if (veh.HasRoof && (veh.RoofState == VehicleRoofState.Opened || veh.RoofState == VehicleRoofState.Opening))
{
flags |= VehicleDataFlags.RoofOpened;
}


if (veh.IsAircraft)
{
Expand All @@ -72,6 +67,10 @@ public static VehicleDataFlags GetVehicleFlags(this Vehicle veh)
{
flags|=VehicleDataFlags.HasRoof;
}
if (veh.IsRocketBoostActive())
{
flags|=VehicleDataFlags.IsRocketBoostActive;
}
if (veh.IsOnFire)
{
flags|=VehicleDataFlags.IsOnFire;
Expand All @@ -80,7 +79,14 @@ public static VehicleDataFlags GetVehicleFlags(this Vehicle veh)

return flags;
}

public static bool IsRocketBoostActive(this Vehicle veh)
{
return Function.Call<bool>(Hash._IS_VEHICLE_ROCKET_BOOST_ACTIVE,veh);
}
public static void SetRocketBoostActive(this Vehicle veh,bool toggle)
{
Function.Call(Hash._SET_VEHICLE_ROCKET_BOOST_ACTIVE,veh,toggle);
}
public static Dictionary<int, int> GetVehicleMods(this VehicleModCollection mods)
{
Dictionary<int, int> result = new Dictionary<int, int>();
Expand Down
3 changes: 1 addition & 2 deletions RageCoop.Core/Packets/Packets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ internal enum VehicleDataFlags:ushort
IsDead = 1 << 5,
IsHornActive = 1 << 6,
IsTransformed = 1 << 7,
RoofOpened = 1 << 8,
OnTurretSeat = 1 << 9,
IsRocketBoostActive = 1 << 9,
IsAircraft = 1 << 10,
IsDeluxoHovering=1 << 11,
HasRoof=1 << 12,
Expand Down

0 comments on commit 13a6431

Please sign in to comment.