2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Opens the UI for explosive trigger selection
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Explosive Magazine <STRING>
|
2015-02-20 01:28:16 +00:00
|
|
|
* 1: Explosive <OBJECT>
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-02-20 01:28:16 +00:00
|
|
|
* [lbData [8866, lbCurSel 8866], _explosive] call ACE_Explosives_fnc_openTriggerSelectionUI;
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-03-31 21:20:32 +00:00
|
|
|
private ["_magazine", "_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"];
|
2015-01-11 16:42:31 +00:00
|
|
|
_magazine = _this select 0;
|
2015-03-31 21:20:32 +00:00
|
|
|
_explosive = _this select 1;
|
2015-01-12 09:48:26 +00:00
|
|
|
_detonators = [ACE_player] call FUNC(getDetonators);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
_triggerTypes = [_magazine] call FUNC(triggerType);
|
|
|
|
_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers";
|
2015-01-11 16:42:31 +00:00
|
|
|
_count = 0;
|
2015-03-31 21:20:32 +00:00
|
|
|
_children = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
{
|
|
|
|
_required = getArray (_x >> "requires");
|
|
|
|
_hasRequiredItems = true;
|
|
|
|
{
|
|
|
|
if !(_x in _detonators) exitWith {
|
|
|
|
_hasRequiredItems = false;
|
|
|
|
};
|
|
|
|
} count _required;
|
|
|
|
if (_hasRequiredItems) then {
|
2015-03-31 21:20:32 +00:00
|
|
|
_children pushBack
|
|
|
|
[
|
|
|
|
[
|
|
|
|
format ["Trigger_%1", _forEachIndex],
|
|
|
|
if(isText(_magTriggers >> configName _x >> "displayName"))then{getText(_magTriggers >> configName _x >> "displayName")}else{getText(_x >> "displayName")},
|
|
|
|
if(isText(_magTriggers >> configName _x >> "picture"))then{getText(_magTriggers >> configName _x >> "picture")}else{getText(_x >> "picture")},
|
|
|
|
{(_this select 2) call FUNC(selectTrigger);},
|
|
|
|
{true},
|
|
|
|
{},
|
|
|
|
[_explosive, _magazine, configName _x]
|
|
|
|
] call EFUNC(interact_menu,createAction),
|
|
|
|
[],
|
|
|
|
ACE_Player
|
|
|
|
];
|
2015-01-11 16:42:31 +00:00
|
|
|
_count = _count + 1;
|
|
|
|
};
|
|
|
|
} count _triggerTypes;
|
|
|
|
|
|
|
|
if (_count == 0) then {
|
2015-01-12 09:48:26 +00:00
|
|
|
[format[localize "STR_ACE_Explosives_NoTriggersAvailable",
|
2015-01-12 20:39:37 +00:00
|
|
|
getText(configFile >> "CfgMagazines" >> _magazine >> "DisplayName")]] call EFUNC(Common,displayTextStructured);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-03-31 21:20:32 +00:00
|
|
|
|
|
|
|
_children
|