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: putrid heart is now consumed after use #5493

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

IllusionDX
Copy link
Contributor

Checklist

Required

Optional

Purpose of change

Fixes #5481

Describe the solution

Adjusts the use_item function in avatar_functions.cpp, so that it doesn't check if the item doesn't have an use AND is either food or med to consume it, instead it just checks if it's food or med.

Describe alternatives you've considered

Adding a bunch of jank on Character::invoke_item.

Testing

I tested with a bunch of items like the putrid heart, mutated leg, mutated arm, mutated fetus, and some unrelated items. It seems to work ok without breaking anything?
Plus I think the only food or drink item that has an external use_action (meant to be used on another creature) is the pet food and that's already handled by the two cases above the line changed. Correct me if I'm wrong.

cataclysm-bn-tiles_NFPLEKbhCa
cataclysm-bn-tiles_NSOBTkVOcY
cataclysm-bn-tiles_qpICIShg9m

@github-actions github-actions bot added the src changes related to source code. label Oct 3, 2024
Comment on lines +601 to +603
} else if( !used.is_craft() && ( used.is_medication() || used.is_food() ||
used.get_contained().is_food() ||
used.get_contained().is_medication() ) ) {
Copy link
Member

@scarf005 scarf005 Oct 3, 2024

Choose a reason for hiding this comment

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

bit worried on implications on this, probably need to learn why it had !used.type->has_use() first

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like it's there to catch a case where an item can be either 'a'pplied or 'e'aten, and is meant to have a different effect depending on which one you do. I can't think of any items that would apply to, though. I tested this with the internal furnace CBM, and that's apparently handled elsewhere, because it still works normally.

Copy link
Member

Choose a reason for hiding this comment

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

Petfood is the only item I can recall that has different effects when applied vs eaten.

@RoyalFox2140
Copy link
Collaborator

How goes this PR? Any blockers to merge?

@chaosvolt
Copy link
Member

Only thing evidently is needing to test whether the code change commented on above causes any problems.

Copy link
Member

@chaosvolt chaosvolt left a comment

Choose a reason for hiding this comment

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

Sorry it took a while for me to remember to test this.

  1. Compiled and load-tested.
  2. Spawned in and tested using putrid heart, it mutates you as expected when eaten or when activated.
  3. Tested dog food, it still works when activated or eaten.
  4. Tested regular mutagen and serum, they work when consumed, but serum no longer works when activated.

So, this seems to have broken an item I wasn't expecting to be broken, but didn't affect the item I was expecting to break.

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.

Putrid Hearts from Jabberwocks may be repeatedly activated to gain infinite mutations
5 participants