Add Switch Weapon context menu actions for infantry
When merged this pull request will:
- TItle
- https://youtu.be/ZWfUBp532AA
- https://youtu.be/5hq_pCK9_UM
Any technical reason for not including launchers or holstered?
I've tried these to no avail.
_unit selectWeapon secondaryWeapon _unit;
_unit action ["SwitchWeapon", _unit, _unit, -1];
I think it would be nicer and offer more if it was ordered like this:
Loadout > Weapon > Pick a weapon that the unit selects
Listing it as this (with the weapon icon too (if the weapon doesn't have an icon, then the standard icons from ZEN)): Loadout > Weapon >
- MX 6.5mm (Selected)
- P07
-
Launcher name if equipped
Having an extra sub menu definitely makes logical sense. However, I put it directly under Loadout since there are currently only 3 items there, now totaling up to 6, which did not seem to clutter it up enough to be worth the slight usage delay of an extra menu navigation.
I'll certainly implement the submenu and test it out!
I think it would be nicer and offer more if it was ordered like this: Loadout > Weapon >
Pick a weapon that the unit selectsListing it as this (with the weapon icon too (if the weapon doesn't have an icon, then the standard icons from ZEN)): Loadout > Weapon >
- MX 6.5mm (Selected)
- P07
As I understand, having custom actions like that would require compiling the actions before calling zen_context_menu_fnc_open, which means either:
- do that before calling open in the keybind and right click, or
- close and re-open the menu to the same place
I'm not sure if we're setup to do either of those things.
Launcher name if equippedI'm still unsure how to make AI keep their launcher out.
You can use insertChildren code to dynamically add children or the modifierFunction to change action properties when the menu is opened.
https://youtu.be/5hq_pCK9_UM
I don't quite understand the organization of your PRs (this and #537). What is this PR for? Or is it duplicated?
This one is Unit > Loadout > Switch Weapon #537 is Vehicle > Vehicle Logistics > Switch Weapon
Unit weapons are a lot more limited and I felt that they belong under different context actions.