mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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
This commit is contained in:
parent
a828ebe591
commit
ec8115d2a4
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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 <OBJECT>
|
||||
* 1: Toggle mode <BOOL>
|
||||
* 2: Add gear <BOOL>
|
||||
* 3: Target of the toggle <SCALAR> 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) <NUMBER>
|
||||
*
|
||||
* 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;
|
||||
|
||||
if (!(_pointer isEqualTo "") && {isNull (configfile >> "CfgWeapons" >> _pointer >> "ItemInfo" >> "Pointer")}) then {
|
||||
[QGVAR(enableFlashlight), [_x, "forceOn"], _x] call CBA_fnc_targetEvent;
|
||||
private _weapon = currentWeapon _x;
|
||||
private _pointer = (_x weaponAccessories _weapon) select 1;
|
||||
|
||||
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 {
|
||||
// Retrieve compatible items for the pointer slot
|
||||
private _pointerSlotCompatible = [currentWeapon _x, "pointer"] call CBA_fnc_compatibleItems;
|
||||
// Get compatible items for pointer slot
|
||||
private _compatibleItems = [_weapon, "pointer"] call CBA_fnc_compatibleItems;
|
||||
|
||||
// Get flashlights from the array above and select the first one
|
||||
private _flashlight = (_pointerSlotCompatible select {isNull (configfile >> "CfgWeapons" >> _x >> "ItemInfo" >> "Pointer")}) select 0;
|
||||
// Get random flashlight from compatible pointer slot items
|
||||
private _flashlightItem = selectRandom (_compatibleItems select {getNumber (_cfgWeapons >> _x >> "ItemInfo" >> "FlashLight" >> "size") > 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;
|
||||
|
@ -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 <OBJECT>
|
||||
* 1: Toggle mode <BOOL>
|
||||
* 2: Target of the toggle <SCALAR> 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) <NUMBER>
|
||||
*
|
||||
* 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 {
|
||||
// Add NVG helmet if defined
|
||||
if !(_nvgHelmet isEqualTo []) exitWith {
|
||||
_x addHeadgear (_nvgHelmet select 0);
|
||||
} else {
|
||||
_x linkItem (_nvgClass select 0);
|
||||
};
|
||||
|
||||
} else {
|
||||
// Add NVGs if defined
|
||||
if !(_nvgItem isEqualTo []) exitWith {
|
||||
_x linkItem (_nvgItem select 0);
|
||||
};
|
||||
|
||||
// Default: add basic NVGs
|
||||
_x linkItem "NVGoggles";
|
||||
};
|
||||
};
|
||||
} foreach _units;
|
||||
|
||||
} 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 {
|
||||
// Remove NVG equipment from unit
|
||||
if !(_nvgHelmet) then {
|
||||
removeHeadgear _x;
|
||||
} else {
|
||||
_x unlinkItem (hmd _x);
|
||||
};
|
||||
|
||||
if !(_nvgItem isEqualTo "") then {
|
||||
_x unlinkItem _nvgItem;
|
||||
};
|
||||
} foreach _units;
|
||||
} forEach _units;
|
||||
};
|
||||
|
||||
deleteVehicle _logic;
|
||||
|
@ -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 <CONTROL>
|
||||
* 0: toggleFlashlight controls group <CONTROL>
|
||||
*
|
||||
* 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];
|
||||
|
@ -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 <CONTROL>
|
||||
* 0: toggleNvg controls group <CONTROL>
|
||||
*
|
||||
* 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];
|
||||
|
@ -1067,7 +1067,7 @@
|
||||
<Chinesesimp>装载到货物中</Chinesesimp>
|
||||
<Korean>화물 싣기</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleNVG_DisplayName">
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleNVG_DisplayName">
|
||||
<English>Toggle NVGs</English>
|
||||
<German>Nachtsichtgeräte Hinzufügen/Entfernen</German>
|
||||
<French>Basculer JVN</French>
|
||||
@ -1077,8 +1077,8 @@
|
||||
<Chinesesimp>切换夜视镜</Chinesesimp>
|
||||
<Korean>야시경 토글</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgTitle">
|
||||
<English>NVG equipment</English>
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleNVG_NvgEquipment">
|
||||
<English>NVG Equipment</English>
|
||||
<German>Nachtsichtgeräte</German>
|
||||
<French>Equipment de vision nocturne</French>
|
||||
<Italian>Attrezzatura NVG</Italian>
|
||||
@ -1087,7 +1087,7 @@
|
||||
<Chinesesimp>夜视镜装备</Chinesesimp>
|
||||
<Korean>야시경 장비</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgTitleTooltip">
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleNVG_NvgEquipment_tooltip">
|
||||
<English>Add or remove NVGs from units</English>
|
||||
<German>Nachtsichtgeräte Hinzufügen/Entfernen</German>
|
||||
<French>Ajouter ou retirer JVN des unités</French>
|
||||
@ -1097,18 +1097,14 @@
|
||||
<Chinesesimp>增加或移除单位的夜视镜</Chinesesimp>
|
||||
<Korean>야시경 추가/제거</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgSide">
|
||||
<English>Toggle NVG target</English>
|
||||
<German>Wechsle Nachtsichtgeräteziel</German>
|
||||
<French>Cible du basculement</French>
|
||||
<Italian>Attiva obiettivo NVG</Italian>
|
||||
<Japanese>選択先の暗視装置の切り替え</Japanese>
|
||||
<Chinese>切換目標的夜視鏡狀態</Chinese>
|
||||
<Chinesesimp>切换目标的夜视镜状态</Chinesesimp>
|
||||
<Korean>목표의 야시경 토글</Korean>
|
||||
<Key ID="STR_ACE_Zeus_ToggleTarget">
|
||||
<English>Toggle Target</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleNVG_SelectedGroup">
|
||||
<English>Selected group</English>
|
||||
<Key ID="STR_ACE_Zeus_ToggleTarget_Tooltip">
|
||||
<English>Units affected by the toggle</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_SelectedGroup">
|
||||
<English>Selected Group</English>
|
||||
<German>Ausgewählte Gruppe</German>
|
||||
<French>Groupe sélectionné</French>
|
||||
<Italian>Gruppo selezionato</Italian>
|
||||
@ -1117,8 +1113,8 @@
|
||||
<Chinesesimp>选择小队</Chinesesimp>
|
||||
<Korean>그룹 선택</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_DisplayName">
|
||||
<English>Toggle flashlights</English>
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleFlashlight_DisplayName">
|
||||
<English>Toggle Flashlights</English>
|
||||
<German>Ändere Taschenlampen</German>
|
||||
<French>Basculer lampes torches</French>
|
||||
<Italian>Attiva torce</Italian>
|
||||
@ -1127,18 +1123,8 @@
|
||||
<Chinesesimp>切换手电筒</Chinesesimp>
|
||||
<Korean>손전등 토글</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightSide">
|
||||
<English>Toggle flashlight target</English>
|
||||
<German>Wechsle Nachtsichtgeräteziel</German>
|
||||
<French>Cible du basculement</French>
|
||||
<Italian>Attiva obiettivo torcia</Italian>
|
||||
<Japanese>選択先のフラッシュライトの切り替え</Japanese>
|
||||
<Chinese>切換目標的手電筒狀態</Chinese>
|
||||
<Chinesesimp>切换目标的手电筒状态</Chinesesimp>
|
||||
<Korean>목표의 손전등 토글</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightTitle">
|
||||
<English>Flashlight</English>
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleFlashlight_Flashlights">
|
||||
<English>Flashlights</English>
|
||||
<German>Taschenlampe</German>
|
||||
<French>Lampe torche</French>
|
||||
<Italian>Torcia</Italian>
|
||||
@ -1147,8 +1133,8 @@
|
||||
<Chinesesimp>手电筒</Chinesesimp>
|
||||
<Korean>손전등</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightGear">
|
||||
<English>Add gear</English>
|
||||
<Key ID="STR_ACE_Zeus_ModuleToggleFlashlight_AddGear">
|
||||
<English>Add Gear</English>
|
||||
<German>Ausrüstung hinzufügen</German>
|
||||
<French>Ajouter équipement</French>
|
||||
<Italian>Aggiungi equipaggiamento</Italian>
|
||||
|
BIN
addons/zeus/ui/Icon_Module_Zeus_Flashlight_ca.paa
Normal file
BIN
addons/zeus/ui/Icon_Module_Zeus_Flashlight_ca.paa
Normal file
Binary file not shown.
@ -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};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user