-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix ammo disassembly and allow for disassembly of multiple rounds #37709
Merged
Rivet-the-Zombie
merged 7 commits into
CleverRaven:master
from
SeventhSandwich:disassemble_ammo_fix
Feb 6, 2020
Merged
Fix ammo disassembly and allow for disassembly of multiple rounds #37709
Rivet-the-Zombie
merged 7 commits into
CleverRaven:master
from
SeventhSandwich:disassemble_ammo_fix
Feb 6, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fixes ammo disassembly and allow players to input number of rounds
I'm a big fan of the small extra prompt to decide how much to disassemble, so the player is fully aware of what's happening. |
bugfix: added check to disassembly time to prevent instant disassembly of non-ammo items
I-am-Erk
added
<Bugfix>
This is a fix for a bug (or closes open issue)
[C++]
Changes (can be) made in C++. Previously named `Code`
Quality of Life
QoL: degree to which players are comfortable, and able to enjoy CDDA
Crafting / Construction / Recipes
Includes: Uncrafting / Disassembling
labels
Feb 4, 2020
BevapDin
reviewed
Feb 4, 2020
BevapDin
reviewed
Feb 4, 2020
incorporate BevapDin's suggested revisions
ZhilkinSerg
reviewed
Feb 5, 2020
ZhilkinSerg
reviewed
Feb 5, 2020
ZhilkinSerg
reviewed
Feb 5, 2020
ZhilkinSerg
reviewed
Feb 5, 2020
You need to style your changes - see #24006 for instruction for VS. |
Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
I did run it through Astyle - I'm not sure why it didn't catch the spacing on that if statement |
Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
Nope, it is still not-astyled properly. |
This was referenced Feb 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
<Bugfix>
This is a fix for a bug (or closes open issue)
[C++]
Changes (can be) made in C++. Previously named `Code`
Crafting / Construction / Recipes
Includes: Uncrafting / Disassembling
Quality of Life
QoL: degree to which players are comfortable, and able to enjoy CDDA
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY: Bugfixes "Fix ammo disassembly and allow for disassembly of multiple rounds"
Purpose of change
Fixes #37345
The current build of the game has a two-pronged issue with disassembling ammo. Firstly, you can only disassemble in multiples of whatever the 'count' of the ammo's JSON entry is. This varies from round to round. Secondly, disassembling that amount of ammo (for instance, 50 rounds of 9mm FMJ) only returns the materials needed for one round. This is not intended behavior because the uncraft recipe for each ammo type is designed to return one round's worth of materials.
Describe the solution
This PR adds a popup window when the player chooses to disassemble ammo. It prompts the player to enter an amount of ammo to disassemble, and then starts a disassembly activity with a length of time scaled to the amount of ammo being deconstructed. After it finishes, it drops the correct number of materials.
To keep track of the number of rounds the player wants to disassemble, I store the selected quantity of rounds in the 'position' attribute of the player_activity class (which is unused during item disassembly). This is a little bit hacky, but I didn't want to add an entirely new attribute just for a single purpose like ammo disassembly. If devs would prefer that instead, I'm open to revisions.
Describe alternatives you've considered
I thought of doing something like #37494 but ruled it out because of the difficulty of upkeep. It is also nice to have the ability to disassemble fewer than 50 rounds of ammunition.
I also thought of implementing a new JSON flag to disassemble things by charge count, but I couldn't think of any use cases besides ammunition.
Testing
I built CDDA in Visual Studio 2019 and tested various types of ammo (default-kind and crafted) and tried different quantities. Everything seems to work perfectly.
Additional context
None.