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> * 0: Offset from currentIndex (use 1 to find next valid) <NUMBER><OPTIONAL>
* *
* Return Value: * Return Value:
* Nothing * The new index (-1 if no valid) <NUMBER>
* *
* Example: * Example:
* [] call ace_common_fnc_deviceKeyFindValidIndex * [] call ace_common_fnc_deviceKeyFindValidIndex
@ -18,10 +18,15 @@
DEFAULT_PARAM(0,_offsetBy,0); DEFAULT_PARAM(0,_offsetBy,0);
_validIndex = -1; _validIndex = -1;
for "_offset" from _offsetBy to ((count GVAR(deviceKeyHandlingArray)) - 1 + _offsetBy) do { if ((count GVAR(deviceKeyHandlingArray)) > 0) then {
_realIndex = (GVAR(deviceKeyCurrentIndex) + _offset) % (count GVAR(deviceKeyHandlingArray)); if (GVAR(deviceKeyCurrentIndex) == -1) then {GVAR(deviceKeyCurrentIndex) = 0;};
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith { for "_offset" from _offsetBy to ((count GVAR(deviceKeyHandlingArray)) - 1 + _offsetBy) do {
_validIndex = _realIndex; _realIndex = (GVAR(deviceKeyCurrentIndex) + _offset) % (count GVAR(deviceKeyHandlingArray));
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith {
_validIndex = _realIndex;
};
}; };
}; };
GVAR(deviceKeyCurrentIndex) = _validIndex; 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 // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if(GVAR(Kestrel4500)) exitWith { false }; if(GVAR(Kestrel4500)) exitWith { false };
@ -7,18 +11,13 @@
// Statement // Statement
[] call FUNC(createKestrelDialog); [] call FUNC(createKestrelDialog);
false false
}, };
{false}, _closeCode = {
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
["ACE3 Equipment", QGVAR(DisplayKestrelKey), localize "STR_ACE_Kestrel4500_DisplayKestrelKey",
{
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement // Statement
[] call FUNC(displayKestrel); [] call FUNC(displayKestrel);
false false
}, };
{false}, [(localize "STR_ACE_Kestrel_Name"), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
[0, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)