ACE3/addons/cookoff/functions/fnc_cookOffBox.sqf
2024-02-06 01:06:30 +01:00

43 lines
1.0 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: KoffeinFlummi, commy2, kymckay, johnb43
* Start a cook-off in the given ammo box.
*
* Arguments:
* 0: Ammo box <OBJECT>
* 1: Source <OBJECT> (default: objNull)
* 2: Instigator <OBJECT> (default: objNull)
*
* Return Value:
* None
*
* Example:
* cursorObject call ace_cookoff_fnc_cookOffBox
*
* Public: No
*/
if (!isServer) exitWith {};
params ["_box", ["_source", objNull], ["_instigator", objNull]];
// Make sure it's a box
if !(_box isKindOf "ReammoBox_F") exitWith {};
if (_box getVariable [QGVAR(isCookingOff), false]) exitWith {};
_box setVariable [QGVAR(isCookingOff), true, true];
// Spawn cook-off effects on all connected machines
private _jipID = [QGVAR(cookOffBoxLocal), [
_box,
_source,
_instigator,
CBA_missionTime,
random [SMOKE_DELAY / 2, SMOKE_DELAY, SMOKE_DELAY / 2 * 3] // generate random timer that is global synced
]] call CBA_fnc_globalEventJIP;
[_jipID, _box] call CBA_fnc_removeGlobalEventJIP;
_box setVariable [QGVAR(jipIDs), [_jipID]];