2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-01-12 09:48:26 +00:00
|
|
|
Name: ACE_Explosives_fnc_detonateExplosive
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Author(s):
|
|
|
|
Garth de Wet (LH)
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Description:
|
|
|
|
Detonates a remote Explosive.
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Parameters:
|
|
|
|
0: OBJECT - Unit detonating explosive
|
|
|
|
1: NUMBER - Max range (-1 to ignore)
|
|
|
|
2: ARRAY - Explosive
|
|
|
|
0: OBJECT - Explosive
|
|
|
|
1: NUMBER - Fuse Time
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Returns:
|
|
|
|
Nothing
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Example:
|
|
|
|
// Clacker
|
2015-01-12 09:48:26 +00:00
|
|
|
[player, 100, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive;
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-12 09:48:26 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
private ["_item","_result", "_ignoreRange", "_unit", "_range"];
|
2015-01-11 16:42:31 +00:00
|
|
|
_unit = _this select 0;
|
|
|
|
_range = _this select 1;
|
|
|
|
_item = _this select 2;
|
|
|
|
_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 {
|
|
|
|
private ["_exp", "_previousExp"];
|
|
|
|
_previousExp = _item select 0;
|
2015-01-12 09:48:26 +00:00
|
|
|
_exp = getText (ConfigFile >> "CfgAmmo" >> typeof (_previousExp) >> "ACE_Explosive");
|
2015-01-11 16:42:31 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
_item spawn {
|
|
|
|
sleep (_this select 1);
|
|
|
|
(_this select 0) setDamage 1;
|
|
|
|
};
|
|
|
|
_result
|