Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add launcher support to infantry Switch Weapon actions #717

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Comment on lines +210 to +215
Copy link
Member

@mharis001 mharis001 Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a decent workaround. However, IMO would be better placed in the switchWeapon function itself (since it is specifically used for that).

Copy link
Member Author

@ampersand38 ampersand38 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switchWeapon function is local to the curator, and these need to be local to the AI. should I make a separate switchWeapon[Curator/Local] event?

}] call CBA_fnc_addEventHandler;

[QGVAR(selectWeaponTurret), {
Expand Down
9 changes: 7 additions & 2 deletions addons/context_actions/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion addons/context_actions/functions/fnc_switchWeapon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ _actionParams params ["", "", "", "", "", "_hoveredEntity"];

private _weapon = [
primaryWeapon _hoveredEntity,
secondaryWeapon _hoveredEntity,
handgunWeapon _hoveredEntity,
binocular _hoveredEntity
] select _args;
Expand Down