Skip to content

Conversation

@RenechCDDA
Copy link
Member

Summary

Bugfixes "Fix some cases where food with consume_drug would not give vitamins and vice versa "

Purpose of change

Take an aspirin. Notice that you do not receive any vit_bloodthinner.

image

Put some calcium tablets into the faction camp's larder. Notice that they do not confer any vitamins.

The consume_drug_iuse actor can contain a vitamins field to optionally give vitamins. The items with this tend to be but don't have to be (I think??) comestibles. If the item has calories/vitamins defined in comestible they won't be added to the consumer's body.

Describe the solution

The least worst solution: Warn on load and force people to duplicate this stuff in json

Describe alternatives you've considered

Testing

Not done testing, but also needs some testing.

In particular this is a fragile solution, it relies on the finalization order of itype's use functions and comestible data. I am really not happy with this.

Currently(with only one commit) should expect to fail basic build. No JSON work has been done.

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Oct 15, 2025
@RenechCDDA
Copy link
Member Author

Related item where this issue presents:

"vitamins": [ [ "calcium", 24, 48 ], [ "iron", 24, 48 ], [ "vitC", 24, 48 ] ]
},
"//": "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", 36 ], [ "iron", 36 ], [ "vitC", 36 ] ]

@ShnitzelX2
Copy link
Contributor

Provided it works, a warning is better than silently failing.

I think the basic problem here is that consume_drug_iuse has fields that should be loaded through islot_comestible instead of separately. The "vitamins" fields from those two classes don't even use the same reader!

#76920 is more of a UI issue and would be nice to have even if some drugs are edible.

@RenechCDDA RenechCDDA force-pushed the sigh_consume_drug_fixes branch from 51f323b to 5facf60 Compare October 18, 2025 09:28
@RenechCDDA
Copy link
Member Author

I simplified the C++ a lot. The nutrients function actually goes unused now, but will be needed for some other cleanups so it's staying in.

Now to do all the json crap.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Items: Food / Vitamins Comestibles and drinks labels Oct 18, 2025
@RenechCDDA RenechCDDA force-pushed the sigh_consume_drug_fixes branch from ba164bf to d5b3ac4 Compare October 18, 2025 15:50
@github-actions github-actions bot added the Code: Tests Measurement, self-control, statistics, balancing. label Oct 18, 2025
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 <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants