1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Flatten tyres utility.

This commit is contained in:
Sandu Liviu Catalin 2021-03-15 07:01:26 +02:00
parent 5082b9ace8
commit c22e37622d
2 changed files with 29 additions and 0 deletions

View File

@ -342,6 +342,28 @@ void CVehicle::Explode() const
_Func->ExplodeVehicle(m_ID); _Func->ExplodeVehicle(m_ID);
} }
// ------------------------------------------------------------------------------------------------
void CVehicle::FlattenTyres(bool toggle) const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
if(toggle)
{
_Func->SetVehicleTyreStatus(m_ID, 0, 0);
_Func->SetVehicleTyreStatus(m_ID, 1, 0);
_Func->SetVehicleTyreStatus(m_ID, 2, 0);
_Func->SetVehicleTyreStatus(m_ID, 3, 0);
}
else
{
_Func->SetVehicleTyreStatus(m_ID, 0, 1);
_Func->SetVehicleTyreStatus(m_ID, 1, 1);
_Func->SetVehicleTyreStatus(m_ID, 2, 1);
_Func->SetVehicleTyreStatus(m_ID, 3, 1);
}
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool CVehicle::IsWrecked() const bool CVehicle::IsWrecked() const
{ {
@ -807,6 +829,7 @@ void CVehicle::Fix() const
// Perform the requested operation // Perform the requested operation
_Func->SetVehicleHealth(m_ID, 1000); _Func->SetVehicleHealth(m_ID, 1000);
_Func->SetVehicleDamageData(m_ID, 0); _Func->SetVehicleDamageData(m_ID, 0);
_Func->SetVehicleLightsData(m_ID, _Func->GetVehicleLightsData(m_ID) & 0xFFFFFF00);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -2101,6 +2124,7 @@ void Register_CVehicle(HSQUIRRELVM vm)
.Func(_SC("HasOccupant"), &CVehicle::HasOccupant) .Func(_SC("HasOccupant"), &CVehicle::HasOccupant)
.Func(_SC("Respawn"), &CVehicle::Respawn) .Func(_SC("Respawn"), &CVehicle::Respawn)
.Func(_SC("Explode"), &CVehicle::Explode) .Func(_SC("Explode"), &CVehicle::Explode)
.Func(_SC("FlattenTyres"), &CVehicle::FlattenTyres)
.Func(_SC("SetRot"), &CVehicle::SetRotationEx) .Func(_SC("SetRot"), &CVehicle::SetRotationEx)
.Func(_SC("SetRotation"), &CVehicle::SetRotationEx) .Func(_SC("SetRotation"), &CVehicle::SetRotationEx)
.Func(_SC("SetEulerRot"), &CVehicle::SetRotationEulerEx) .Func(_SC("SetEulerRot"), &CVehicle::SetRotationEulerEx)

View File

@ -262,6 +262,11 @@ public:
*/ */
void Explode() const; void Explode() const;
/* --------------------------------------------------------------------------------------------
* Flatten the tyres of the managed vehicle entity.
*/
void FlattenTyres(bool toggle) const;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* See whether the managed vehicle entity is wrecked. * See whether the managed vehicle entity is wrecked.
*/ */