ACE3/addons/explosives/functions/fnc_defuseExplosive.sqf
SilentSpike 108ff4f644 Replace ACE event system calls with CBA counterparts
Regex used:

\[(.+?),(.+?),(.+?)\]\s+call\s+E?FUNC\((common,)?(target|object)Event\)
[$1,$3,$2] call CBA_fnc_targetEvent

E?FUNC\((common,)?(server|global|local)Event\)
CBA_fnc_$2Event

E?FUNC\((common,)?(add|remove)EventHandler\)
CBA_fnc_$2EventHandler
2016-05-22 16:47:39 +01:00

30 lines
846 B
Plaintext

/*
* Author: Garth 'L-H' de Wet
* Causes the unit to defuse the passed explosive.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Explosive <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, ACE_Interaction_Target] call ACE_Explosives_fnc_defuseExplosive;
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_explosive"];
TRACE_2("params",_unit,_explosive);
if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> QGVAR(explodeOnDefuseChance)))}) exitWith {
TRACE_1("exploding on defuse",_explosive);
[_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive);
[QGVAR(explodeOnDefuse), [_explosive, _unit]] call CBA_fnc_globalEvent;
};
_unit action ["Deactivate", _unit, _explosive];
[QGVAR(defuse), [_explosive, _unit]] call CBA_fnc_globalEvent;