[CR] Bugfix/cannot reload charged items #40382
Closed
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 tools without magazines load/unload issue"
Purpose of change
Tries to fix the issue where the new nested container system assumes all items with contents/charge have a magazine or internal container.
Describe the solution
Most of the methods that deal with checking whether something can fit/hold something else have been changed to reflect the assumption that anything with fuel/charge must also have a container or magazine to hold this charge.
This is a quick-fix to work around this assumption for magazine-less tools, such as the jackhammer, sewing kits etc. The work around simply handles the case where a tool has no appropriate container for a type of ammo or fuel.
Describe alternatives you've considered
Adding a pseudo-magazine to all tools to be more in line with the nested container vision. Adding pocket_data to the jackhammer json definition will make siphoning work, but will not assign the approrirate charge to the tool.
Testing
Start a new game.
Spawn in a tailor's kit.
Unload the tailor's kit. Observe that no error is produced and that you now have a 400 thread stack.
Reload the tailor's kit. Observe that the tailor's kit now has 400 charge and you now have no thread stack.
Additional context