2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-01-12 09:48:26 +00:00
|
|
|
Name: ACE_Explosives_fnc_openTriggerSelectionUI
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Author: Garth de Wet (LH)
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
Description:
|
|
|
|
Opens the UI for explosive trigger selection
|
2015-01-12 09:48:26 +00:00
|
|
|
|
|
|
|
Parameters:
|
2015-01-11 16:42:31 +00:00
|
|
|
0: String - explosive magazine
|
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:
|
2015-01-12 09:48:26 +00:00
|
|
|
[lbData [8866, lbCurSel 8866]] call ACE_Explosives_fnc_openTriggerSelectionUI;
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-12 17:11:43 +00:00
|
|
|
#include "\z\ace\explosives\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
private ["_magazine", "_hasRequiredItems","_triggerTypes", "_actions", "_detonators", "_required", "_magTriggers"];
|
|
|
|
_magazine = _this select 0;
|
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";
|
|
|
|
_actions = [localize "STR_ACE_Explosives_TriggerMenu", localize "STR_ACE_Explosives_SelectTrigger"]
|
|
|
|
call EFUNC(Interaction,prepareSelectMenu);
|
2015-01-11 16:42:31 +00:00
|
|
|
_count = 0;
|
|
|
|
{
|
|
|
|
_required = getArray (_x >> "requires");
|
|
|
|
_hasRequiredItems = true;
|
|
|
|
{
|
|
|
|
if !(_x in _detonators) exitWith {
|
|
|
|
_hasRequiredItems = false;
|
|
|
|
};
|
|
|
|
} count _required;
|
|
|
|
if (_hasRequiredItems) then {
|
|
|
|
_actions = [
|
|
|
|
_actions,
|
|
|
|
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")},
|
|
|
|
[configName _x, _magazine]
|
2015-01-12 09:48:26 +00:00
|
|
|
] call EFUNC(Interaction,addSelectableItem);
|
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
|
|
|
[ACE_player] call FUNC(openPlaceUI);
|
|
|
|
[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
|
|
|
}else{
|
|
|
|
[
|
|
|
|
_actions,
|
|
|
|
{
|
2015-01-12 09:48:26 +00:00
|
|
|
[_this select 1, _this select 0] call FUNC(selectTrigger);
|
2015-01-11 16:42:31 +00:00
|
|
|
},
|
2015-01-12 09:48:26 +00:00
|
|
|
{[ACE_player] call FUNC(openPlaceUI);}
|
|
|
|
] call EFUNC(Interaction,openSelectMenu);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|