2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
2015-02-02 09:42:14 +00:00
|
|
|
* Causes the unit to detonate the passed explosive.
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Max range (-1 to ignore) <NUMBER>
|
|
|
|
* 2: Explosive <ARRAY>
|
2015-04-06 16:22:43 +00:00
|
|
|
* 0: Explosive <OBJECT>
|
2015-05-21 16:42:44 +00:00
|
|
|
* 1: Fuse ACE_time <NUMBER>
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, 100, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; // has to be within range
|
|
|
|
* [player, -1, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; // range ignored.
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-29 19:22:07 +00:00
|
|
|
private ["_result", "_ignoreRange", "_helpers", "_pos"];
|
2015-04-01 18:43:18 +00:00
|
|
|
EXPLODE_3_PVT(_this,_unit,_range,_item);
|
2015-01-11 16:42:31 +00:00
|
|
|
_ignoreRange = (_range == -1);
|
|
|
|
_result = true;
|
|
|
|
|
|
|
|
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false};
|
|
|
|
|
|
|
|
if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
private ["_exp", "_previousExp"];
|
|
|
|
_previousExp = _item select 0;
|
|
|
|
_exp = getText (ConfigFile >> "CfgAmmo" >> typeof (_previousExp) >> "ACE_Explosive");
|
|
|
|
if (_exp != "") then {
|
|
|
|
_exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"];
|
|
|
|
_exp setDir (getDir _previousExp);
|
|
|
|
_item set [0, _exp];
|
|
|
|
_pos = getPosASL _previousExp;
|
|
|
|
deleteVehicle _previousExp;
|
|
|
|
_exp setPosASL _pos;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-02-01 18:38:15 +00:00
|
|
|
[{
|
2015-04-29 05:05:02 +00:00
|
|
|
private ["_explosive"];
|
|
|
|
_explosive = _this;
|
|
|
|
if (!isNull _explosive) then {
|
|
|
|
_explosive setDamage 1;
|
|
|
|
};
|
2015-02-01 18:38:15 +00:00
|
|
|
}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute);
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
_result
|