-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
JSONize flag-based modifiers on comestible enjoyability #35813
Merged
ZhilkinSerg
merged 6 commits into
CleverRaven:master
from
Davi-DeGanne:JSONize-flag-tastiness
Dec 6, 2019
Merged
JSONize flag-based modifiers on comestible enjoyability #35813
ZhilkinSerg
merged 6 commits into
CleverRaven:master
from
Davi-DeGanne:JSONize-flag-tastiness
Dec 6, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was only a single flag that affected the "fun" value of comestibles (BAD_TASTE) but I want to add more for a water sanitation rework, so rather than hardcoding more, I JSONized the process. Adds a new member variable to json_flag objects, "taste_mod," which additively modifies the enjoyability of comestibles. This is done via a new function, "item::get_comestible_fun". The MUSHY flag check was moved there from Character::fun_for as well. "item::get_comestible_fun" is of course called in "Character::fun_for", so this commit shouldn't have any functional changes.
Anyone trying to query a comestible's "fun" should be using the new "item::get_comestible_fun" method. This commit is to enforce that. Of course, that had to be reconciled with the current usage of "fun". I added "item" and "Item_factory" as friends of "islot_comestible" so that "item::get_comestible_fun" and the function that sets "fun" still have access to it. All other queries of "fun" were instead changed to the new method. This has the side-effect of applying BAD_TASTE and MUSHY effects in places where they didn't before, including but not limited to: - Interaction with taste blocker bionic. - NPCs making decisions about faction food stocks. - NPCs making decisions about whether they personally want food. - Scavenging monsters deciding whether to eat food off the ground.
BevapDin
reviewed
Dec 2, 2019
BevapDin
reviewed
Dec 2, 2019
Co-Authored-By: BevapDin <tho_ki@gmx.de>
I-am-Erk
pushed a commit
to I-am-Erk/Cataclysm-DDA
that referenced
this pull request
Dec 6, 2019
…35813) * JSONize flag taste modifiers There was only a single flag that affected the "fun" value of comestibles (BAD_TASTE) but I want to add more for a water sanitation rework, so rather than hardcoding more, I JSONized the process. Adds a new member variable to json_flag objects, "taste_mod," which additively modifies the enjoyability of comestibles. This is done via a new function, "item::get_comestible_fun". The MUSHY flag check was moved there from Character::fun_for as well. "item::get_comestible_fun" is of course called in "Character::fun_for", so this commit shouldn't have any functional changes. * Make "islot_comestible::fun" private Anyone trying to query a comestible's "fun" should be using the new "item::get_comestible_fun" method. This commit is to enforce that. Of course, that had to be reconciled with the current usage of "fun". I added "item" and "Item_factory" as friends of "islot_comestible" so that "item::get_comestible_fun" and the function that sets "fun" still have access to it. All other queries of "fun" were instead changed to the new method. This has the side-effect of applying BAD_TASTE and MUSHY effects in places where they didn't before, including but not limited to: - Interaction with taste blocker bionic. - NPCs making decisions about faction food stocks. - NPCs making decisions about whether they personally want food. - Scavenging monsters deciding whether to eat food off the ground. * Apply suggestions from code review Co-Authored-By: BevapDin <tho_ki@gmx.de> * Subjugate rogue tab (i.e. astyle) * Fix merge mistake
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
Items: Food / Vitamins
Comestibles and drinks
[JSON]
Changes (can be) made in JSON
Mutations / Traits / Professions/ Hobbies
Mutations / Traits / Professions/ Hobbies
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "JSONize flag-based modifiers on comestible enjoyability"
Purpose of change
There was only a single flag that affected the "fun" value of comestibles (BAD_TASTE) but I want to add more for a water sanitation rework, so rather than hardcoding more, I JSONized the process.
Describe the solution
Adds a new member variable to json_flag objects, "taste_mod", which additively modifies the enjoyability of comestibles. See commit messages for more detailed and technical info.
This also has the side-effect of considering BAD_TASTE and MUSHY effects in places where they weren't before, including but not limited to:
Describe alternatives you've considered
Testing
Additional context