From 05f1b884fac792df117947ab6fce4c238d5099e9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 10 May 2015 15:17:50 -0500 Subject: [PATCH] Localization/ headers --- addons/common/XEH_postInit.sqf | 8 ++--- .../functions/fnc_deviceKeyFindValidIndex.sqf | 16 ++++++++- .../functions/fnc_deviceKeyRegisterNew.sqf | 21 ++++++++++- addons/common/stringtable.xml | 11 +++++- addons/microdagr/XEH_clientInit.sqf | 36 +++---------------- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index d19958bd57..ade35855ea 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -254,7 +254,7 @@ if(isMultiplayer && { time > 0 || isNull player } ) then { GVAR(deviceKeyHandlingArray) = []; GVAR(deviceKeyCurrentIndex) = -1; -["ACE3 Equipment", QGVAR(openDevice), "Open Device", //(localize "STR_ACE_microdagr_toggleUnit"), +["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), { [] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; @@ -264,7 +264,7 @@ GVAR(deviceKeyCurrentIndex) = -1; {false}, [0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key -["ACE3 Equipment", QGVAR(closeDevice), "Close Device", //(localize "STR_ACE_microdagr_toggleUnit"), +["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), { [] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; @@ -273,14 +273,12 @@ GVAR(deviceKeyCurrentIndex) = -1; {false}, [0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key -["ACE3 Equipment", QGVAR(cycleDevice), "Cycle Devices", //(localize "STR_ACE_microdagr_toggleUnit"), +["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), { - systemChat "here"; [1] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0); _iconImage = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 1); - systemChat str [_displayName, _iconImage]; [_displayName, _iconImage] call FUNC(displayTextPicture); }, {false}, diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index 19069b1821..431761bae1 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -1,4 +1,18 @@ - +/* + * Author: PabstMirror + * Finds next valid index for the device array. + * + * Arguments: + * 0: Offset from currentIndex (use 1 to find next valid) + * + * Return Value: + * Nothing + * + * Example: + * [] call ace_common_fnc_deviceKeyFindValidIndex + * + * Public: No + */ #include "script_component.hpp" DEFAULT_PARAM(0,_offsetBy,0); diff --git a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf index 0b8ab0761c..6a15c3c340 100644 --- a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf +++ b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf @@ -1,5 +1,24 @@ - +/* + * Author: PabstMirror + * Finds next valid index for the device array. + * + * Arguments: + * 0: Localized Device Display Name + * 1: Image + * 2: Condtion Code (do they have the device) + * 3: Toggle Code (on home press) + * 4: Close Code (on ctrl-home press) + * + * Return Value: + * Nothing + * + * Example: + * [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditonCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew + * + * Public: No + */ #include "script_component.hpp" + PARAMS_5(_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode); GVAR(deviceKeyHandlingArray) pushBack [_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode]; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 8d28704362..3b1e5dbc76 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -470,5 +470,14 @@ Une banane est un fruit qui, d'un point de vue botanique, fait partie du groupe des baies. Produite par plusieurs sortes de grandes plantes à fleurs herbacées du type Musa. A banana é uma fruta comestível, botanicamente uma baga, produzida por vários tipos de plantas herbáceas grandes do genero Musa. + + Toggle Device + + + Close Device + + + Cycle Devices + - + \ No newline at end of file diff --git a/addons/microdagr/XEH_clientInit.sqf b/addons/microdagr/XEH_clientInit.sqf index 339e0bf112..0569256df3 100644 --- a/addons/microdagr/XEH_clientInit.sqf +++ b/addons/microdagr/XEH_clientInit.sqf @@ -3,8 +3,10 @@ if (!hasInterface) exitWith {}; +//Add deviceKey entry: +private ["_conditonCode", "_toggleCode", "_closeCode"]; _conditonCode = { -("ACE_microDAGR" in (items ace_player)) + ("ACE_microDAGR" in (items ace_player)) }; _toggleCode = { if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -16,37 +18,7 @@ _closeCode = { [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); true }; - -["Mdagr", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); - - -/* //Add Keybinds: -["ACE3 Equipment", QGVAR(openGPS), (localize "STR_ACE_microdagr_toggleUnit"), -{ - // canInteractWith (can use on map) - if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // Conditions: specific - if (!("ACE_microDAGR" in (items ace_player))) exitWith {false}; - - [] call FUNC(openDisplay); //toggle display mode - true; -}, -{false}, -[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key - -["ACE3 Equipment", QGVAR(closeGPS), (localize "STR_ACE_microdagr_closeUnit"), -{ - // canInteractWith (can use on map) - if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // Conditions: specific - if (!("ACE_microDAGR" in (items ace_player))) exitWith {false}; - if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {false}; - - [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); //close unit - true; -}, -{false}, -[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key */ +[(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); //Add Eventhandler: ["RangerfinderData", {_this call FUNC(recieveRangefinderData)}] call EFUNC(common,addEventHandler);