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

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
**/obj **/obj
**/packages **/packages
**/.vs **/.vs
**/.vscode

View File

@ -241,6 +241,18 @@ namespace RageCoop.Client
MainVehicle.RoofState=RoofState; 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); Function.Call(Hash.SET_VEHICLE_BRAKE_LIGHTS, MainVehicle.Handle, BrakeLightsOn);
MainVehicle.SetDamageModel(DamageModel); MainVehicle.SetDamageModel(DamageModel);

View File

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

View File

@ -121,8 +121,7 @@ namespace RageCoop.Core
IsDead = 1 << 5, IsDead = 1 << 5,
IsHornActive = 1 << 6, IsHornActive = 1 << 6,
IsTransformed = 1 << 7, IsTransformed = 1 << 7,
RoofOpened = 1 << 8, IsRocketBoostActive = 1 << 9,
OnTurretSeat = 1 << 9,
IsAircraft = 1 << 10, IsAircraft = 1 << 10,
IsDeluxoHovering=1 << 11, IsDeluxoHovering=1 << 11,
HasRoof=1 << 12, HasRoof=1 << 12,