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

Spill all contents when breaking wielded item. #50970

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

RoyBerube
Copy link
Contributor

Summary

Bugfixes "Magazines of broken wielded item not being dropped"

Purpose of change

Fixes ##50925

Not all contents of a wielded item were being dropped when the item broke. Magazine items were being destroyed.

Describe the solution

Spill all of the items contents, not just those items in a container. Magazines now get dropped when the item breaks.

Describe alternatives you've considered

Testing

Smashed a cellphone containing a 150 battery against a wall until the cellphone broke.
Before: Loss of cellphone and battery.
After the fix: Loss of cellphone. Battery dropped to the ground.

Additional context

@actual-nh actual-nh added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Items: Containers Things that hold other things Items: Magazines Ammo holding items and objects. labels Aug 22, 2021
@SariusSkelrets
Copy link
Contributor

Does it spills battery/cent charges if you break a battery/cash card?

The fix should be able to understand what's supposed to drop because it would allow to wield electricity by breaking batteries

@Valares
Copy link
Contributor

Valares commented Aug 23, 2021

Does it spills battery/cent charges if you break a battery/cash card?

No. I've just tested this fix (with different items, including a cash card and a light battery (high-capacity)), it seems to respect the NO_UNLOAD flag (as I've expected it to do, since the function is called on other occasions)...

I've also tested if it's original function still works (dropping stuff out of a container), which it does.
Tested this with a gun, containing a magazine, containing ammo. It dropped the magazine loaded with the correct ammount of ammo (which in turn dropped the ammo after smashing).

I'd say this fix works as intended.

(The bug that batteries drop charges probably still exists for some batteries and I'm hunting down the cause of it, but this fix does not seem to have an influence - neither positive nor negative - on it.)

@kevingranade kevingranade merged commit aa58aad into CleverRaven:master Aug 27, 2021
@RoyBerube RoyBerube deleted the melee_magazine_loss branch August 28, 2021 18:44
Venera3 pushed a commit to Venera3/Cataclysm-DDA that referenced this pull request Sep 21, 2021
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` Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Items: Containers Things that hold other things Items: Magazines Ammo holding items and objects.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants