2015-01-12 09:48:26 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Opens the UI for explosive detonation selection
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Trigger classname <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, "ACE_M26_Clacker"] call ACE_Explosives_fnc_openDetonateUI;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-12 09:48:26 +00:00
|
|
|
private ["_unit","_result", "_item"];
|
2015-01-15 19:13:12 +00:00
|
|
|
call EFUNC(interaction,hideMenu);
|
2015-01-12 09:48:26 +00:00
|
|
|
_unit = _this select 0;
|
|
|
|
_detonator = _this select 1;
|
|
|
|
_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
|
|
|
|
|
|
|
|
_result = [_unit] call FUNC(getPlacedExplosives);
|
|
|
|
_actions = [localize "STR_ACE_Explosives_DetonateMenu", localize "STR_ACE_Explosives_Detonate"]
|
2015-01-15 19:13:12 +00:00
|
|
|
call EFUNC(interaction,prepareSelectMenu);
|
2015-01-12 09:48:26 +00:00
|
|
|
_count = 0;
|
|
|
|
{
|
|
|
|
if (!isNull(_x select 0)) then {
|
|
|
|
_required = getArray (ConfigFile >> "CfgACE_Triggers" >> (_x select 4) >> "requires");
|
|
|
|
if (_detonator in _required) then {
|
|
|
|
_item = ConfigFile >> "CfgMagazines" >> (_x select 3);
|
|
|
|
_actions = [
|
|
|
|
_actions,
|
|
|
|
_x select 2,
|
|
|
|
getText(_item >> "picture"),
|
|
|
|
[_foreachIndex, _range]
|
2015-01-15 19:13:12 +00:00
|
|
|
] call EFUNC(interaction,AddSelectableItem);
|
2015-01-12 09:48:26 +00:00
|
|
|
_count = _count + 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} foreach _result;
|
|
|
|
if (_count > 0) then {
|
|
|
|
[
|
|
|
|
_actions,
|
|
|
|
{
|
|
|
|
[
|
|
|
|
ACE_player,
|
2015-01-14 13:28:04 +00:00
|
|
|
[_this select 1] call EFUNC(common,toNumber),
|
|
|
|
(ACE_player getVariable [QGVAR(Clackers), []]) select ([_this select 0] call EFUNC(common,toNumber)),
|
2015-01-12 09:48:26 +00:00
|
|
|
false
|
|
|
|
] call FUNC(detonateExplosive);
|
2015-01-15 19:13:12 +00:00
|
|
|
call EFUNC(interaction,hideMenu);
|
2015-01-12 09:48:26 +00:00
|
|
|
},
|
|
|
|
{[ACE_player] call FUNC(openTransmitterUI);}
|
2015-01-15 19:13:12 +00:00
|
|
|
] call EFUNC(interaction,openSelectMenu);
|
2015-01-12 09:48:26 +00:00
|
|
|
}else{
|
2015-01-15 19:13:12 +00:00
|
|
|
call EFUNC(interaction,hideMenu);
|
2015-01-12 09:48:26 +00:00
|
|
|
[ACE_player] call FUNC(openTransmitterUI);
|
2015-01-14 13:28:04 +00:00
|
|
|
[localize "STR_ACE_Explosives_NoExplosivesAvailable"] call EFUNC(common,displayTextStructured);
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|