mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Implement a new event to receive notifications when a pickup automatic status has changed.
This commit is contained in:
@ -233,12 +233,27 @@ bool CPickup::GetAutomatic() const
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CPickup::SetAutomatic(bool toggle) const
|
||||
void CPickup::SetAutomatic(bool toggle)
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
// Grab the current value for this property
|
||||
const bool current = _Func->IsPickupAutomatic(m_ID);
|
||||
// Don't even bother if it's the same value
|
||||
if (current == toggle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Avoid property unwind from a recursive call
|
||||
_Func->SetPickupIsAutomatic(m_ID, toggle);
|
||||
// Avoid infinite recursive event loops
|
||||
if (!(m_CircularLocks & PICKUPCL_EMIT_PICKUP_AUTOMATIC))
|
||||
{
|
||||
// Prevent this event from triggering while executed
|
||||
BitGuardU32 bg(m_CircularLocks, PICKUPCL_EMIT_PICKUP_AUTOMATIC);
|
||||
// Now forward the event call
|
||||
Core::Get().EmitPickupAutomatic(m_ID, current, toggle);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -13,7 +13,8 @@ namespace SqMod {
|
||||
enum PickupCircularLocks
|
||||
{
|
||||
PICKUPCL_EMIT_PICKUP_WORLD = (1 << 0),
|
||||
PICKUPCL_EMIT_PICKUP_ALPHA = (2 << 0)
|
||||
PICKUPCL_EMIT_PICKUP_ALPHA = (2 << 0),
|
||||
PICKUPCL_EMIT_PICKUP_AUTOMATIC = (3 << 0)
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -222,7 +223,7 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set whether the managed pickup entity is automatic.
|
||||
*/
|
||||
void SetAutomatic(bool toggle) const;
|
||||
void SetAutomatic(bool toggle);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the automatic timer of the managed pickup entity.
|
||||
|
Reference in New Issue
Block a user