mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix #211
This commit is contained in:
parent
4fe09034ff
commit
4a8b5079a6
@ -9,6 +9,7 @@ PREP(compileMenuSelfAction);
|
||||
PREP(collectActiveActionTree);
|
||||
PREP(createAction);
|
||||
PREP(findActionNode);
|
||||
PREP(isSubPath);
|
||||
PREP(keyDown);
|
||||
PREP(keyDownSelfAction);
|
||||
PREP(keyUp);
|
||||
|
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Check if the first path is a subpath of the other
|
||||
*
|
||||
* Argument:
|
||||
* 0: LongPath <ARRAY>
|
||||
* 1: ShortPath <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Bool
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_longPath,_shortPath);
|
||||
|
||||
private ["_isSubPath","_i"];
|
||||
_isSubPath = true;
|
||||
|
||||
if (count _shortPath > count _longPath) exitWith {false};
|
||||
|
||||
for [{_i = 0},{_i < (count _shortPath) - 1},{_i = _i + 1}] do {
|
||||
if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith {
|
||||
_isSubPath = false;
|
||||
};
|
||||
};
|
||||
|
||||
_isSubPath
|
@ -159,14 +159,18 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
} forEach GVAR(lastPath);
|
||||
};
|
||||
|
||||
if(_misMatch) then {
|
||||
GVAR(lastPath) = _hoverPath;
|
||||
if(_misMatch && {diag_tickTime-GVAR(expandedTime) > 0.25}) then {
|
||||
GVAR(startHoverTime) = diag_tickTime;
|
||||
GVAR(lastPath) = _hoverPath;
|
||||
GVAR(expanded) = false;
|
||||
} else {
|
||||
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
|
||||
GVAR(expanded) = true;
|
||||
GVAR(expandedTime) = diag_tickTime;
|
||||
|
||||
// Start the expanding menu animation only if the user is not going up the menu
|
||||
if !([GVAR(menuDepthPath),GVAR(lastPath)] call FUNC(isSubPath)) then {
|
||||
GVAR(expandedTime) = diag_tickTime;
|
||||
};
|
||||
GVAR(menuDepthPath) = +GVAR(lastPath);
|
||||
|
||||
// Execute the current action if it's run on hover
|
||||
|
@ -15,9 +15,13 @@
|
||||
|
||||
private ["_parentPath","_actionName"];
|
||||
_parentPath = [];
|
||||
for "_i" from 0 to (count _this) - 1 do {
|
||||
for [{_i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do {
|
||||
_parentPath pushBack (_this select _i);
|
||||
};
|
||||
_actionName = _this select ((count _this) - 1);
|
||||
_actionName = if (count _this > 0) then {
|
||||
_this select ((count _this) - 1);
|
||||
} else {
|
||||
""
|
||||
};
|
||||
|
||||
[_parentPath, _actionName]
|
||||
|
Loading…
Reference in New Issue
Block a user