2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-11 17:49:39 +00:00
|
|
|
/*
|
|
|
|
* Author: voiper
|
|
|
|
* Compile list of flashlight classnames and add to the "Flashlight" parent menu.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
* 1: Player <OBJECT>
|
|
|
|
* 3: Parameters <ARRAY>
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-08-11 17:49:39 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_player, _player, []] call ace_map_fnc_compileFlashlightMenu;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-10-14 19:36:40 +00:00
|
|
|
params ["", "_player"];
|
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
private _actions = [];
|
|
|
|
private _flashlightItems = [_player] call FUNC(getUnitFlashlights);
|
|
|
|
private _unitLight = _player getVariable [QGVAR(flashlight), ["", objNull]];
|
|
|
|
_unitLight params ["_flashlight", ""];
|
2015-08-11 17:49:39 +00:00
|
|
|
|
|
|
|
//add all carried flashlight menus and on/off submenu actions
|
|
|
|
{
|
2016-06-18 00:18:06 +00:00
|
|
|
private _cfg = (configFile >> "CfgWeapons" >> _x);
|
|
|
|
private _displayName = getText (_cfg >> "displayName");
|
|
|
|
private _icon = getText (_cfg >> "picture");
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
private _statement = if (_flashlight == _x) then {
|
2015-10-14 19:36:40 +00:00
|
|
|
_displayName = format [localize LSTRING(turnLightOff), _displayName];
|
2016-06-18 00:18:06 +00:00
|
|
|
{[_player, ""] call FUNC(switchFlashlight)}
|
2015-10-14 19:36:40 +00:00
|
|
|
} else {
|
|
|
|
_displayName = format [localize LSTRING(turnLightOn), _displayName];
|
2016-06-18 00:18:06 +00:00
|
|
|
{[_player, _this select 2] call FUNC(switchFlashlight)}
|
2015-08-11 17:49:39 +00:00
|
|
|
};
|
|
|
|
|
2017-05-14 19:48:05 +00:00
|
|
|
private _action = [_x, _displayName, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
|
2015-10-14 19:36:40 +00:00
|
|
|
_actions pushBack [_action, [], _player];
|
2016-06-18 00:18:06 +00:00
|
|
|
} forEach _flashlightItems;
|
2015-08-11 17:49:39 +00:00
|
|
|
|
2015-10-14 17:56:54 +00:00
|
|
|
_actions
|