Skip to content

Commit

Permalink
Zeus - UI improvements and additional objects setting for Editable Ob…
Browse files Browse the repository at this point in the history
…jects module (#6391)

* Add additional objects setting to Editable Objects

* Fix Teleport Players UI height and remove unnecessary strings

* Improve Garrison UI

* Config based combo for Toggle NVG and Toggle Flashlights UI

* Capitalize garrison module names
  • Loading branch information
mharis001 authored and PabstMirror committed Sep 13, 2018
1 parent 429ecb6 commit d6976f6
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 166 deletions.
4 changes: 2 additions & 2 deletions addons/zeus/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (isServer) then {
[QGVAR(addObjects), {
params ["_objects", ["_curator", objNull]];

if !(isNull _curator) exitWith { _curator addCuratorEditableObjects [_objects, true]; };
if (!isNull _curator) exitWith {_curator addCuratorEditableObjects [_objects, true]};

{
_x addCuratorEditableObjects [_objects, true];
Expand All @@ -33,7 +33,7 @@ if (isServer) then {
[QGVAR(removeObjects), {
params ["_objects", ["_curator", objNull]];

if !(isNull _curator) exitWith { _curator removeCuratorEditableObjects [_objects, true]; };
if (!isNull _curator) exitWith {_curator removeCuratorEditableObjects [_objects, true]};

{
_x removeCuratorEditableObjects [_objects, true];
Expand Down
13 changes: 11 additions & 2 deletions addons/zeus/functions/fnc_ui_editableObjects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ private _fnc_onConfirm = {

private _radius = GETVAR(_display,GVAR(radius),100);
private _editingMode = lbCurSel (_display displayCtrl 19181) > 0;
private _allCurators = [getAssignedCuratorLogic player, objNull] select (lbCurSel (_display displayCtrl 19182));
private _objects = nearestObjects [getPos _logic, ["All"], _radius];
private _allCurators = [getAssignedCuratorLogic player, objNull] select lbCurSel (_display displayCtrl 19182);
private _additionalObjects = lbCurSel (_display displayCtrl 19183);

private _objects = nearestObjects [_logic, ["All"], _radius];
if (_additionalObjects == 1) then {
_objects append call CBA_fnc_players;
} else {
if (_additionalObjects == 2) then {
_objects append (allUnits + allDeadMen select {!(_x isKindOf "HeadlessClient_F")});
};
};

if (_editingMode) then {
[QGVAR(addObjects), [_objects, _allCurators]] call CBA_fnc_serverEvent;
Expand Down
64 changes: 21 additions & 43 deletions addons/zeus/functions/fnc_ui_garrison.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Author: alganthe
* Initalises the "Garrison" zeus module display.
* Author: alganthe, mharis001
* Initializes the "Garrison" Zeus module display.
*
* Arguments:
* 0: Garrison controls group <CONTROL>
Expand All @@ -9,26 +9,24 @@
* None
*
* Example:
* onSetFocus = "_this call ace_zeus_fnc_ui_garrison"
* [CONTROL] call ace_zeus_fnc_ui_garrison
*
* Public: No
*/
#include "script_component.hpp"

disableSerialization;

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";

// Handles errors
private _unit = effectiveCommander (attachedTo _logic);
// Validate module target
private _unit = effectiveCommander attachedTo _logic;

scopeName "Main";
private _fnc_errorAndClose = {
Expand All @@ -54,26 +52,9 @@ switch (false) do {
};
};

//Specific on-load stuff:
private _listbox = _display displayCtrl 73063;
{
_listbox lbSetValue [_listbox lbAdd (_x select 0), _x select 1];
} forEach [
[localize LSTRING(ModuleGarrison_FillingModeEven), 0],
[localize LSTRING(ModuleGarrison_FillingModeBuilding), 1],
[localize LSTRING(ModuleGarrison_FillingModeRandom), 2]
];

_listbox lbSetCurSel 0;

//Specific on-load stuff:
(_display displayCtrl 73061) cbSetChecked (_logic getVariable ["TopDownFilling",false]);
(_display displayCtrl 73062) cbSetChecked (_logic getVariable ["Teleport",false]);

// Specific onLoad stuff
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;
Expand All @@ -82,22 +63,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 _lb = _display displayCtrl 73063;

private _radius = GETVAR(_display,GVAR(radius),50);
private _position = GETVAR(_display,GVAR(position),getPos _logic);
private _mode = _lb lbValue (lbCurSel _lb);
private _TopDownFilling = cbChecked (_display displayCtrl 73061);
private _teleport = cbChecked (_display displayCtrl 73062);
private _teleport = lbCurSel (_display displayCtrl 73061) > 0;
private _topDown = lbCurSel (_display displayCtrl 73062) > 0;
private _fillingMode = lbCurSel (_display displayCtrl 73063);

[_logic, _position ,_radius, _mode, _TopDownFilling, _teleport] call FUNC(moduleGarrison);
[_logic, getPos _logic, _radius, _fillingMode, _topDown, _teleport] call FUNC(moduleGarrison);
};

_display displayAddEventHandler ["unload", _fnc_onUnload];
_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm];
_display displayAddEventHandler ["Unload", _fnc_onUnload];
_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", _fnc_onConfirm];
22 changes: 6 additions & 16 deletions addons/zeus/functions/fnc_ui_toggleFlashlight.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
#include "script_component.hpp"

#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
Expand All @@ -28,7 +26,7 @@ TRACE_1("Logic Object",_logic);
_control ctrlRemoveAllEventHandlers "SetFocus";

// Validate module target
private _unit = effectiveCommander (attachedTo _logic);
private _unit = effectiveCommander attachedTo _logic;

scopeName "Main";
private _fnc_errorAndClose = {
Expand All @@ -51,19 +49,11 @@ if !(isNull _unit) then {
};

// Specific onLoad stuff
private _combo = _display displayCtrl 56220;

// Add target combo options (only add selected group option if placed on unit)
{
_x params ["_text", "_icon"];
_combo lbSetPicture [_combo lbAdd (localize _text), _icon];
} forEach (COMBO_ITEMS select [[0, 1] select (isNull _unit), 5]);

_combo lbSetCurSel 0;

// Set default flashlight status
if !(isNull _unit) then {
(_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn (currentWeapon _unit)));
// Remove selected group option in not placed on unit and set default flashlight status
if (isNull _unit) then {
(_display displayCtrl 56220) lbDelete 0;
} else {
(_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn currentWeapon _unit));
};

private _fnc_onUnload = {
Expand Down
20 changes: 5 additions & 15 deletions addons/zeus/functions/fnc_ui_toggleNvg.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
#include "script_component.hpp"

#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
Expand All @@ -28,7 +26,7 @@ TRACE_1("Logic Object",_logic);
_control ctrlRemoveAllEventHandlers "SetFocus";

// Validate module target
private _unit = effectiveCommander (attachedTo _logic);
private _unit = effectiveCommander attachedTo _logic;

scopeName "Main";
private _fnc_errorAndClose = {
Expand All @@ -51,18 +49,10 @@ if !(isNull _unit) then {
};

// Specific onLoad stuff
private _combo = _display displayCtrl 92856;

// Add target combo options (only add selected group option if placed on unit)
{
_x params ["_text", "_icon"];
_combo lbSetPicture [_combo lbAdd (localize _text), _icon];
} forEach (COMBO_ITEMS select [[0, 1] select (isNull _unit), 5]);

_combo lbSetCurSel 0;

// Set default NVG status
if !(isNull _unit) then {
// Remove selected group option in not placed on unit and set default NVG status
if (isNull _unit) then {
(_display displayCtrl 92856) lbDelete 0;
} else {
(_display displayCtrl 92855) lbSetCurSel ([0, 1] select !(hmd _unit isEqualTo ""));
};

Expand Down
6 changes: 3 additions & 3 deletions addons/zeus/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "\z\ace\addons\main\script_macros.hpp"

// UI grid
#define SIZEX ((safezoneW / safezoneH) min 1.2)
#define SIZEX ((safeZoneW / safeZoneH) min 1.2)
#define SIZEY (SIZEX / 1.2)
#define W_PART(num) (num * (SIZEX / 40))
#define H_PART(num) (num * (SIZEY / 25))
#define X_PART(num) (W_PART(num) + (safezoneX + (safezoneW - SIZEX)/2))
#define Y_PART(num) (H_PART(num) + (safezoneY + (safezoneH - SIZEY)/2))
#define X_PART(num) (W_PART(num) + (safeZoneX + (safeZoneW - SIZEX) / 2))
#define Y_PART(num) (H_PART(num) + (safeZoneY + (safeZoneH - SIZEY) / 2))
67 changes: 17 additions & 50 deletions addons/zeus/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@
<Chinesesimp>确认变更给所有编辑者</Chinesesimp>
<Chinese>確認變更給所有編輯者</Chinese>
</Key>
<Key ID="STR_ACE_Zeus_ModuleEditableObjects_AdditionalObjects">
<English>Additional Objects</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleEditableObjects_AdditionalObjects_Tooltip">
<English>Additional objects to include in the action regardless of Task Radius</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleGlobalSetSkill_DisplayName">
<English>Global AI Skill</English>
<French>Compétence global de l'IA</French>
Expand Down Expand Up @@ -924,6 +930,15 @@
<Chinese>需要一個不存在的插件</Chinese>
<Korean>현재 없는 애드온을 필요로 합니다</Korean>
</Key>
<Key ID="STR_ACE_Zeus_None">
<English>None</English>
</Key>
<Key ID="STR_ACE_Zeus_Players">
<English>Players</English>
</Key>
<Key ID="STR_ACE_Zeus_PlayersAndAI">
<English>Players and AI</English>
</Key>
<Key ID="STR_ACE_Zeus_AddObjectsToCurator">
<English>Add Objects to Curator</English>
<Polish>Dodaj obiekt do kuratora</Polish>
Expand Down Expand Up @@ -1137,7 +1152,7 @@
<Korean>장비 추가</Korean>
</Key>
<Key ID="STR_ACE_Zeus_ModuleGarrison_DisplayName">
<English>Garrison group</English>
<English>Garrison Group</English>
<French>Garnir zone</French>
<Japanese>歩哨グループ</Japanese>
<Italian>Proteggi gruppo</Italian>
Expand Down Expand Up @@ -1209,7 +1224,7 @@
<Korean>순간이동</Korean>
</Key>
<Key ID="STR_ACE_Zeus_ModuleUnGarrison_DisplayName">
<English>Un-garrison group</English>
<English>Un-garrison Group</English>
<French>Dégarnir zone</French>
<Japanese>非歩哨グループ</Japanese>
<Italian>Non proteggere gruppo</Italian>
Expand Down Expand Up @@ -1409,54 +1424,6 @@
<Russian>Устройство будет активно пытаться найти и перейти к соседним единицам активации. Диапазон автоматического поиска основан на умении снимать расстояние на расстоянии не менее 100 метров.</Russian>
<Spanish>La unidad intentará buscar activamente y moverse hacia las unidades cercanas del lado de activación. El rango de Auto Seek se basa en la habilidad de distancia al punto de la unidad con un mínimo de 100 metros.</Spanish>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSuicideBomber_Small">
<English>Small</English>
<Chinese>小</Chinese>
<Chinesesimp>小</Chinesesimp>
<Czech>Malý</Czech>
<French>Petit</French>
<German>Klein</German>
<Hungarian>Kicsi</Hungarian>
<Italian>Piccolo</Italian>
<Japanese>小</Japanese>
<Korean>작은</Korean>
<Polish>Mały</Polish>
<Portuguese>Pequeno</Portuguese>
<Russian>Маленький</Russian>
<Spanish>Pequeña</Spanish>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSuicideBomber_Medium">
<English>Medium</English>
<Chinese>中</Chinese>
<Chinesesimp>中</Chinesesimp>
<Czech>Střední</Czech>
<French>Moyen</French>
<German>Mittel</German>
<Hungarian>Közepes</Hungarian>
<Italian>medio</Italian>
<Japanese>中</Japanese>
<Korean>매질</Korean>
<Polish>Średni</Polish>
<Portuguese>Médio</Portuguese>
<Russian>средний</Russian>
<Spanish>Medio</Spanish>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSuicideBomber_Large">
<English>Large</English>
<Chinese>大</Chinese>
<Chinesesimp>大</Chinesesimp>
<Czech>Velký</Czech>
<French>Grand</French>
<German>Groß</German>
<Hungarian>Nagy</Hungarian>
<Italian>Grande</Italian>
<Japanese>大</Japanese>
<Korean>큰</Korean>
<Polish>Duży</Polish>
<Portuguese>ampla</Portuguese>
<Russian>большой</Russian>
<Spanish>Grande</Spanish>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSuicideBomber_AlreadyBomber">
<English>Unit is already a suicide bomber</English>
<Chinese>這個單位已經是自殺炸彈手了</Chinese>
Expand Down
Loading

0 comments on commit d6976f6

Please sign in to comment.