mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cookoff - Fix smoke effects not getting cleaned up (#8933)
* Cookoff: Added handling for cleaning up smoke effects when vehicle is deleted mid-cookoff * Cookoff - Prevent effects cleanup Deleted EH from getting duplicated * Cookoff - Added locality safety check to effects cleanup * Cookoff - Global effects cleanup is now triggered by the server to handle locality transfer
This commit is contained in:
parent
1a95070b80
commit
36442d34cd
@ -11,6 +11,22 @@
|
||||
[QGVAR(smoke), FUNC(smoke)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(cookOffBox), FUNC(cookOffBox)] call CBA_fnc_addEventHandler;
|
||||
|
||||
// handle cleaning up effects when vehicle is deleted mid-cookoff
|
||||
[QGVAR(addCleanupHandlers), {
|
||||
params ["_vehicle"];
|
||||
|
||||
// Don't add a new EH if cookoff is run multiple times
|
||||
if ((_vehicle getVariable [QGVAR(deletedEH), -1]) == -1) then {
|
||||
private _deletedEH = _vehicle addEventHandler ["Deleted", {
|
||||
params ["_vehicle"];
|
||||
|
||||
[QGVAR(cleanupEffects), [_vehicle]] call CBA_fnc_globalEvent;
|
||||
}];
|
||||
|
||||
_vehicle setVariable [QGVAR(deletedEH), _deletedEH];
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(cleanupEffects), {
|
||||
params ["_vehicle", ["_effects", []]];
|
||||
|
||||
|
@ -30,6 +30,8 @@ TRACE_9("cooking off",_vehicle,_intensity,_instigator,_smokeDelayEnabled,_ammoDe
|
||||
if (_vehicle getVariable [QGVAR(isCookingOff), false]) exitWith {};
|
||||
_vehicle setVariable [QGVAR(isCookingOff), true, true];
|
||||
|
||||
[QGVAR(addCleanupHandlers), [_vehicle]] call CBA_fnc_serverEvent;
|
||||
|
||||
// limit maximum value of intensity to prevent very long cook-off times
|
||||
_intensity = _intensity min _maxIntensity;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user