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

Allow vitamin-providing drugs to be deposited into faction camp larder #76025

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Aug 29, 2024

Summary

Features "Add drugs and mutagens to your faction camp stores."

Purpose of change

Describe the solution

Loosen the check to not exclude 0-kcal items that do have vitamins, if player says yes on a query. (Or they can just mash enter a second time and ignore it, which distributes exactly the same as before)

Add some handling to the messages so it lets you know what's going on

Describe alternatives you've considered

Some sort of check against the comestible's type

NPCs should maybe get upset/suspicious if you're mixing mutagens into the food supply? But some of them might want to mutate, or want for example human purifier(technically a mutagen!) available to them. So that's a whole other issue

Testing

Added some food, got the expected kcal+vitamins value

Tried to add some meds with no vitamins or calories, got rejected

Tried to add some multivitamins(meds), multivitamins were added to the larder and consumed from the local map.

Note that despite the "duplicated" vitamins in the multivitamins item, both 'E'ating and 'a'ctivating the item gives only the use_action's amount, not double. So the actual vitamin value of them did not change.

Additional context

I added a note because this requires the vitamins on the multivitamins item to be duplicated. use_action and the comestible data are already duplicating this. A problem for another day.

I specifically gave drug_filler material an empty vitamin array so it didn't copy-from flesh's default vitamins. Otherwise drugs made of it would always have vitamins and be consumed Vitamins extend by default! So instead it now copies from powder, as many of the drug items were originally using. Powder does not have any default vitamins and will avoid this case.
@GuardianDll I went over #70176 to make sure I got your intention right, I'd appreciate if you just gave this a quick look.

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON Items: Food / Vitamins Comestibles and drinks [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Aug 29, 2024
@GuardianDll
Copy link
Member

it was copied from flesh because most of drug fillers are made out of gelatine, but i didn't want to make it flesh because of allergies
Now it doesn't matter really to which it copies it's values, as long as density test is satisfied

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Aug 29, 2024
@Maleclypse Maleclypse merged commit ada430e into CleverRaven:master Aug 30, 2024
31 checks passed
@RenechCDDA RenechCDDA deleted the camp_vitamin_distribution branch August 30, 2024 11:54
},
"//": "Yes, the vitamins are intentionally duplicated here. The consume/use/iteminfo UI needs them in use_action, but to actually pass on the vitamins they need to be in the comestible data, as below.",
"//2": "TODO: Fix this...",
"vitamins": [ [ "calcium", 24, 48 ], [ "iron", 24, 48 ], [ "vitC", 24, 48 ] ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB this is the wrong form for vitamins, it's only allowed to be [string, number]:

vitamin_id vit( pair.get_string( 0 ) );
if( pair.has_int( 1 ) ) {
slot.default_nutrition.set_vitamin( vit, pair.get_int( 1 ) );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I thought that might be the case but it didn't throw an error on load. Use_action allows 2 int values because it gives a random value from within the range(??), right?

@nornagon
Copy link
Contributor

nornagon commented Aug 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow vitamin-providing drugs to be deposited into faction camp food storage
4 participants