mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Condense mDagr interactions - intergrate kestral
This commit is contained in:
parent
57d6ad988b
commit
ffce1f6386
@ -3,30 +3,43 @@
|
||||
* Finds next valid index for the device array.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Offset from currentIndex (use 1 to find next valid) <NUMBER><OPTIONAL>
|
||||
* 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,_offsetBy,0);
|
||||
DEFAULT_PARAM(0,_searchOffsetOrName,0);
|
||||
|
||||
private ["_validIndex", "_offsetBy", "_realIndex", "_offset"];
|
||||
|
||||
_validIndex = -1;
|
||||
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;
|
||||
|
||||
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;
|
||||
_validIndex
|
||||
|
||||
GVAR(deviceKeyCurrentIndex)
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditonCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew
|
||||
* [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditionCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -6,18 +6,31 @@ _conditonCode = {
|
||||
_toggleCode = {
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
if(GVAR(Kestrel4500)) exitWith { false };
|
||||
|
||||
// Statement
|
||||
[] call FUNC(createKestrelDialog);
|
||||
false
|
||||
if (!GVAR(Overlay)) then {
|
||||
//If no overlay, show it:
|
||||
[] call FUNC(displayKestrel);
|
||||
} else {
|
||||
//If overlay is up, switch to dialog:
|
||||
[] call FUNC(createKestrelDialog);
|
||||
};
|
||||
};
|
||||
_closeCode = {
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
|
||||
// Statement
|
||||
[] call FUNC(displayKestrel);
|
||||
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;
|
||||
};
|
||||
false
|
||||
};
|
||||
[(localize "STR_ACE_Kestrel_Name"), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
|
||||
|
||||
[(localize "STR_ACE_Kestrel_Name"), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
|
||||
|
@ -3,34 +3,36 @@ class CfgVehicles {
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(show) {
|
||||
//Opens the mini map
|
||||
displayName = "$STR_ACE_microdagr_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
|
||||
//Opens the interactive dialog
|
||||
displayName = "$STR_ACE_microdagr_configure";
|
||||
condition = QUOTE(([DISPLAY_MODE_DIALOG] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DIALOG});
|
||||
condition = QUOTE([DISPLAY_MODE_DIALOG] call FUNC(canShow));
|
||||
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 = "$STR_ACE_microdagr_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"};
|
||||
|
||||
//Sub Actions:
|
||||
class GVAR(show) {
|
||||
//Opens the background display (minimap)
|
||||
displayName = "$STR_ACE_microdagr_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(close) {
|
||||
displayName = "$STR_ACE_microdagr_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"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -66,7 +68,7 @@ class CfgVehicles {
|
||||
description = "Controls how much data is filled on the microDAGR items. Less data restricts the map view to show less on the minimap.<br/>Source: microDAGR.pbo";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
|
Loading…
Reference in New Issue
Block a user