diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 560453b416..5f471c3fbb 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class ACE_MapFlashlight { displayName = CSTRING(Action_Flashlights); icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa); - condition = QUOTE(GVAR(mapIllumination) && visibleMap && (count ([ACE_player] call FUNC(getUnitFlashlights)) > 0)); + condition = QUOTE(GVAR(mapIllumination) && visibleMap && {count ([ACE_player] call FUNC(getUnitFlashlights)) > 0}); statement = "true"; exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu)); diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf index 90f446f63d..8c18e783dd 100644 --- a/addons/map/functions/fnc_compileFlashlightMenu.sqf +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -18,47 +18,30 @@ #include "script_component.hpp" -params ["_vehicle", "_player", "_parameters"]; +params ["", "_player"]; + +private["_action", "_actions", "_cfg", "_displayName", "_flashlights", "_icon", "_statement"]; _actions = []; _flashlights = [_player] call FUNC(getUnitFlashlights); //add all carried flashlight menus and on/off submenu actions { - private ["_cfg", "_displayName"," _icon", "_children", "_parentAction"]; _cfg = (configFile >> "CfgWeapons" >> _x); _displayName = getText (_cfg >> "displayName"); _icon = getText (_cfg >> "picture"); - - _children = { - private ["_onAction", "_offAction"]; - params ["_vehicle", "_player", "_flashlight"]; - - _onAction = [ - (_flashlight + "_On"), - "On", - "", - {[_this select 2] call FUNC(switchFlashlight)}, - {GVAR(flashlightInUse) != (_this select 2)}, - {}, - _flashlight - ] call EFUNC(interact_menu,createAction); - - _offAction = [ - (_flashlight + "_Off"), - "Off", - "", - {[""] call FUNC(switchFlashlight)}, - {GVAR(flashlightInUse) == (_this select 2)}, - {}, - _flashlight - ] call EFUNC(interact_menu,createAction); - - [[_onAction, [], _player], [_offAction, [], _player]] + _statement = {}; + + _statement = if (GVAR(flashlightInUse) == _x) then { + _displayName = format [localize LSTRING(turnLightOff), _displayName]; + {[""] call FUNC(switchFlashlight)} + } else { + _displayName = format [localize LSTRING(turnLightOn), _displayName]; + {[_this select 2] call FUNC(switchFlashlight)} }; - _parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction); - _actions pushBack [_parentAction, [], _player]; + _action = [_x, _displayName, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); + _actions pushBack [_action, [], _player]; } forEach _flashlights; _actions diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 8f693ef37a..103e66dd27 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -256,5 +256,29 @@ Snížit jas Reducir brillo + + Turn On %1 + %1 Aktivieren + Encender %1 + Włącz %1 + Allumer %1 + Zapnout %1 + Accendi %1 + %1 Bekapcsolása + Ativar %1 + Активировать %1 + + + Turn Off %1 + %1 Deaktivieren + Apagar %1 + Wyłącz %1 + Éteindre %1 + Vypnout %1 + Spegni %1 + %1 Kikapcsolása + Desativar %1 + Деактивировать %1 + \ No newline at end of file