Kestral WIP

This commit is contained in:
PabstMirror 2015-05-10 16:54:24 -05:00
parent 05f1b884fa
commit 57d6ad988b
2 changed files with 20 additions and 16 deletions

View File

@ -6,7 +6,7 @@
* 0: Offset from currentIndex (use 1 to find next valid) <NUMBER><OPTIONAL>
*
* Return Value:
* Nothing
* The new index (-1 if no valid) <NUMBER>
*
* Example:
* [] call ace_common_fnc_deviceKeyFindValidIndex
@ -18,10 +18,15 @@
DEFAULT_PARAM(0,_offsetBy,0);
_validIndex = -1;
for "_offset" from _offsetBy to ((count GVAR(deviceKeyHandlingArray)) - 1 + _offsetBy) do {
if ((count GVAR(deviceKeyHandlingArray)) > 0) then {
if (GVAR(deviceKeyCurrentIndex) == -1) then {GVAR(deviceKeyCurrentIndex) = 0;};
for "_offset" from _offsetBy to ((count GVAR(deviceKeyHandlingArray)) - 1 + _offsetBy) do {
_realIndex = (GVAR(deviceKeyCurrentIndex) + _offset) % (count GVAR(deviceKeyHandlingArray));
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith {
_validIndex = _realIndex;
};
};
};
GVAR(deviceKeyCurrentIndex) = _validIndex;
_validIndex

View File

@ -1,5 +1,9 @@
["ACE3 Equipment", QGVAR(KestrelDialogKey), localize "STR_ACE_Kestrel4500_KestrelDialogKey",
{
//Add deviceKey entry:
private ["_conditonCode", "_toggleCode", "_closeCode"];
_conditonCode = {
[] call FUNC(canShow);
};
_toggleCode = {
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if(GVAR(Kestrel4500)) exitWith { false };
@ -7,18 +11,13 @@
// Statement
[] call FUNC(createKestrelDialog);
false
},
{false},
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
["ACE3 Equipment", QGVAR(DisplayKestrelKey), localize "STR_ACE_Kestrel4500_DisplayKestrelKey",
{
};
_closeCode = {
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement
[] call FUNC(displayKestrel);
false
},
{false},
[0, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
};
[(localize "STR_ACE_Kestrel_Name"), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);