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

fix: crafted items no longer try to set default ammotype for items spawned empty #6009

Merged

Conversation

chaosvolt
Copy link
Member

Purpose of change (The Why)

Fixes #4860 by making it so crafting tools won't create a weird situation where the item is empty but counts as having an ammotype assigned under the hood.

Describe the solution (The How)

In crafting.cpp, added a check in the complete_craft where it asks if the item being created has no ammo loaded into it, and if so makes sure to unset the ammotype from it so it won't be in a paradoxical "I'm loaded but empty" situation which is only possible to clear by loading the exact ammo it wants and then unloading it.

Describe alternatives you've considered

I was real tempted to be lazy and just fix any items affected by this stupid bug in JSON by removing use of initial_charges from offending items...

Testing

  1. Compiled and load-tested.
  2. Gave myself debug hammerspace and all recipes.
  3. Crafted an alcohol-fueled soldering item, confirmed I can now load ethanol into it.
  4. Crafted a candle, signal flare, gasoline lantern, and medium plutonium battery to be sure that various other types of craft are still created correctly.
  5. Itemgroup tested home_hw to confirm that soda can stove kits still spawn fully-loaded in it.

Additional context

Checklist

Mandatory

@github-actions github-actions bot added the src changes related to source code. label Jan 29, 2025
@RoyalFox2140 RoyalFox2140 merged commit cc542bd into cataclysmbnteam:main Jan 30, 2025
16 checks passed
@chaosvolt chaosvolt deleted the my-soldering-iron-is-thirsty branch January 30, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

You must input denatured_alcohol at first!
2 participants