From ec8115d2a4c9b514261a1b8801575bbfa954efff Mon Sep 17 00:00:00 2001 From: mharis001 <34453221+mharis001@users.noreply.github.com> Date: Thu, 19 Apr 2018 15:01:26 -0400 Subject: [PATCH] Zeus - Toggle NVGs and Flashlights improvements (#6219) * New Toggle NVG ui and improve function * Add Toggle Flashlights icon * New Toggle Flashlights ui and improve function * Stringtable changes and ace_ai postInit clean up * TRACE fix and stringtable capitalization --- addons/ai/XEH_postInit.sqf | 36 +++--- addons/ai/script_component.hpp | 4 +- addons/zeus/CfgVehicles.hpp | 5 +- addons/zeus/XEH_postInit.sqf | 4 - .../functions/fnc_moduleToggleFlashlight.sqf | 59 +++++----- addons/zeus/functions/fnc_moduleToggleNvg.sqf | 78 ++++++------ .../functions/fnc_ui_toggleFlashlight.sqf | 107 ++++++----------- addons/zeus/functions/fnc_ui_toggleNvg.sqf | 95 ++++++--------- addons/zeus/stringtable.xml | 48 +++----- .../ui/Icon_Module_Zeus_Flashlight_ca.paa | Bin 0 -> 5625 bytes addons/zeus/ui/RscAttributes.hpp | 111 +++++++++--------- 11 files changed, 240 insertions(+), 307 deletions(-) create mode 100644 addons/zeus/ui/Icon_Module_Zeus_Flashlight_ca.paa diff --git a/addons/ai/XEH_postInit.sqf b/addons/ai/XEH_postInit.sqf index 25bd328ff7..4ce37fd314 100644 --- a/addons/ai/XEH_postInit.sqf +++ b/addons/ai/XEH_postInit.sqf @@ -7,12 +7,13 @@ { if (_bool) then { _x enableAI _section; + LOG_3("%1 enableAI %2 | ID: %3",_x,_section,clientOwner); } else { _x disableAI _section; + LOG_3("%1 disableAI %2 | ID: %3",_x,_section,clientOwner); }; - LOG(format [ARR_4("XEH_postInit: %1 disableAI %2 | ID %3", _x, _section, clientOwner)]); - } foreach (_units select {local _x}); - } foreach _sections + } forEach (_units select {local _x}); + } forEach _sections; }] call CBA_fnc_addEventHandler; [QGVAR(unGarrison), FUNC(unGarrison)] call CBA_fnc_addEventHandler; @@ -21,29 +22,26 @@ params ["_unitsArray"]; { _x params ["_unit", "_pos"]; - //_unit doFollow leader _unit; _unit setDestination [_pos, "LEADER PLANNED", true]; _unit doMove _pos; - LOG(format [ARR_4("XEH_postInit: %1 doMove %2 | ID %3", _unit, _pos, clientOwner)]); - } foreach _unitsArray + LOG_3("%1 doMove %2 | ID: %3",_unit,_pos,clientOwner); + } forEach _unitsArray; }] call CBA_fnc_addEventHandler; [QGVAR(setBehaviour), { params ["_groupsArray", "_behaviour"]; { - _x params ["_group"]; - _group setBehaviour _behaviour; - LOG(format [ARR_4("XEH_postInit: %1 setBehaviour %2 | ID %3", _group, _behaviour, clientOwner)]); - } foreach _groupsArray + _x setBehaviour _behaviour; + LOG_3("%1 setBehaviour %2 | ID: %3",_x,_behaviour,clientOwner); + } forEach _groupsArray; }] call CBA_fnc_addEventHandler; [QGVAR(enableAttack), { params ["_unitsArray", "_mode"]; { - _x params ["_unit"]; - _unit enableAttack _mode; - LOG(format [ARR_4("XEH_postInit: %1 enableAttack %2 | ID %3", _unit, _mode, clientOwner)]); - } foreach _unitsArray + _x enableAttack _mode; + LOG_3("%1 enableAttack %2 | ID: %3",_x,_mode,clientOwner); + } forEach _unitsArray; }] call CBA_fnc_addEventHandler; [QGVAR(setUnitPos), { @@ -66,14 +64,18 @@ _unit allowFleeing _cowardice; }] call CBA_fnc_addEventHandler; +[QGVAR(enableGunLights), { + params ["_unit", "_mode"]; + _unit enableGunLights _mode; +}] call CBA_fnc_addEventHandler; + #ifdef DEBUG_MODE_FULL addMissionEventHandler ["Draw3D", { private _unitMoveList = missionNameSpace getVariable [QGVAR(garrison_unitMoveList), []]; - { _x params ["_unit", "_pos"]; - switch true do { + switch (true) do { case (surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : { for "_i" from 0 to 3 do { drawLine3D [_unit modelToWorldVisualWorld [0,0,1], (AGLtoASL _pos), [1,0,0,1]]; @@ -102,6 +104,6 @@ drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75]; }; }; - } foreach _unitMoveList; + } forEach _unitMoveList; }]; #endif diff --git a/addons/ai/script_component.hpp b/addons/ai/script_component.hpp index 3a05db6896..9a0afcf434 100644 --- a/addons/ai/script_component.hpp +++ b/addons/ai/script_component.hpp @@ -2,8 +2,8 @@ #define COMPONENT_BEAUTIFIED AI #include "\z\ace\addons\main\script_mod.hpp" -//#define DEBUG_MODE_FULL -//#define DISABLE_COMPILE_CACHE +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_AI diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index f37c5e8310..63d221c1e3 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -279,14 +279,15 @@ class CfgVehicles { class GVAR(moduleToggleNvg): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(AI); - displayName = CSTRING(moduleToggleNVG_DisplayName); + displayName = CSTRING(ModuleToggleNVG_DisplayName); curatorInfoType = QGVAR(RscToggleNvg); }; class GVAR(moduleToggleFlashlight): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(AI); - displayName = CSTRING(moduleToggleFlashlight_DisplayName); + displayName = CSTRING(ModuleToggleFlashlight_DisplayName); curatorInfoType = QGVAR(RscToggleFlashlight); + icon = QPATHTOF(ui\Icon_Module_Zeus_Flashlight_ca.paa); }; class GVAR(AddFullArsenal): GVAR(moduleBase) { curatorCanAttach = 1; diff --git a/addons/zeus/XEH_postInit.sqf b/addons/zeus/XEH_postInit.sqf index 5929e8664e..adf3d75a9b 100644 --- a/addons/zeus/XEH_postInit.sqf +++ b/addons/zeus/XEH_postInit.sqf @@ -16,10 +16,6 @@ QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill); [QGVAR(moduleSearchNearby), CBA_fnc_searchNearby] call CBA_fnc_addEventHandler; [QGVAR(moduleSearchArea), CBA_fnc_taskSearchArea] call CBA_fnc_addEventHandler; [QGVAR(suppressiveFire), LINKFUNC(moduleSuppressiveFireLocal)] call CBA_fnc_addEventHandler; -[QGVAR(enableFlashlight), { - params ["_unit", "_mode"]; - _unit enableGunLights _mode; -}] call CBA_fnc_addEventHandler; // Editable object commands must be ran on server, this events are used in the respective module if (isServer) then { diff --git a/addons/zeus/functions/fnc_moduleToggleFlashlight.sqf b/addons/zeus/functions/fnc_moduleToggleFlashlight.sqf index b66d011704..c5f4c3668d 100644 --- a/addons/zeus/functions/fnc_moduleToggleFlashlight.sqf +++ b/addons/zeus/functions/fnc_moduleToggleFlashlight.sqf @@ -1,63 +1,64 @@ /* - * Author: alganthe - * Zeus module function to toggle Flashlights + * Author: alganthe, mharis001 + * Zeus module function to toggle flashlights. * * Arguments: * 0: Logic object * 1: Toggle mode * 2: Add gear - * 3: Target of the toggle 0: blufor; 1: opfor; 2: indep; 3: civ; 4: selected group + * 3: Target units (-1 - Selected group, 0 - BLUFOR, 1 - OPFOR, 2 - Independent, 3 - Civilian) * * Return Value: * None * * Example: - * [LOGIC, true, true, 4] call ace_zeus_fnc_moduleToggleFlashlight + * [LOGIC, true, true, -1] call ace_zeus_fnc_moduleToggleFlashlight * * Public: No -*/ + */ #include "script_component.hpp" params ["_logic", "_toggle", "_addGear", "_target"]; +TRACE_1("params",_this); +// Create array of target units private _units = []; -if (_target == 4) then { - _units = units (attachedTo _logic); +if (_target == -1) then { + _units = (units attachedTo _logic) select {alive _x && {!([_x] call EFUNC(common,isPlayer))} && {!(currentWeapon _x isEqualTo "")}}; } else { - _units = allUnits select {alive _x && {side _x == ([blufor, opfor, independent, civilian] select _target)}}, + private _side = [west, east, independent, civilian] select _target; + _units = allUnits select {alive _x && {side _x == _side} && {!([_x] call EFUNC(common,isPlayer))} && {!(currentWeapon _x isEqualTo "")}}; }; +// Toggle flashlights for units if (_toggle) then { + private _cfgWeapons = configFile >> "CfgWeapons"; { - // enableGunLights doesn't work on players - if !(isPlayer _x || {(currentWeapon _x) isEqualTo ""}) then { - private _pointer = (_x weaponAccessories (currentWeapon _x)) select 1; + private _weapon = currentWeapon _x; + private _pointer = (_x weaponAccessories _weapon) select 1; - if (!(_pointer isEqualTo "") && {isNull (configfile >> "CfgWeapons" >> _pointer >> "ItemInfo" >> "Pointer")}) then { - [QGVAR(enableFlashlight), [_x, "forceOn"], _x] call CBA_fnc_targetEvent; + if (!(_pointer isEqualTo "") && {getNumber (_cfgWeapons >> _pointer >> "ItemInfo" >> "FlashLight" >> "size") > 0}) then { + [QEGVAR(ai,enableGunLights), [_x, "forceOn"], _x] call CBA_fnc_targetEvent; + } else { + if (_addGear) then { + // Get compatible items for pointer slot + private _compatibleItems = [_weapon, "pointer"] call CBA_fnc_compatibleItems; - } else { - if (_addGear) then { - // Retrieve compatible items for the pointer slot - private _pointerSlotCompatible = [currentWeapon _x, "pointer"] call CBA_fnc_compatibleItems; + // Get random flashlight from compatible pointer slot items + private _flashlightItem = selectRandom (_compatibleItems select {getNumber (_cfgWeapons >> _x >> "ItemInfo" >> "FlashLight" >> "size") > 0}); - // Get flashlights from the array above and select the first one - private _flashlight = (_pointerSlotCompatible select {isNull (configfile >> "CfgWeapons" >> _x >> "ItemInfo" >> "Pointer")}) select 0; - - [QEGVAR(common,addWeaponItem), [_x, (currentWeapon _x), _flashlight], _x] call CBA_fnc_targetEvent; - [QGVAR(enableFlashlight), [_x, "forceOn"], _x] call CBA_fnc_targetEvent; - }; + // Add flashlight to weapon and enable + [QEGVAR(common,addWeaponItem), [_x, _weapon, _flashlightItem], _x] call CBA_fnc_targetEvent; + [QEGVAR(ai,enableGunLights), [_x, "forceOn"], _x] call CBA_fnc_targetEvent; + TRACE_2("Added flashlight to unit",_x,_flashlightItem); }; }; - } foreach _units; - + } forEach _units; } else { { - if !(isPlayer _x || {(currentWeapon _x) isEqualTo ""}) then { - [QGVAR(enableFlashlight), [_x, "forceOff"], _x] call CBA_fnc_targetEvent; - }; - } foreach _units; + [QEGVAR(ai,enableGunLights), [_x, "forceOff"], _x] call CBA_fnc_targetEvent; + } forEach _units; }; deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleToggleNvg.sqf b/addons/zeus/functions/fnc_moduleToggleNvg.sqf index 23a2cf5a05..7a01c27a4a 100644 --- a/addons/zeus/functions/fnc_moduleToggleNvg.sqf +++ b/addons/zeus/functions/fnc_moduleToggleNvg.sqf @@ -1,68 +1,76 @@ /* - * Author: alganthe - * Zeus module function to toggle NVGs + * Author: alganthe, mharis001 + * Zeus module function to toggle NVGs. * * Arguments: * 0: Logic object * 1: Toggle mode - * 2: Target of the toggle 0: blufor; 1: opfor; 2: indep; 3: civ; 4: selected group + * 2: Target units (-1 - Selected group, 0 - BLUFOR, 1 - OPFOR, 2 - Independent, 3 - Civilian) * * Return Value: * None * * Example: - * [LOGIC, true, 4] call ace_zeus_fnc_moduleToggleNvg + * [LOGIC, true, -1] call ace_zeus_fnc_moduleToggleNvg * * Public: No -*/ + */ #include "script_component.hpp" params ["_logic", "_toggle", "_target"]; +TRACE_1("params",_this); +// Create array of target units private _units = []; -if (_target == 4) then { - _units = units (attachedTo _logic); +if (_target == -1) then { + _units = (units attachedTo _logic) select {alive _x && {!([_x] call EFUNC(common,isPlayer))}}; } else { - _units = allUnits select {alive _x && {side _x == ([blufor, opfor, independent, civilian] select _target)}}, + private _side = [west, east, independent, civilian] select _target; + _units = allUnits select {alive _x && {side _x == _side} && {!([_x] call EFUNC(common,isPlayer))}}; }; +// Add or remove NVGs from units +private _cfgVehicles = configFile >> "CfgVehicles"; +private _cfgWeapons = configFile >> "CfgWeapons"; + if (_toggle) then { { - if (!isplayer _x && {hmd _x isEqualTo ""}) then { - private _cfgArray = getArray (configFile >> 'CfgVehicles' >> typeOf _x >>'linkedItems'); + if (hmd _x isEqualTo "") then { + // Get NVG item and helmet from unit config + private _linkedItems = getArray (_cfgVehicles >> typeOf _x >> "linkedItems"); + private _nvgItem = _linkedItems select {_x isKindOf ["NVGoggles", _cfgWeapons]}; + private _nvgHelmet = _linkedItems select {!(getArray (_cfgWeapons >> _x >> "subItems") isEqualTo [])}; - private _nvgClass = _cfgArray select {_x isKindOf ["NVGoggles",(configFile >> "CfgWeapons")]}; - private _nvgHelmet =_cfgArray select {count (getArray (configFile >> "CfgWeapons" >> _x >> "subItems")) > 0}; - - // Can't have more than 1 assigned by default - if (count _nvgClass == 1 || {count _nvgHelmet == 1}) then { - if (count _nvgHelmet == 1) then { - _x addHeadgear (_nvgHelmet select 0); - } else { - _x linkItem (_nvgClass select 0); - }; - - } else { - _x linkItem "NVGoggles"; + // Add NVG helmet if defined + if !(_nvgHelmet isEqualTo []) exitWith { + _x addHeadgear (_nvgHelmet select 0); }; - }; - } foreach _units; + // Add NVGs if defined + if !(_nvgItem isEqualTo []) exitWith { + _x linkItem (_nvgItem select 0); + }; + + // Default: add basic NVGs + _x linkItem "NVGoggles"; + }; + } forEach _units; } else { { - if (!isplayer _x) then { - private _cfgArray = getArray (configFile >> 'CfgVehicles' >> typeOf _x >>'linkedItems'); + // Get unit current NVGs or helmet with NVG built-in + private _nvgItem = hmd _x; + private _nvgHelmet = getArray (_cfgWeapons >> headgear _x >> "subItems") isEqualTo []; - private _nvgHelmet =_cfgArray select {count (getArray (configFile >> "CfgWeapons" >> _x >> "subItems")) > 0}; - - if (count _nvgHelmet == 1) then { - removeHeadgear _x; - } else { - _x unlinkItem (hmd _x); - }; + // Remove NVG equipment from unit + if !(_nvgHelmet) then { + removeHeadgear _x; }; - } foreach _units; + + if !(_nvgItem isEqualTo "") then { + _x unlinkItem _nvgItem; + }; + } forEach _units; }; deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf index a40a55ac40..874f2dcc91 100644 --- a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf +++ b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf @@ -1,35 +1,35 @@ /* - * Author: alganthe - * Initalises the `Toggle Flashlights` zeus module display + * Author: alganthe, mharis001 + * Initializes the "Toggle Flashlights" Zeus module display. * * Arguments: - * 0: Flashlight toggle controls group + * 0: toggleFlashlight controls group * * Return Value: * None * * Example: - * onSetFocus = "_this call ace_zeus_fnc_ui_toggleFLashlight" + * [CONTROL] call ace_zeus_fnc_ui_toggleFlashlight * * Public: No -*/ + */ #include "script_component.hpp" -disableSerialization; +#define COMBO_ITEMS [[LSTRING(SelectedGroup), "\a3\ui_f_curator\data\displays\rscdisplaycurator\modegroups_ca.paa"], ["STR_WEST", "\a3\ui_f\data\map\diary\icons\playerwest_ca.paa"], ["STR_EAST", "\a3\ui_f\data\map\diary\icons\playereast_ca.paa"], ["STR_guerrila", "\a3\ui_f\data\map\diary\icons\playerguer_ca.paa"], ["STR_Civilian", "\a3\ui_f\data\map\diary\icons\playerciv_ca.paa"]] params ["_control"]; -//Generic Init: -private _display = ctrlparent _control; -private _ctrlButtonOK = _display displayctrl 1; //IDC_OK -private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); -TRACE_1("logicObject",_logic); +// Generic init +private _display = ctrlParent _control; +private _ctrlButtonOK = _display displayCtrl 1; // IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); +TRACE_1("Logic Object",_logic); -_control ctrlRemoveAllEventHandlers "setFocus"; +_control ctrlRemoveAllEventHandlers "SetFocus"; +// Validate module target private _unit = effectiveCommander (attachedTo _logic); -// Handles errors scopeName "Main"; private _fnc_errorAndClose = { params ["_msg"]; @@ -50,59 +50,24 @@ if !(isNull _unit) then { }; }; -//Specific on-load stuff: -private _comboBox = _display displayCtrl 56218; -private _comboBox2 = _display displayCtrl 56219; -private _comboBox3 = _display displayCtrl 56220; +// Specific onLoad stuff +private _combo = _display displayCtrl 56220; +// Add target combo options (only add selected group option if placed on unit) { - _comboBox lbSetValue [_comboBox lbAdd (_x select 0), _x select 1]; -} forEach [ - [localize ELSTRING(common,Disabled), 0], - [localize ELSTRING(common,Enabled), 1] -]; + _x params ["_text", "_icon"]; + _combo lbSetPicture [_combo lbAdd (localize _text), _icon]; +} forEach (COMBO_ITEMS select [[0, 1] select (isNull _unit), 5]); -if (isNull _unit) then { - { - _comboBox2 lbSetValue [_comboBox2 lbAdd (_x select 0), _x select 1]; - } forEach [ - ["BLUFOR", 0], - ["OPFOR", 1], - ["INDEP", 2], - ["CIV", 3] - ]; -} else { - { - _comboBox2 lbSetValue [_comboBox2 lbAdd (_x select 0), _x select 1]; - } forEach [ - [localize LSTRING(moduleToggleNVG_SelectedGroup), 4], - ["BLUFOR", 0], - ["OPFOR", 1], - ["INDEP", 2], - ["CIV", 3] - ]; +_combo lbSetCurSel 0; + +// Set default flashlight status +if !(isNull _unit) then { + (_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn (currentWeapon _unit))); }; -{ - _comboBox3 lbSetValue [_comboBox3 lbAdd (_x select 0), _x select 1]; -} foreach [ - [localize ELSTRING(common,Disabled), 0], - [localize ELSTRING(common,Enabled), 1] -]; - - -private _enabledDefault = false; -if (!isNull _unit) then { - _enabledDefault = _unit isFlashlightOn (currentWeapon _unit); -}; -_comboBox lbSetCurSel ([0,1] select _enabledDefault); -_comboBox2 lbSetCurSel 0; -_comboBox3 lbSetCurSel 0; - private _fnc_onUnload = { - params ["_display"]; - - private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; deleteVehicle _logic; @@ -111,22 +76,20 @@ private _fnc_onUnload = { private _fnc_onConfirm = { params [["_ctrlButtonOK", controlNull, [controlNull]]]; - private _display = ctrlparent _ctrlButtonOK; + private _display = ctrlParent _ctrlButtonOK; if (isNull _display) exitWith {}; - private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; - private _combo1 = _display displayCtrl 56218; - private _combo2 = _display displayCtrl 56219; - private _combo3 = _display displayCtrl 56220; + private _toggle = lbCurSel (_display displayCtrl 56218) > 0; + private _addGear = lbCurSel (_display displayCtrl 56219) > 0; + private _combo = _display displayCtrl 56220; + private _target = lbCurSel _combo; + if (lbSize _combo > 4) then {DEC(_target)}; - private _toggle = _combo1 lbValue (lbCurSel _combo1); - private _target = _combo2 lbValue (lbCurSel _combo2); - private _gear = _combo3 lbValue (lbCurSel _combo3); - - [_logic, _toggle == 1, _gear == 1, _target] call FUNC(moduleToggleFlashlight); + [_logic, _toggle, _addGear, _target] call FUNC(moduleToggleFlashlight); }; -_display displayAddEventHandler ["unload", _fnc_onUnload]; -_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm]; +_display displayAddEventHandler ["Unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_toggleNvg.sqf b/addons/zeus/functions/fnc_ui_toggleNvg.sqf index fcfbc52c83..c10b0b5bbc 100644 --- a/addons/zeus/functions/fnc_ui_toggleNvg.sqf +++ b/addons/zeus/functions/fnc_ui_toggleNvg.sqf @@ -1,35 +1,35 @@ /* - * Author: alganthe - * Initalises the `Toggle NVGs` zeus module display + * Author: alganthe, mharis001 + * Initializes the "Toggle NVGs" Zeus module display. * * Arguments: - * 0: Nvg toggle controls group + * 0: toggleNvg controls group * * Return Value: * None * * Example: - * onSetFocus = "_this call ace_zeus_fnc_ui_toggleNvg" + * [CONTROL] call ace_zeus_fnc_ui_toggleNvg * * Public: No -*/ + */ #include "script_component.hpp" -disableSerialization; +#define COMBO_ITEMS [[LSTRING(SelectedGroup), "\a3\ui_f_curator\data\displays\rscdisplaycurator\modegroups_ca.paa"], ["STR_WEST", "\a3\ui_f\data\map\diary\icons\playerwest_ca.paa"], ["STR_EAST", "\a3\ui_f\data\map\diary\icons\playereast_ca.paa"], ["STR_guerrila", "\a3\ui_f\data\map\diary\icons\playerguer_ca.paa"], ["STR_Civilian", "\a3\ui_f\data\map\diary\icons\playerciv_ca.paa"]] params ["_control"]; -//Generic Init: -private _display = ctrlparent _control; -private _ctrlButtonOK = _display displayctrl 1; //IDC_OK -private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); -TRACE_1("logicObject",_logic); +// Generic init +private _display = ctrlParent _control; +private _ctrlButtonOK = _display displayCtrl 1; // IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); +TRACE_1("Logic Object",_logic); -_control ctrlRemoveAllEventHandlers "setFocus"; +_control ctrlRemoveAllEventHandlers "SetFocus"; +// Validate module target private _unit = effectiveCommander (attachedTo _logic); -// Handles errors scopeName "Main"; private _fnc_errorAndClose = { params ["_msg"]; @@ -50,50 +50,24 @@ if !(isNull _unit) then { }; }; -//Specific on-load stuff: -private _comboBox = _display displayCtrl 92855; -private _comboBox2 = _display displayCtrl 92856; +// Specific onLoad stuff +private _combo = _display displayCtrl 92856; +// Add target combo options (only add selected group option if placed on unit) { - _comboBox lbSetValue [_comboBox lbAdd (_x select 0), _x select 1]; -} forEach [ - [localize ELSTRING(common,Disabled), 0], - [localize ELSTRING(common,Enabled), 1] -]; + _x params ["_text", "_icon"]; + _combo lbSetPicture [_combo lbAdd (localize _text), _icon]; +} forEach (COMBO_ITEMS select [[0, 1] select (isNull _unit), 5]); -if (isNull _unit) then { - { - _comboBox2 lbSetValue [_comboBox2 lbAdd (_x select 0), _x select 1]; - } forEach [ - ["BLUFOR", 0], - ["OPFOR", 1], - ["INDEP", 2], - ["CIV", 3] - ]; -} else { - { - _comboBox2 lbSetValue [_comboBox2 lbAdd (_x select 0), _x select 1]; - } forEach [ - [localize LSTRING(moduleToggleNVG_SelectedGroup), 4], - ["BLUFOR", 0], - ["OPFOR", 1], - ["INDEP", 2], - ["CIV", 3] - ]; +_combo lbSetCurSel 0; + +// Set default NVG status +if !(isNull _unit) then { + (_display displayCtrl 92855) lbSetCurSel ([0, 1] select !(hmd _unit isEqualTo "")); }; - -private _enabledDefault = false; -if (!isNull _unit) then { - _enabledDefault = !(hmd _unit isEqualTo ""); -}; -_comboBox lbSetCurSel ([0,1] select _enabledDefault); -_comboBox2 lbSetCurSel 0; - private _fnc_onUnload = { - params ["_display"]; - - private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; deleteVehicle _logic; @@ -102,20 +76,19 @@ private _fnc_onUnload = { private _fnc_onConfirm = { params [["_ctrlButtonOK", controlNull, [controlNull]]]; - private _display = ctrlparent _ctrlButtonOK; + private _display = ctrlParent _ctrlButtonOK; if (isNull _display) exitWith {}; - private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; - private _combo1 = _display displayCtrl 92855; - private _combo2 = _display displayCtrl 92856; + private _toggle = lbCurSel (_display displayCtrl 92855) > 0; + private _combo = _display displayCtrl 92856; + private _target = lbCurSel _combo; + if (lbSize _combo > 4) then {DEC(_target)}; - private _toggle = _combo1 lbValue (lbCurSel _combo1); - private _target = _combo2 lbValue (lbCurSel _combo2); - - [_logic, _toggle == 1, _target] call FUNC(moduleToggleNvg); + [_logic, _toggle, _target] call FUNC(moduleToggleNvg); }; -_display displayAddEventHandler ["unload", _fnc_onUnload]; -_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm]; +_display displayAddEventHandler ["Unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", _fnc_onConfirm]; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 38696f4038..d1daeab775 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1067,7 +1067,7 @@ 装载到货物中 화물 싣기 - + Toggle NVGs Nachtsichtgeräte Hinzufügen/Entfernen Basculer JVN @@ -1077,8 +1077,8 @@ 切换夜视镜 야시경 토글 - - NVG equipment + + NVG Equipment Nachtsichtgeräte Equipment de vision nocturne Attrezzatura NVG @@ -1087,7 +1087,7 @@ 夜视镜装备 야시경 장비 - + Add or remove NVGs from units Nachtsichtgeräte Hinzufügen/Entfernen Ajouter ou retirer JVN des unités @@ -1097,18 +1097,14 @@ 增加或移除单位的夜视镜 야시경 추가/제거 - - Toggle NVG target - Wechsle Nachtsichtgeräteziel - Cible du basculement - Attiva obiettivo NVG - 選択先の暗視装置の切り替え - 切換目標的夜視鏡狀態 - 切换目标的夜视镜状态 - 목표의 야시경 토글 + + Toggle Target - - Selected group + + Units affected by the toggle + + + Selected Group Ausgewählte Gruppe Groupe sélectionné Gruppo selezionato @@ -1117,8 +1113,8 @@ 选择小队 그룹 선택 - - Toggle flashlights + + Toggle Flashlights Ändere Taschenlampen Basculer lampes torches Attiva torce @@ -1127,18 +1123,8 @@ 切换手电筒 손전등 토글 - - Toggle flashlight target - Wechsle Nachtsichtgeräteziel - Cible du basculement - Attiva obiettivo torcia - 選択先のフラッシュライトの切り替え - 切換目標的手電筒狀態 - 切换目标的手电筒状态 - 목표의 손전등 토글 - - - Flashlight + + Flashlights Taschenlampe Lampe torche Torcia @@ -1147,8 +1133,8 @@ 手电筒 손전등 - - Add gear + + Add Gear Ausrüstung hinzufügen Ajouter équipement Aggiungi equipaggiamento diff --git a/addons/zeus/ui/Icon_Module_Zeus_Flashlight_ca.paa b/addons/zeus/ui/Icon_Module_Zeus_Flashlight_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..276411b7aa432e2ab1176b659a19b84f2ea02b53 GIT binary patch literal 5625 zcmeHLZ%kWN6u+1Cg#zoS!za$d^0X`w*ditd6Upo&U>TXj#`U3zeBh4`{Q&i&e?llr z6phOmOQy!e6u%k62Mp$^aUT#8hCrAL%38Xuld;VhrYvBkquuqK`}&}LTT&(_bjFk1 z*Ph($z7W8=Xep<&x#JS0IIe^%vB((iu+_^${qg_BquO?1~L>`?_6n z_F=Wf1|~;d6cwc)+WDjJ=H*+Ag;-z4d*;0Z_qIR05Gilg^%FopGT*uESnY|SzChG| zIT;V<(5UBHdHZ)b5B?x#toFu+d!qTsr=vTVzEaz4YHJ0`r--7E_l;UO%p!385aN~z z$-Rd5`}BK0uefF9rU8%8ZFo@KKSc14vai|Mp}2n#*`;iIUv0BHk8ytz1xgP22Vwz7 z^z>HYVHd?eMwLIvQ^I#&ZE7b8c_=a@DuWgPf0{= zeo3wKBM<)J+R2I={BeC{mmBqMvO9lY)A#7DF&``j3bE`ALSC6+Hym-^>-CZ+dJ*sV z{psHN`?JJ=&;ICS0zQKBG#Jl+Qak^$>~b0H%Z^~^!hjZHpe}rJmIpZP_hf#@PhWQU zy9+sl}JB{_SlEEVBDz#|9-Xae^O`UA&9QQT>V zhxO+%&$8MYKQDq(9{|xKo@LaBkc=;k`WyAlF6gqXa((aYANF5zqnQkjUmTC3x%9?^ zK2Y8qjGuo2?vuvTjcYt!FuQ^SZL5o(`8Y1rh)*hh&y{36(%nCdCwEsMIet8Jj``Tw zKgZ)<^A95)Hh(f6w%N_$@xOm)2*ZWJBh798(VY-qm93AjMt?B!oAr+m``C>UpO#NR zL~(5+2TthujvMYL<9_MRr@B8t-=#C%7A+qA2lP#44_jAqyt!NZN<<Qt`l5RR})Te+qdK zk}h+9?oj4oDehLZx@fK!(t53ov6?7(d}^>G&=VWM|0kCH`uq82@YpDCy$-^}(+H?S zlt<>eA5PqlUD8aTW0^DPh)w5O7jS=UIvgZW)6^c}WeuG2wKmK~_XklqN$|uy#NWmt z?bp(LEQ{nYi%cJHs=)n#gzfTrS%Yc*!4>EcbS^qL9`e60Pqm>esSZbaqE4+1gB}u> zYt7fvO`g)DzSu~Qb}d6&U@fhe06X2L@O8ufg8xO5VBmTqK7SJOYT27wnM+8eLJeWS zimgCOY(IdF!!Pr0mZAv4jtOtwthxUzH)BHkLf-~<<0Qcox6L1wF1@2y14K~Rz6oD} z<8_z|u}8BB$y*vM^nX;xy9sb=Wxg055)52#uPjxO%f3_Yi%*2dU*Mo0_7oIO|;Ys>4l+cC`KnA@iha&7< rlGUpRQEUpC{Ke<rX32s!tbKiv5GVE+@;poX!(4_erN=lm^ literal 0 HcmV?d00001 diff --git a/addons/zeus/ui/RscAttributes.hpp b/addons/zeus/ui/RscAttributes.hpp index 87ce44e54a..8345904ca9 100644 --- a/addons/zeus/ui/RscAttributes.hpp +++ b/addons/zeus/ui/RscAttributes.hpp @@ -583,42 +583,46 @@ class GVAR(RscToggleNvg): RscDisplayAttributes { class Title: Title {}; class Content: Content { class Controls { - class ToggleNvg: RscControlsGroupNoScrollbars { + class toggleNvg: RscControlsGroupNoScrollbars { onSetFocus = QUOTE(_this call FUNC(ui_toggleNvg)); idc = 92854; x = 0; y = 0; w = W_PART(26); - h = H_PART(3); + h = H_PART(2.1); class controls { - class ToggleNvgTitle: Title { + class ToggleLabel: RscText { idc = -1; - text = CSTRING(moduleToggleNVG_ToggleNvgTitle); - toolTip = CSTRING(moduleToggleNVG_ToggleNvgTitleTooltip); - x = H_PART(0); - y = H_PART(0); - w = W_PART(7); + text = CSTRING(ModuleToggleNVG_NvgEquipment); + tooltip = CSTRING(ModuleToggleNVG_NvgEquipment_tooltip); + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(1); + colorBackground[] = {0, 0, 0, 0.5}; }; - class ToggleNvgCombo: RscCombo { + class Toggle: ctrlToolbox { idc = 92855; - x = H_PART(6); - y = H_PART(0); - w = W_PART(10.1); + x = W_PART(10.1); + y = 0; + w = W_PART(15.9); h = H_PART(1); + rows = 1; + columns = 2; + strings[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled)}; }; - class ToggleNvgSideTitle: Title { - idc = -1; - text = CSTRING(moduleToggleNVG_ToggleNvgSide); - x = H_PART(0); - y = H_PART(1.2); - w = W_PART(7); + class TargetLabel: ToggleLabel { + text = CSTRING(ToggleTarget); + tooltip = CSTRING(ToggleTarget_Tooltip); + y = H_PART(1.1); }; - class ToggleNvgSideCombo: RscCombo { + class Target: RscCombo { idc = 92856; - x = H_PART(6); - y = H_PART(1.2); - w = W_PART(10.1); + x = W_PART(10.1); + y = H_PART(1.1); + w = W_PART(15.9); h = H_PART(1); + colorBackground[] = {0, 0, 0, 0.7}; }; }; }; @@ -637,55 +641,54 @@ class GVAR(RscToggleFlashlight): RscDisplayAttributes { class Title: Title {}; class Content: Content { class Controls { - class ToggleFlashlight: RscControlsGroupNoScrollbars { + class toggleFlashlight: RscControlsGroupNoScrollbars { onSetFocus = QUOTE(_this call FUNC(ui_toggleFlashlight)); idc = 56217; x = 0; y = 0; w = W_PART(26); - h = H_PART(5); + h = H_PART(3.2); class controls { - class ToggleFlashlightTitle: Title { + class ToggleLabel: RscText { idc = -1; - text = CSTRING(moduleToggleFlashlight_ToggleFlashlightTitle); - x = H_PART(0); - y = H_PART(0); - w = W_PART(7); + text = CSTRING(ModuleToggleFlashlight_Flashlights); + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(1); + colorBackground[] = {0, 0, 0, 0.5}; }; - class ToggleFlashlightCombo: RscCombo { + class Toggle: ctrlToolbox { idc = 56218; - x = H_PART(6); - y = H_PART(0); - w = W_PART(10.1); + x = W_PART(10.1); + y = 0; + w = W_PART(15.9); h = H_PART(1); + rows = 1; + columns = 2; + strings[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled)}; }; - class ToggleFlashlightSideTitle: Title { - idc = -1; - text = CSTRING(moduleToggleFlashlight_ToggleFlashlightSide); - x = H_PART(0); - y = H_PART(1.2); - w = W_PART(7); + class AddGearLabel: ToggleLabel { + text = CSTRING(ModuleToggleFlashlight_AddGear); + y = H_PART(1.1); }; - class ToggleFlashlightSideCombo: RscCombo { + class AddGear: Toggle { idc = 56219; - x = H_PART(6); - y = H_PART(1.2); - w = W_PART(10.1); - h = H_PART(1); + y = H_PART(1.1); + strings[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; }; - class ToggleFlashlightGearTitle: Title { - idc = -1; - text = CSTRING(moduleToggleFlashlight_ToggleFlashlightGear); - x = H_PART(0); - y = H_PART(2.4); - w = W_PART(7); + class TargetLabel: ToggleLabel { + text = CSTRING(ToggleTarget); + tooltip = CSTRING(ToggleTarget_Tooltip); + y = H_PART(2.2); }; - class ToggleFlashlightGearCombo: RscCombo { + class Target: RscCombo { idc = 56220; - x = H_PART(6); - y = H_PART(2.4); - w = W_PART(10.1); + x = W_PART(10.1); + y = H_PART(2.2); + w = W_PART(15.9); h = H_PART(1); + colorBackground[] = {0, 0, 0, 0.7}; }; }; };