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

Asthmatic NPS doesn't receive his inhaler on the inhaler quest completion #31773

Closed
l29ah opened this issue Jun 23, 2019 · 5 comments
Closed
Labels
<Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact Missions Quests and missions

Comments

@l29ah
Copy link
Contributor

l29ah commented Jun 23, 2019

Describe the bug

It just vanishes from the player's inventory, leaving the poor guy with his fate.

Expected behavior

NPC getting the inhaler in his inventory for later use.

Versions and configuration

  • Game Version: 0.D-4881-ge4218458ba-dirty
@Night-Pryanik Night-Pryanik added <Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact Missions Quests and missions labels Jun 24, 2019
@l29ah
Copy link
Contributor Author

l29ah commented Jun 30, 2019

Also if an NPC is experiencing an asthma attack and is given an inhaler, he won't use it.

@wapcaplet
Copy link
Contributor

wapcaplet commented Jan 25, 2020

I experienced the same behavior:

  • Got inhaler quest from NPC (luckily I already had one with me)
  • Talked to NPC again and completed quest
  • Asked NPC to travel with me, and she accepted
  • A few minutes later she had an asthma attack
  • Talked to NPC and asked to trade - no inhaler in her inventory

wapcaplet added a commit to wapcaplet/Cataclysm-DDA that referenced this issue Jan 28, 2020
I recruited an asthmatic NPC after completing their inhaler mission and
was startled to see they had already lost it. This allows them to keep
the inhaler you find for them.

Attempted fix for CleverRaven#31773. I have detailed some problems with this commit
in comments on that issue.
@wapcaplet
Copy link
Contributor

wapcaplet commented Jan 28, 2020

I took a crack at fixing this today, and was stymied by an oddity in the mission handling, plus what looks like a bug in inventory transfer for the inhaler (and possibly other charged items). I got it mostly working, but tagged it WIP in the hopes someone can think of a better workaround to the issues I've described in the PR message: #37454

wapcaplet added a commit to wapcaplet/Cataclysm-DDA that referenced this issue Feb 1, 2020
When using this function to sell an inhaler to an NPC, `u.has_charges`
is (apparently) returning true (since player has inhaler charges),
although the inhaler itself is not counted by charges according to
@BevapDin.

This change makes `set_u_sell_item` follow more closely the pattern of
`set_u_buy_item`, by merging the two separate `if/else` blocks into one,
handling both the charge adjustment and `p.i_add` to transfer them item.

Most importantly, the first condition for doing charge-based adjustment
is whether `count_by_charges()` is true. I've preserved the check for
`u.has_charges`, because we need to ensure the requested number of
charges are available.

Partial fix for CleverRaven#31773
kevingranade pushed a commit that referenced this issue Feb 11, 2020
* Let asthmatic NPC keep inhaler after quest

I recruited an asthmatic NPC after completing their inhaler mission and
was startled to see they had already lost it. This allows them to keep
the inhaler you find for them.

Attempted fix for #31773. I have detailed some problems with this commit
in comments on that issue.

* Not take away all the player's inhalers

This may be a case of the workaround being worse than what's being
worked around. Will find a better solution.

* Don't sell inhaler by individual charges

When using this function to sell an inhaler to an NPC, `u.has_charges`
is (apparently) returning true (since player has inhaler charges),
although the inhaler itself is not counted by charges according to
@BevapDin.

This change makes `set_u_sell_item` follow more closely the pattern of
`set_u_buy_item`, by merging the two separate `if/else` blocks into one,
handling both the charge adjustment and `p.i_add` to transfer them item.

Most importantly, the first condition for doing charge-based adjustment
is whether `count_by_charges()` is true. I've preserved the check for
`u.has_charges`, because we need to ensure the requested number of
charges are available.
@Night-Pryanik
Copy link
Contributor

@wapcaplet is this fixed by #37454?

@wapcaplet
Copy link
Contributor

@Night-Pryanik Yes, I believe it was. Thanks for bringing it to my attention. I tested it again in 0.E-10373 and can no longer reproduce it, so I am closing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact Missions Quests and missions
Projects
None yet
Development

No branches or pull requests

3 participants