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

Add NO_DISPLAY vitamin flag, show non-nutritional vitamins as 'Other contents' in food information menu #35942

Merged
merged 1 commit into from
Dec 22, 2019

Conversation

anothersimulacrum
Copy link
Member

@anothersimulacrum anothersimulacrum commented Dec 7, 2019

Summary

SUMMARY: Infrastructure "Add vitamin flags"

Purpose of change

Addresses #35917 (comment)
I was in the area, and saw that it would be easy to add a NO_DISPLAY flag, and thought that would be beneficial for the protein bars bad_food counter vitamin.

Describe the solution

Add a flags_ member to vitamins, of type std::set<std::string>.
Add a has_flag function to vitamins, which searches that set, and looks for the flag argument passed to it.
Add code to load flags from JSON into this set.

Add FOOD_VIT_EFFECTS iteminfo_part, which displays non VITAMIN type vitamins as Other contents
Also add a check when populating the string that will be output for both of those, and don't add vitamins with the flag NO_DISPLAY.

Describe alternatives you've considered

Converting vitamins to use generic factory, but I decided that would be a bit out of scope.

Testing

image
image

@Davi-DeGanne
Copy link
Contributor

We might actually want to do a whole new line instead, because it's still kinda odd that it shows up in the "Vitamin" category when simplified nutrition is not active. E.g.:

Vitamins (RDA): Vitamin C (10%)
Other contents: Toxins (26%)

Just a suggestion, if you don't feel it's necessary, I'm not overly attached to it.

@anothersimulacrum anothersimulacrum changed the title Replace 'Vitamins (RDA)' text with 'Contains' when NO_VITAMINS is enabled [WIP] Replace 'Vitamins (RDA)' text with 'Contains' when NO_VITAMINS is enabled Dec 8, 2019
@anothersimulacrum
Copy link
Member Author

Yeah, I considered that, but it's more work!
I'll see what I can do.

@Davi-DeGanne
Copy link
Contributor

Again, if you don't get around to it, no big deal -- I think that at some point we will have to rethink whether it's appropriate to display toxins-type vitamins in descriptions at all, but not doing so would need some sort of balancing mechanism (perhaps a device that can test for them). And we could just deal with how to format the description entries at that point.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Items: Food / Vitamins Comestibles and drinks Info / User Interface Game - player communication, menus, etc. Mods Issues related to mods or modding labels Dec 8, 2019
@anothersimulacrum anothersimulacrum force-pushed the no-vit branch 2 times, most recently from 44cefdf to 7ddee5e Compare December 20, 2019 22:02
@anothersimulacrum anothersimulacrum changed the title [WIP] Replace 'Vitamins (RDA)' text with 'Contains' when NO_VITAMINS is enabled Add NO_DISPLAY vitamin flag, show non-nutritional vitamins as 'Other contents' in food information menu Dec 20, 2019
Add flags to vitamins, so that vitamins can have different effects
without requiring entirely new members.

Add FOOD_VIT_EFFECTS to item info, which displays vitamins that are not
of subtype vitamin, because these things are not used as vitamins, but
instead have other effects within food.

Some 'vitamins' should not be display, so add a `NO_DISPLAY` flag that
can be used to exclude them from display.
@anothersimulacrum
Copy link
Member Author

Okay, added that - this should be ready to go.
The original post has been updated with changes as well.

@kevingranade kevingranade merged commit eafe7c2 into CleverRaven:master Dec 22, 2019
@anothersimulacrum anothersimulacrum deleted the no-vit branch December 22, 2019 04:47
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` Info / User Interface Game - player communication, menus, etc. Items: Food / Vitamins Comestibles and drinks Mods Issues related to mods or modding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants