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

Advanced Ecig Fix #26491

Merged
merged 5 commits into from
Nov 4, 2018
Merged

Conversation

LetterShapedGlyphs
Copy link
Contributor

@LetterShapedGlyphs LetterShapedGlyphs commented Nov 2, 2018

Summary

SUMMARY: Bugfixes "Implements functionality for existing Advanced Electronic Cigarette"

Purpose of change

Fixes #20830 - Addiction mechanics are currently tied to comestibles and the Advanced Electronic Cigarette, as a tool, was unable to apply stimulant or addiction effects without a major rework.

Describe the solution

By creating a dummy ecig within iuse::ecig, the game is able to use the JSON from a regular Electronic Cigarette to trigger the appropriate consume_effects() without using a bunch of magic numbers or code duplication. Any changes to the behavior of a regular electronic cigarette should be automatically mirrored on the advanced one while preserving all functionality.

Describe alternatives you've considered

The ideal solution would be to embed the addiction effects into the nicotine_liquid directly and implement hooks for used TOOLS to trigger comestible style effects based on their AMMO. This would allow for variable concentrations in the nicotine_liquid as well as enable addiction for a few other stimulant delivery devices currently not being handled. As such this should be treated as a temporary fix until a more comprehensive solution can be implemented.

(Edited to fix the Summary line)

Makes using an advanced ecig mirror the comestible affects or a regular
ecig after consuming a charge of nicotine liquid.
src/iuse.cpp Outdated Show resolved Hide resolved
src/iuse.cpp Outdated Show resolved Hide resolved
@AMurkin
Copy link
Contributor

AMurkin commented Nov 2, 2018

Suggested change:

p->consume_effects( item( "ecig", it->birthday() ) );

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Items / Item Actions / Item Qualities Items and how they work and interact <Bugfix> This is a fix for a bug (or closes open issue) labels Nov 2, 2018
ZhilkinSerg and others added 2 commits November 2, 2018 07:35
Co-Authored-By: Karthas077 <Karthas077@users.noreply.github.com>
Co-Authored-By: Karthas077 <Karthas077@users.noreply.github.com>
@LetterShapedGlyphs
Copy link
Contributor Author

Suggested change:

p->consume_effects( item( "ecig", it->birthday() ) );

Two things -
One: I feel like having it as a second line lends some additional clarity on what exactly the code is doing for if/when it gets changed later.

Two: I'd actually rather NOT use the birthday of the advanced electronic cigarette as the birthday of the dummy cigarette in the event that someone makes the basic ones expire (which, as a comestible, they could easily do and is something that would happen in real life). If anything, I'd prefer to use the birthday of the nicotine_liquid, but have no clue how to go about trying to get the birthday of a non-perishable liquid in a container in the player's inventory.

@ZhilkinSerg ZhilkinSerg self-assigned this Nov 4, 2018
@ZhilkinSerg ZhilkinSerg merged commit 8bd0bfb into CleverRaven:master Nov 4, 2018
@ZhilkinSerg ZhilkinSerg removed their assignment Nov 4, 2018
@LetterShapedGlyphs LetterShapedGlyphs deleted the Addiction branch October 14, 2019 19:06
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.

Advanced electronic cigarette is much worse than its ordinary variant
3 participants