Add rocket boost sync

This commit is contained in:
Sardelka9515
2022-08-17 23:18:06 +08:00
parent cb73db7146
commit 13a6431248
4 changed files with 27 additions and 9 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
**/bin
**/obj
**/packages
**/.vs
**/.vs
**/.vscode

View File

@ -241,6 +241,18 @@ namespace RageCoop.Client
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);

View File

@ -54,11 +54,6 @@ namespace RageCoop.Client
flags |= VehicleDataFlags.IsTransformed;
}
if (veh.HasRoof && (veh.RoofState == VehicleRoofState.Opened || veh.RoofState == VehicleRoofState.Opening))
{
flags |= VehicleDataFlags.RoofOpened;
}
if (veh.IsAircraft)
{
@ -72,6 +67,10 @@ namespace RageCoop.Client
{
flags|=VehicleDataFlags.HasRoof;
}
if (veh.IsRocketBoostActive())
{
flags|=VehicleDataFlags.IsRocketBoostActive;
}
if (veh.IsOnFire)
{
flags|=VehicleDataFlags.IsOnFire;
@ -80,7 +79,14 @@ namespace RageCoop.Client
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>();

View File

@ -121,8 +121,7 @@ namespace RageCoop.Core
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,