2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-10-06 20:37:38 +00:00
|
|
|
/*
|
2024-02-07 16:58:59 +00:00
|
|
|
* Author: johnb43
|
|
|
|
* Starts ammunition detonating from an object.
|
2016-10-06 20:37:38 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2024-01-27 08:14:10 +00:00
|
|
|
* 0: Object <OBJECT>
|
2024-02-03 16:48:54 +00:00
|
|
|
* 1: Destroy when finished <BOOL> (default: false)
|
2024-02-06 00:06:30 +00:00
|
|
|
* 2: Source <OBJECT> (default: objNull)
|
2024-02-03 16:48:54 +00:00
|
|
|
* 3: Instigator <OBJECT> (default: objNull)
|
|
|
|
* 4: Initial delay <NUMBER> (default: 0)
|
2016-10-06 20:37:38 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2024-02-07 16:58:59 +00:00
|
|
|
* None
|
2016-10-06 20:37:38 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2024-02-03 16:48:54 +00:00
|
|
|
* [cursorObject] call ace_cookoff_fnc_detonateAmmunition
|
2016-10-06 20:37:38 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2024-01-27 08:14:10 +00:00
|
|
|
if (!isServer) exitWith {};
|
2016-10-06 20:37:38 +00:00
|
|
|
|
2024-02-06 00:06:30 +00:00
|
|
|
params ["_object", ["_destroyWhenFinished", false], ["_source", objNull], ["_instigator", objNull], ["_initialDelay", 0]];
|
2021-10-14 15:49:27 +00:00
|
|
|
|
2024-01-27 08:14:10 +00:00
|
|
|
if (isNull _object) exitWith {};
|
2016-10-06 20:37:38 +00:00
|
|
|
|
2024-02-07 16:58:59 +00:00
|
|
|
// Don't have an object detonate its ammo twice
|
2024-02-08 12:08:45 +00:00
|
|
|
if (_object getVariable [QGVAR(isAmmoDetonating), false]) exitWith {};
|
|
|
|
|
|
|
|
_object setVariable [QGVAR(isAmmoDetonating), true, true];
|
2024-02-03 16:48:54 +00:00
|
|
|
|
2024-02-07 16:58:59 +00:00
|
|
|
_object setVariable [QGVAR(cookoffMagazines), _object call FUNC(getVehicleAmmo)];
|
2024-02-03 16:48:54 +00:00
|
|
|
|
2024-02-07 16:58:59 +00:00
|
|
|
// TODO: When setMagazineTurretAmmo and magazineTurretAmmo are fixed (https://feedback.bistudio.com/T79689),
|
|
|
|
// we can add gradual ammo removal during cook-off
|
|
|
|
if (GVAR(removeAmmoDuringCookoff)) then {
|
|
|
|
clearMagazineCargoGlobal _object;
|
2024-02-03 16:48:54 +00:00
|
|
|
|
2024-02-07 16:58:59 +00:00
|
|
|
{
|
|
|
|
[QEGVAR(common,removeMagazinesTurret), [_object, _x select 0, _x select 1], _object, _x select 1] call CBA_fnc_turretEvent;
|
|
|
|
} forEach (magazinesAllTurrets _object);
|
2024-01-27 08:14:10 +00:00
|
|
|
};
|
|
|
|
|
2024-02-07 16:58:59 +00:00
|
|
|
[FUNC(detonateAmmunitionServer), [_object, _destroyWhenFinished, _source, _instigator], _initialDelay] call CBA_fnc_waitAndExecute;
|