2015-05-28 15:56:45 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Detonates all attached deadman's switched triggered explosives.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* Handled by CBA
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-07-18 05:36:47 +00:00
|
|
|
|
2015-08-15 19:35:33 +00:00
|
|
|
//NOTE: Extended_Killed_EventHandlers runs only where _unit is local
|
|
|
|
params ["_unit"];
|
|
|
|
TRACE_1("params",_unit);
|
2015-07-18 05:36:47 +00:00
|
|
|
|
2017-12-26 23:20:43 +00:00
|
|
|
if (_unit == ace_player) then {
|
|
|
|
// close cellphone if open
|
2018-06-24 22:08:15 +00:00
|
|
|
findDisplay 8855 closeDisplay 0;
|
2017-12-26 23:20:43 +00:00
|
|
|
};
|
|
|
|
|
2016-12-14 20:06:32 +00:00
|
|
|
// Exit if no item:
|
|
|
|
if (({_x == "ACE_DeadManSwitch"} count (items _unit)) == 0) exitWith {};
|
2015-07-18 05:36:47 +00:00
|
|
|
|
2016-12-14 20:06:32 +00:00
|
|
|
private _range = getNumber (configFile >> "CfgWeapons" >> "ACE_DeadManSwitch" >> QGVAR(range));
|
|
|
|
private _deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives);
|
|
|
|
TRACE_2("placed",_deadman,_range);
|
2015-05-28 15:56:45 +00:00
|
|
|
{
|
2017-05-10 16:28:44 +00:00
|
|
|
[_unit, _range, _x, "ACE_DeadManSwitch"] call FUNC(detonateExplosive);
|
2015-08-15 19:35:33 +00:00
|
|
|
} forEach _deadman;
|
2016-02-05 05:55:29 +00:00
|
|
|
|
|
|
|
//Handle deadman connected to explosive in inventory
|
|
|
|
private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
|
|
|
|
if (_connectedInventoryExplosive != "") then {
|
|
|
|
if (!(_connectedInventoryExplosive in (magazines _unit))) exitWith {};
|
|
|
|
|
|
|
|
//Remove mag and reset variable
|
|
|
|
_unit removeMagazine _connectedInventoryExplosive;
|
|
|
|
_unit setVariable [QGVAR(deadmanInvExplosive), "", true];
|
|
|
|
|
|
|
|
private _ammo = getText (configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ammo");
|
|
|
|
TRACE_2("deadman inventory",_connectedInventoryExplosive,_ammo);
|
|
|
|
private _magazineTrigger = configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ACE_Triggers" >> "DeadmanSwitch";
|
|
|
|
if (isText (_magazineTrigger >> "ammo")) then {
|
|
|
|
_ammo = getText (_magazineTrigger >> "ammo");
|
|
|
|
};
|
|
|
|
|
|
|
|
private _explosive = createVehicle [_ammo, (getPos _unit), [], 0, "NONE"];
|
|
|
|
_explosive setPosASL (getPosASL _unit);
|
2017-05-10 16:28:44 +00:00
|
|
|
[_unit, -1, [_explosive, 0.5], "ACE_DeadManSwitch"] call FUNC(detonateExplosive); //Explode, ignoring range, with a 0.5 second delay
|
2016-02-05 05:55:29 +00:00
|
|
|
};
|