diff --git a/addons/interaction/functions/fnc_addPassengerActions.sqf b/addons/interaction/functions/fnc_addPassengerActions.sqf index 20de00e315..47a845601b 100644 --- a/addons/interaction/functions/fnc_addPassengerActions.sqf +++ b/addons/interaction/functions/fnc_addPassengerActions.sqf @@ -20,12 +20,10 @@ params ["", "", "_parameters"]; _parameters params ["_unit"]; -private ["_varName", "_actionTrees", "_actions"]; +private _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit]; +private _actionTrees = missionNamespace getVariable [_varName, []]; -_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit]; -_actionTrees = missionNamespace getVariable [_varName, []]; - -_actions = []; +private _actions = []; // Mount unit MainActions menu { diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 7296b34fa2..8ee95b7eb9 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -23,12 +23,10 @@ private "_actions"; _actions = []; { - private ["_unit", "_icon"]; - - _unit = _x; + private _unit = _x; if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then { - _icon = [ + private _icon = [ "", "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa", "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa", @@ -44,14 +42,27 @@ _actions = []; format ["%1", _unit], [_unit, true] call EFUNC(common,getName), _icon, - {}, + { + //statement (Run on hover) - reset the cache so we will insert actions immedietly when hovering over new unit + TRACE_2("Cleaning Cache",_target,vehicle _target); + [vehicle _target, QEGVAR(interact_menu,ATCache_ACE_SelfActions)] call EFUNC(common,eraseCache); + }, {true}, - {_this call FUNC(addPassengerActions)}, - [_unit] - ] call EFUNC(interact_menu,createAction), - [], - _unit - ]; + { + if (EGVAR(interact_menu,selectedTarget) isEqualTo _target) then { + _this call FUNC(addPassengerActions) + } else { + [] //not selected, don't waste time on actions + }; + }, + [_unit], + {[0, 0, 0]}, + 2, + [false,false,false,true,false] //add run on hover (4th bit true) + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; }; false } count crew _vehicle;