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 Switch Weapon context menu actions for infantry #520

Merged
merged 13 commits into from Jan 11, 2023

Conversation

ampersand38
Copy link
Member

@ampersand38 ampersand38 commented Jan 20, 2021

When merged this pull request will:

@BrettMayson
Copy link
Contributor

Any technical reason for not including launchers or holstered?

@ampersand38
Copy link
Member Author

I've tried these to no avail.

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

@neilzar neilzar added the feature Adds a new feature label Jan 21, 2021
@CreepPork
Copy link
Member

CreepPork commented Jan 22, 2021

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

@ampersand38
Copy link
Member Author

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
Copy link
Member Author

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.

@mharis001
Copy link
Member

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

@ampersand38 ampersand38 changed the title Add weapon selection actions under Loadout Add Switch Weapon context menu actions for infantry Jan 26, 2021
@ampersand38
Copy link
Member Author

@mharis001 mharis001 added this to the 1.11.0 milestone Jan 31, 2021
ampersand38 added a commit to ampersand38/ZEN that referenced this pull request Feb 26, 2021
@ampersand38
Copy link
Member Author

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

@CreepPork
Copy link
Member

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

Yes, that was it.

Copy link
Member

@CreepPork CreepPork left a comment

Choose a reason for hiding this comment

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

I don't quite understand the organization of your PRs (this and #537). What is this PR for? Or is it duplicated?

ampersand38 added a commit to ampersand38/ZEN that referenced this pull request Mar 4, 2021
@ampersand38
Copy link
Member Author

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.

@mharis001 mharis001 modified the milestones: 1.11.0, 1.12.0 Jun 14, 2021
@mharis001 mharis001 modified the milestones: 1.12.0, 1.13.0 Sep 3, 2021
@mharis001 mharis001 modified the milestones: 1.13.0, Backlog Apr 28, 2022
addons/context_actions/CfgContext.hpp Outdated Show resolved Hide resolved
addons/context_actions/functions/fnc_canSwitchWeapon.sqf Outdated Show resolved Hide resolved
addons/context_actions/CfgContext.hpp Outdated Show resolved Hide resolved
@mharis001 mharis001 dismissed CreepPork’s stale review January 11, 2023 11:12

Changes addressed.

@mharis001 mharis001 modified the milestones: Backlog, 1.13.0 Jan 11, 2023
@ampersand38 ampersand38 merged commit 8435e93 into zen-mod:master Jan 11, 2023
@ampersand38 ampersand38 deleted the infantry-select-weapon branch January 11, 2023 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants