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

Arsenal - Action Buttons #9069

Merged
merged 15 commits into from
Jul 25, 2023
Merged

Conversation

BrettMayson
Copy link
Member

When merged this pull request will:

  • Adds a moddable action system to the arsenal
gunbag.webm

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
@GeorgeBAS
Copy link

Could this potentially be extended to a "Weapon on back" action as well? As opposed to current method which is grab weapon > self interact > weapon on back > go back into arsenal and grab 2nd weapon

@BrettMayson
Copy link
Member Author

It can be extended by any mod

@LinkIsGrim LinkIsGrim added the kind/feature Release Notes: **ADDED:** label Jul 9, 2023
@LinkIsGrim LinkIsGrim added this to the 3.16.0 milestone Jul 12, 2023
@BrettMayson
Copy link
Member Author

This should probably have a scripted way to add buttons as well, like stats and sorts. Right now it is only via config

Copy link
Contributor

@LinkIsGrim LinkIsGrim left a comment

Choose a reason for hiding this comment

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

This'll need some more hand-tuning now because of the changes in #9040.

Current issues:

  • Eden Compatibility
  • Weapons not in the arsenal can be duplicated when put into a gunbag (weapon gets added to GVAR(virtualItems) in FUNC(onArsenalOpen))
  • Weapons not in the arsenal are lost when pulled from a gunbag (see above, but opposite).

@johnb432
Copy link
Contributor

@LinkIsGrim Is FUNC(refresh) still needed though? It's only used once.

@LinkIsGrim
Copy link
Contributor

@LinkIsGrim Is FUNC(refresh) still needed though? It's only used once.

It's less messy if that bit's in a function. Since actions can modify player's equipped loadout there needs to be a way to refresh everything. Plus it can be good API in the future.

@johnb432
Copy link
Contributor

This'll need some more hand-tuning now because of the changes in #9040.

* [ ]  Weapons not in the arsenal can be duplicated when put into a gunbag (issue with `FUNC(updateUniqueItemsList)`?)

* [ ]  Weapons not in the arsenal are lost when pulled from a gunbag (see above).

FUNC(updateUniqueItemsList) does not handle items in the left panels, it only handles items in the right panels.

All items in the left tab from the player, even the ones that can't be duplicated, are added to GVAR(virtualItems) when the arsenal is opened.

Either GVAR(virtualItems) needs to be recreated every time an action is used or we add a way to store whether an item is unique or not.
Since GVAR(virtualItems) is a hashmap now, we could store the information as the value to the item (as of now, all values are nil). However, this would mean a performance hit when adding left panel items, as it would be iterating over a hashmap instead of an array.

@rautamiekka
Copy link
Contributor

Eit would be iterating over a hashmap instead of an array.

Something with keys which returns an array of HM keys, get, maybe values, maybe toArray, should work:

{
    //Stuff.
} forEach keys GVAR(virtualItems);

get returning a reference makes stuff fast, if kinda confusing.

@johnb432
Copy link
Contributor

This should resolve the problem. I did some testing with gunbags and it worked. Still needs to be tested more however.

@johnb432
Copy link
Contributor

This should resolve the problem. I did some testing with gunbags and it worked. Still needs to be tested more however.

Cleaned up the code a bit: 04c8a6c

@LinkIsGrim
Copy link
Contributor

3DEN needed some touching: ctrlEventHandlers are processed in reverse order, so refresh needs to be added first. Also skipped waiting a frame for 3DEN. Other issues should be handled by #9287.

@LinkIsGrim LinkIsGrim merged commit 3edeff2 into acemod:master Jul 25, 2023
5 checks passed
@BrettMayson BrettMayson deleted the arsenal_windows branch August 11, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants