Not to try to reload a gun without default ammo type defined #73714
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 "Not to try to reload a gun without default ammo type defined"
Purpose of change
When using guns that don't have default ammo type defined and must be used with an extra bore gunmod, don't try to reload one without a bore attached.
Close #71754
Describe the solution
Added
item_location::can_reload_with
to check if the gun has default ammo type defined.Describe alternatives you've considered
Tried to modify
item::can_reload_with
, but looks like it's hard to get parent item without item_location known.find_parent
didn't work.Testing
Create a new world without this patch, spawn a desert eagle that has no bore by default, sees that you can reload it with an empty mag, and then reload the gun with .44 Magnum.
Save and quit, apply the batch and load the save, and now you can no longer reload the bald gun. Attach a .44 conversion kit to the gun, then you can reload it as normal.
Additional context
With this PR and #73043 merged, #71754 should be totally fixed.