mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-10-15 07:27:19 +02:00
Implement a new event to receive notifications when a vehicle immunity has changed.
This commit is contained in:
@@ -312,12 +312,22 @@ Int32 CVehicle::GetImmunity() const
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CVehicle::SetImmunity(Int32 flags) const
|
||||
void CVehicle::SetImmunity(Int32 flags)
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
// Grab the current value for this property
|
||||
const Int32 current = _Func->GetVehicleImmunityFlags(m_ID);
|
||||
// Avoid property unwind from a recursive call
|
||||
_Func->SetVehicleImmunityFlags(m_ID, flags);
|
||||
// Avoid infinite recursive event loops
|
||||
if (!(m_CircularLocks & VEHICLECL_EMIT_VEHICLE_IMMUNITY))
|
||||
{
|
||||
// Prevent this event from triggering while executed
|
||||
BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_IMMUNITY);
|
||||
// Now forward the event call
|
||||
Core::Get().EmitVehicleImmunity(m_ID, current, flags);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@@ -13,7 +13,8 @@ namespace SqMod {
|
||||
enum VehicleCircularLocks
|
||||
{
|
||||
VEHICLECL_EMIT_VEHICLE_OPTION = (1 << 0),
|
||||
VEHICLECL_EMIT_VEHICLE_WORLD = (2 << 0)
|
||||
VEHICLECL_EMIT_VEHICLE_WORLD = (2 << 0),
|
||||
VEHICLECL_EMIT_VEHICLE_IMMUNITY = (3 << 0)
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -259,7 +260,7 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the immunity flags of the managed vehicle entity.
|
||||
*/
|
||||
void SetImmunity(Int32 flags) const;
|
||||
void SetImmunity(Int32 flags);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explode the managed vehicle entity.
|
||||
|
Reference in New Issue
Block a user