ZEN icon indicating copy to clipboard operation
ZEN copied to clipboard

Add Switch Weapon context menu actions for infantry

Open ampersand38 opened this issue 5 years ago • 10 comments

When merged this pull request will:

  • TItle
  • https://youtu.be/ZWfUBp532AA
  • https://youtu.be/5hq_pCK9_UM

ampersand38 avatar Jan 20 '21 04:01 ampersand38

Any technical reason for not including launchers or holstered?

BrettMayson avatar Jan 20 '21 05:01 BrettMayson

I've tried these to no avail.

_unit selectWeapon secondaryWeapon _unit;
_unit action ["SwitchWeapon", _unit, _unit, -1];

ampersand38 avatar Jan 20 '21 05:01 ampersand38

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

CreepPork avatar Jan 22 '21 14:01 CreepPork

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!

ampersand38 avatar Jan 22 '21 16:01 ampersand38

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

As I understand, having custom actions like that would require compiling the actions before calling zen_context_menu_fnc_open, which means either:

  1. do that before calling open in the keybind and right click, or
  2. 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 equipped I'm still unsure how to make AI keep their launcher out.

ampersand38 avatar Jan 24 '21 09:01 ampersand38

You can use insertChildren code to dynamically add children or the modifierFunction to change action properties when the menu is opened.

mharis001 avatar Jan 24 '21 14:01 mharis001

https://youtu.be/5hq_pCK9_UM

ampersand38 avatar Jan 26 '21 06:01 ampersand38

@CreepPork Is this commit what you were talking about in this comment?

ampersand38 avatar Feb 26 '21 19:02 ampersand38

@CreepPork Is this commit what you were talking about in this comment?

Yes, that was it.

CreepPork avatar Feb 26 '21 20:02 CreepPork

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.

ampersand38 avatar Mar 04 '21 15:03 ampersand38