From ecc8019dc2218760c1240106cc847a090ba45162 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 17 Mar 2023 20:18:02 -0400 Subject: [PATCH 1/4] switch to launcher --- addons/common/XEH_postInit.sqf | 6 ++++++ addons/context_actions/CfgContext.hpp | 9 +++++++-- addons/context_actions/functions/fnc_switchWeapon.sqf | 2 +- .../functions/fnc_switchWeaponModifier.sqf | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index dd77cdc26..6270506de 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -176,6 +176,12 @@ [QGVAR(selectWeapon), { params ["_unit", "_muzzle"]; _unit selectWeapon _muzzle; + if (_muzzle == secondaryWeapon _unit) then { + _unit playMove "amovpercmstpsraswlnrdnon"; + _unit disableAI "ANIM"; + } else { + _unit enableAI "ANIM"; + }; }] call CBA_fnc_addEventHandler; [QGVAR(selectWeaponTurret), { diff --git a/addons/context_actions/CfgContext.hpp b/addons/context_actions/CfgContext.hpp index 892ab9aba..ccd293eb6 100644 --- a/addons/context_actions/CfgContext.hpp +++ b/addons/context_actions/CfgContext.hpp @@ -261,15 +261,20 @@ class EGVAR(context_menu,actions) { icon = "\a3\ui_f\data\GUI\Rsc\RscDisplayArsenal\primaryWeapon_ca.paa"; args = 0; }; + class Launcher: Primary { + displayName = "$STR_A3_RSCDisplayArsenal_Tab_SecondaryWeapon"; + icon = "\a3\ui_f\data\GUI\Rsc\RscDisplayArsenal\secondaryWeapon_ca.paa"; + args = 1; + }; class Handgun: Primary { displayName = "$STR_A3_RSCDisplayArsenal_Tab_Handgun"; icon = "\a3\ui_f\data\GUI\Rsc\RscDisplayArsenal\handgun_ca.paa"; - args = 1; + args = 2; }; class Binoculars: Primary { displayName = "$STR_A3_RSCDisplayArsenal_Tab_Binoculars"; icon = "\a3\ui_f\data\GUI\Rsc\RscDisplayArsenal\binoculars_ca.paa"; - args = 2; + args = 3; }; }; }; diff --git a/addons/context_actions/functions/fnc_switchWeapon.sqf b/addons/context_actions/functions/fnc_switchWeapon.sqf index 1071852ff..f478f3203 100644 --- a/addons/context_actions/functions/fnc_switchWeapon.sqf +++ b/addons/context_actions/functions/fnc_switchWeapon.sqf @@ -18,5 +18,5 @@ params ["_unit", "_weaponIndex"]; -private _weapon = [primaryWeapon _unit, handgunWeapon _unit, binocular _unit] select _weaponIndex; +private _weapon = [primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] select _weaponIndex; [QEGVAR(common,selectWeapon), [_unit, _weapon], _unit] call CBA_fnc_targetEvent; diff --git a/addons/context_actions/functions/fnc_switchWeaponModifier.sqf b/addons/context_actions/functions/fnc_switchWeaponModifier.sqf index fc34d8233..2411e94a2 100644 --- a/addons/context_actions/functions/fnc_switchWeaponModifier.sqf +++ b/addons/context_actions/functions/fnc_switchWeaponModifier.sqf @@ -22,6 +22,7 @@ _actionParams params ["", "", "", "", "", "_hoveredEntity"]; private _weapon = [ primaryWeapon _hoveredEntity, + secondaryWeapon _hoveredEntity, handgunWeapon _hoveredEntity, binocular _hoveredEntity ] select _args; From aad023734a71692738e7bc112b75523ba746dbb2 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Thu, 12 Oct 2023 14:16:05 -0400 Subject: [PATCH 2/4] separate event --- addons/common/XEH_postInit.sqf | 5 +++++ addons/context_actions/functions/fnc_switchWeapon.sqf | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 745ee4e4e..ce097e3e2 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -197,6 +197,11 @@ [QGVAR(selectWeapon), { params ["_unit", "_muzzle"]; _unit selectWeapon _muzzle; +}] call CBA_fnc_addEventHandler; + +[QGVAR(switchWeapon), { + params ["_unit", "_muzzle"]; + _unit selectWeapon _muzzle; if (_muzzle == secondaryWeapon _unit) then { _unit playMove "amovpercmstpsraswlnrdnon"; _unit disableAI "ANIM"; diff --git a/addons/context_actions/functions/fnc_switchWeapon.sqf b/addons/context_actions/functions/fnc_switchWeapon.sqf index f478f3203..b290e048e 100644 --- a/addons/context_actions/functions/fnc_switchWeapon.sqf +++ b/addons/context_actions/functions/fnc_switchWeapon.sqf @@ -19,4 +19,5 @@ params ["_unit", "_weaponIndex"]; private _weapon = [primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] select _weaponIndex; -[QEGVAR(common,selectWeapon), [_unit, _weapon], _unit] call CBA_fnc_targetEvent; + +[QEGVAR(common,switchWeapon), [_unit, _weapon], _unit] call CBA_fnc_targetEvent; From 676ced648b1c3fea0f10ce7a210cd241d13d6679 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Thu, 12 Oct 2023 14:49:54 -0400 Subject: [PATCH 3/4] allow launcher units to be turned by Watch cursor --- addons/common/XEH_postInit.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ce097e3e2..74a0da4d9 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -141,6 +141,11 @@ [QGVAR(doWatch), { params ["_unit", "_target"]; _unit doWatch _target; + { + if (!(_x checkAIFeature "ANIM")) then { + _x setDir (_x getDir _target); + }; + } forEach flatten [_unit]; }] call CBA_fnc_addEventHandler; [QGVAR(doTarget), { From 9f7d2da79c011a52f63e95244d71e46157885484 Mon Sep 17 00:00:00 2001 From: Ampersand Date: Thu, 12 Oct 2023 15:15:31 -0400 Subject: [PATCH 4/4] Update addons/common/XEH_postInit.sqf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jouni Järvinen --- addons/common/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 74a0da4d9..a06f9d6ff 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -142,7 +142,7 @@ params ["_unit", "_target"]; _unit doWatch _target; { - if (!(_x checkAIFeature "ANIM")) then { + if !(_x checkAIFeature "ANIM") then { _x setDir (_x getDir _target); }; } forEach flatten [_unit];