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 Ability to Edit a Weapon's Loaded Magazine(s) in the Limited Arsenal #433

Merged
merged 7 commits into from
Jan 21, 2025

Conversation

jwoodruff40
Copy link

@jwoodruff40 jwoodruff40 commented Jan 4, 2025

What type of PR is this?

  1. Bug
  2. Change
  3. Enhancement
  4. Miscellaneous

What have you changed and why?

Information:

Adds ability to edit weapons' loaded magazines (main magazine and underbarrel / alternate muzzle magazine, if applicable) within the arsenal, similar to ACE3 arsenal and POLPOX's Enhanced Arsenal.

Works for both the main player arsenal and the AI loadout arsenal.

Two primary benefits :

  • you don't have to load your weapons after exiting the arsenal
  • you can load a launcher AND put additional ammo in backpack (especially useful for AI LAT/AT/AA)

Does not use any ACE3 or Enhanced Arsenal code.

A3U_Arsenal_LoadedMag_Small
A3U_Arsenal_LoadedMag2_Small
A3U_Arsenal_LoadedMag3_Small

Please specify which Issue this PR Resolves (If Applicable).

"This PR closes #387!"

Please verify the following.

  1. Have you loaded the mission in LAN host?
  2. Have you loaded the mission on a dedicated server?

Is further testing or are further changes required?

  1. No
  2. Yes (Please provide further detail below.)

As with my last PR, needs some testing across all supported factions / weapons / modsets. None of the code should be mod-specific, but there may be edge cases either not considered or not implemented. Also see Notes:.

How can the changes be tested?

Steps:

Try out the new and improved arsenal?


Notes:

Editing the loaded magazine for secondary muzzles is currently hardcoded to only consider one non-primary muzzle. I'm not sure if any supported weapons have multiple additional muzzles, and if they do how this would be implemented without adding a bunch of additional tabs. Additionally, it's hardcoded to add / remove only one 'ammo' from the muzzle magazine (I was thinking of single shot grenade launchers as the primary / only use case). The only thing I can think of where this could be an issue is if there's a mod that add underbarrel shotguns or other multi-shot weapons, for which we'd need to add / remove an appropriate amount of ammo for those. Easy to do, just not sure if it's needed or not.

Lastly, @wersal454 was right. Arsenal code is a ****ing *****

Initial implementation only kinda works. Can't set empty mag; doesn't give ammo back to arsenal when selection changed; doesn't seem to work (for reason unknown) when weapon changed.
weapon, handgun.

Still has issues with adding ammo back to arsenal, removing loaded mag
@wersal454
Copy link

That's reeeeeeeeelly cool, I just hope it won't merge conflict with #396

@jwoodruff40
Copy link
Author

That's reeeeeeeeelly cool, I just hope it won't merge conflict with #396

From a quick look, that doesn't touch any of the same functions I did. Should merge just fine.

@jwoodruff40
Copy link
Author

Published (unlisted) to Steam workshop as an extender for easy testing: https://steamcommunity.com/sharedfiles/filedetails/?id=3400474022

@SilenceIsFatto SilenceIsFatto added the misc A miscellaneous change label Jan 6, 2025
@SilenceIsFatto
Copy link
Owner

Looks fine, is nice and simple to use from some quick testing with vanilla

I did get an error after selecting a secondary muzzle 40mm HE grenade for the AK-15 GL, though it still worked and selected a grenade

14:43:54 Error in expression <;					
private _min = jna_minItemMember select _index;
_min = A3A_arsenalLimits >
14:43:54   Error position: <select _index;
_min = A3A_arsenalLimits >
14:43:54   Error Zero divisor
14:43:54 File x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf..., line 146
14:43:54  ➥ Context: 	[] L1 ()
	[] L184 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L1044 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L184 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L1320 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L1321 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L184 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L1589 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)
	[] L151 (x\A3A\addons\jeroen_arsenal\JNA\fn_arsenal.sqf)

@jwoodruff40
Copy link
Author

jwoodruff40 commented Jan 7, 2025

I did get an error after selecting a secondary muzzle 40mm HE grenade for the AK-15 GL, though it still worked and selected a grenade

Fixed. Incidentally, this fix also makes the items you don't have unlimited quantity of yellow text like in the other item tabs, something I wasn't able to figure out before.

Copy link
Owner

@SilenceIsFatto SilenceIsFatto 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 think considering more muzzles is a necessity, even if you can add more the vanilla arsenal wouldn't be able to support it either.

LGTM

@SilenceIsFatto
Copy link
Owner

This hasn't been merged due to a conflict with (i'm assuming) #396

@jwoodruff40
Copy link
Author

Almost certainly 396. Should just be a couple spots where I fixed indentation. Will fix (rebase / merge unstable into this pr) when I get home.

@jwoodruff40
Copy link
Author

@SilenceIsFatto should be good now

@jwoodruff40 jwoodruff40 mentioned this pull request Jan 17, 2025
13 tasks
@AUC-bot AUC-bot merged commit de1e896 into SilenceIsFatto:unstable Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
misc A miscellaneous change ready-for-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants