mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
commit
b2d69611d7
@ -11,4 +11,26 @@
|
||||
false
|
||||
},
|
||||
{false},
|
||||
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
|
||||
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
|
||||
|
||||
|
||||
//Add deviceKey entry:
|
||||
private ["_conditonCode", "_toggleCode", "_closeCode"];
|
||||
_conditonCode = {
|
||||
[] call FUNC(can_show);
|
||||
};
|
||||
_toggleCode = {
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {};
|
||||
if (GVAR(active)) exitWith {
|
||||
closeDialog 0;
|
||||
};
|
||||
// Statement
|
||||
[] call FUNC(create_dialog);
|
||||
};
|
||||
_closeCode = {
|
||||
if (GVAR(active)) exitWith {
|
||||
closeDialog 0;
|
||||
};
|
||||
};
|
||||
[(localize LSTRING(Name)), QUOTE(PATHTOF(UI\ATRAG_Icon.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
|
||||
|
@ -314,4 +314,41 @@ if(isMultiplayer && { ACE_time > 0 || isNull player } ) then {
|
||||
] call FUNC(checkPBOs)
|
||||
}] call FUNC(addEventHandler);
|
||||
|
||||
//Device Handler:
|
||||
GVAR(deviceKeyHandlingArray) = [];
|
||||
GVAR(deviceKeyCurrentIndex) = -1;
|
||||
|
||||
["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"),
|
||||
{
|
||||
[] call FUNC(deviceKeyFindValidIndex);
|
||||
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
|
||||
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key
|
||||
|
||||
["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"),
|
||||
{
|
||||
[] call FUNC(deviceKeyFindValidIndex);
|
||||
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
|
||||
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key
|
||||
|
||||
["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"),
|
||||
{
|
||||
[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);
|
||||
[_displayName, _iconImage] call FUNC(displayTextPicture);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key
|
||||
|
||||
|
||||
GVAR(commonPostInited) = true;
|
||||
|
@ -35,6 +35,8 @@ PREP(currentChannel);
|
||||
PREP(debug);
|
||||
PREP(debugModule);
|
||||
PREP(defineVariable);
|
||||
PREP(deviceKeyFindValidIndex);
|
||||
PREP(deviceKeyRegisterNew);
|
||||
PREP(disableAI);
|
||||
PREP(disableUserInput);
|
||||
PREP(displayIcon);
|
||||
|
45
addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
Normal file
45
addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Finds next valid index for the device array.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Offset from currentIndex (use 1 to find next valid after current) or a displayName string <STRING>or<NUMBER><OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* The new index (-1 if no valid) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_common_fnc_deviceKeyFindValidIndex
|
||||
* ["kestral4500"] call ace_common_fnc_deviceKeyFindValidIndex
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
DEFAULT_PARAM(0,_searchOffsetOrName,0);
|
||||
|
||||
private ["_validIndex", "_offsetBy", "_realIndex", "_offset"];
|
||||
|
||||
_validIndex = -1;
|
||||
|
||||
if ((typeName _searchOffsetOrName) == "STRING") then {
|
||||
{
|
||||
if ((_x select 0) == _searchOffsetOrName) exitWith {
|
||||
_validIndex = _forEachIndex;
|
||||
};
|
||||
} forEach GVAR(deviceKeyHandlingArray);
|
||||
} else {
|
||||
if ((count GVAR(deviceKeyHandlingArray)) > 0) then {
|
||||
_baseIndex = if (GVAR(deviceKeyCurrentIndex) == -1) then {0} else {GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName};
|
||||
for "_offset" from _baseIndex to ((count GVAR(deviceKeyHandlingArray)) - 1 + _baseIndex) do {
|
||||
_realIndex = _offset % (count GVAR(deviceKeyHandlingArray));
|
||||
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith {
|
||||
_validIndex = _realIndex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(deviceKeyCurrentIndex) = _validIndex;
|
||||
|
||||
GVAR(deviceKeyCurrentIndex)
|
25
addons/common/functions/fnc_deviceKeyRegisterNew.sqf
Normal file
25
addons/common/functions/fnc_deviceKeyRegisterNew.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Finds next valid index for the device array.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Localized Device Display Name <STRING>
|
||||
* 1: Image <STRING>
|
||||
* 2: Condtion Code (do they have the device) <CODE>
|
||||
* 3: Toggle Code (on home press) <CODE>
|
||||
* 4: Close Code (on ctrl-home press) <CODE>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditionCode, _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];
|
||||
[] call FUNC(deviceKeyFindValidIndex);
|
@ -561,5 +561,14 @@
|
||||
<German>Fügt einen LSD-Effekt zum synchronisierten Fahrzeug hinzu</German>
|
||||
<Czech>Přidá LSD efekt pro synchronizované vozidla</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Common_toggleHandheldDevice">
|
||||
<English>Toggle Handheld Device</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Common_closeHandheldDevice">
|
||||
<English>Close Handheld Device</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Common_cycleHandheldDevices">
|
||||
<English>Cycle Handheld Devices</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -11,24 +11,24 @@ class CfgVehicles {
|
||||
priority = 0.1;
|
||||
icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa));
|
||||
exceptions[] = {"notOnMap"};
|
||||
};
|
||||
class GVAR(show) {
|
||||
displayName = CSTRING(ShowKestrel);
|
||||
condition = QUOTE(call FUNC(canShow) && !GVAR(Overlay));
|
||||
statement = QUOTE(call FUNC(displayKestrel));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
class GVAR(hide) {
|
||||
displayName = CSTRING(HideKestrel);
|
||||
condition = QUOTE(GVAR(Overlay));
|
||||
statement = QUOTE(call FUNC(displayKestrel));
|
||||
showDisabled = 0;
|
||||
priority = 0.3;
|
||||
icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
class GVAR(show) {
|
||||
displayName = CSTRING(ShowKestrel);
|
||||
condition = QUOTE(call FUNC(canShow) && !GVAR(Overlay));
|
||||
statement = QUOTE(call FUNC(displayKestrel));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
class GVAR(hide) {
|
||||
displayName = CSTRING(HideKestrel);
|
||||
condition = QUOTE(GVAR(Overlay));
|
||||
statement = QUOTE(call FUNC(displayKestrel));
|
||||
showDisabled = 0;
|
||||
priority = 0.3;
|
||||
icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -24,3 +24,36 @@
|
||||
},
|
||||
{false},
|
||||
[0, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
|
||||
|
||||
|
||||
//Add deviceKey entry:
|
||||
private ["_conditonCode", "_toggleCode", "_closeCode"];
|
||||
_conditonCode = {
|
||||
[] call FUNC(canShow);
|
||||
};
|
||||
_toggleCode = {
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {};
|
||||
|
||||
// Statement
|
||||
if (!GVAR(Overlay)) then {
|
||||
//If no overlay, show it:
|
||||
[] call FUNC(displayKestrel);
|
||||
} else {
|
||||
//If overlay is up, switch to dialog:
|
||||
[] call FUNC(createKestrelDialog);
|
||||
};
|
||||
};
|
||||
_closeCode = {
|
||||
// Statement
|
||||
if (GVAR(Overlay)) then {
|
||||
//If dispaly is open, close it:
|
||||
GVAR(Overlay) = false;
|
||||
};
|
||||
if (dialog && {!isNull (uiNamespace getVariable ["Kestrel4500_Display", displayNull])}) then {
|
||||
//If dialog is open, close it:
|
||||
GVAR(Kestrel4500) = false;
|
||||
closeDialog 0;
|
||||
};
|
||||
};
|
||||
[(localize LSTRING(Name)), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
|
||||
|
@ -3,34 +3,28 @@ class CfgVehicles {
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(show) {
|
||||
//Opens the mini map
|
||||
displayName = CSTRING(show);
|
||||
condition = QUOTE(([DISPLAY_MODE_DISPLAY] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY});
|
||||
statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(openDisplay));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
class GVAR(configure) {
|
||||
//Opens the dialog
|
||||
displayName = CSTRING(configure);
|
||||
condition = QUOTE(([DISPLAY_MODE_DIALOG] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DIALOG});
|
||||
statement = QUOTE([DISPLAY_MODE_DIALOG] call FUNC(openDisplay));
|
||||
showDisabled = 0;
|
||||
priority = 0.1;
|
||||
icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
class GVAR(close) {
|
||||
displayName = CSTRING(closeUnit);
|
||||
condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED);
|
||||
statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(openDisplay));
|
||||
showDisabled = 0;
|
||||
priority = 0.3;
|
||||
icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
class GVAR(show) {
|
||||
//Opens the mini map
|
||||
displayName = CSTRING(show);
|
||||
condition = QUOTE(([DISPLAY_MODE_DISPLAY] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY});
|
||||
statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(openDisplay));
|
||||
icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
class GVAR(close) {
|
||||
displayName = CSTRING(closeUnit);
|
||||
condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED);
|
||||
statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(openDisplay));
|
||||
icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa));
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -3,33 +3,21 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
//Add Keybinds:
|
||||
["ACE3 Equipment", QGVAR(openGPS), (localize LSTRING(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};
|
||||
|
||||
//Add deviceKey entry:
|
||||
private ["_conditonCode", "_toggleCode", "_closeCode"];
|
||||
_conditonCode = {
|
||||
("ACE_microDAGR" in (items ACE_player))
|
||||
};
|
||||
_toggleCode = {
|
||||
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {};
|
||||
[] call FUNC(openDisplay); //toggle display mode
|
||||
true;
|
||||
},
|
||||
{false},
|
||||
[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key
|
||||
};
|
||||
_closeCode = {
|
||||
if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {};
|
||||
[DISPLAY_MODE_CLOSED] call FUNC(openDisplay);
|
||||
};
|
||||
[(localize LSTRING(itemName)), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
|
||||
|
||||
["ACE3 Equipment", QGVAR(closeGPS), (localize LSTRING(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
|
||||
|
||||
//Add Eventhandler:
|
||||
["RangerfinderData", {_this call FUNC(recieveRangefinderData)}] call EFUNC(common,addEventHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user