Fix Toxins not working with simplified nutrition #35917
Merged
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 "Implement vitamin types"
Purpose of change
Everything of type
vitamin
was disabled by theNO_VITAMINS
external option.This meant that non-vitamin things of type
vitamin
were also disabled by this, notably toxins from mutant meat.Describe the solution
Add
vit_type
JSON field to vitamins, andtype
to the vitamin class.Create a
vitamin_type
enum, and load thevit_type
strings in the vitamin JSON into these enum values.Make the
NO_VITAMINS
external option only zero outvitamin
type vitamins.Describe alternatives you've considered
I considered renaming the vitamin class to prevent future confusing, but I judged that to be a fairly large change without too much gain.
Testing
Create a world without simplified nutrition, look at the vitamin values for mutant meat. Notice they match the values defined in JSON.
Create a world with simplified nutrition, look at the vitamins in mutant meat. Notice that it only has
Toxins
, because they are the only type of vitamin it has that is not ofvitamin
type.Additional context
No documentation because vitamins aren't documented. I'll make a PR for that soon.