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

Change throwable extinguisher to perish after use #33561

Merged
merged 2 commits into from
Aug 27, 2019

Conversation

artur-kink
Copy link
Contributor

@artur-kink artur-kink commented Aug 26, 2019

Summary

SUMMARY: Bugfixes "Change throwable extinguisher to perish after use"

Purpose of change

A throw_extinguisher activates when thrown into fire.
The activation lowers fire intensity and deactivates the extinguisher.
The extinguisher remains where it was thrown, and can be picked up and reused indefinitely.
Since the throwable extinguisher is described as a 'grenade', I think it should not be reusable.

Describe the solution

Removes the throwable extinguisher if it is activated in fire.
Also increase the effect a tiny bit to make it more useful.

}
}
g->m.i_rem( pos, it );
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of the iuse function indicates whether the item should be deleted. This used to work fine. Returning X here means to remove X item / charges that was used up (and returning 0 means to consume 0 items / charges).

I suspect removing the item manually here and return 1 will lead to bugs as the calling code will attempt to remove the item as well (but it isn't there anymore).

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items / Item Actions / Item Qualities Items and how they work and interact labels Aug 26, 2019
@artur-kink
Copy link
Contributor Author

You're right using i_rem is not a good solution. Although in this case process_tool does not try to double remove the item since it has no energy. I've switched it to work just like acidbomb_act which is also an un-activate-able item that is destroyed when thrown.

@ZhilkinSerg ZhilkinSerg merged commit f918a14 into CleverRaven:master Aug 27, 2019
misterprimus pushed a commit to misterprimus/Cataclysm-DDA that referenced this pull request Sep 21, 2019
* Change throwable extinguisher to perish after use

* Fixup removal of throwable extinguisher
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 / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants