CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.34k stars 4.15k forks source link

Recipes using coconut milk are labeled as allergenic for lactose intolerant characters #48489

Closed ccaviness closed 1 week ago

ccaviness commented 3 years ago

Describe the bug

Cooking a recipe that uses coconut milk (e.g. fried liver) shows up as an allergenic for players with lactose intolerance.

Steps To Reproduce

  1. Make a player with a lactose intolerance
  2. Get some liver, coconut mlik, cooking oil, cornmeal or flour, salt, and seasoning
  3. Cook fried liver
  4. Note that the description says this food will cause an allergic reaction

Expected behavior

Food cooked with coconut milk contains not lactose, so is not an allergen for the lactose intolerant.

Screenshots

image

Versions and configuration

Anaglyphic commented 3 years ago

I would have sworn this would have been discussed before! But my searching turns up random bits about allergens, nothing exact. Apologies if answering a dupe. Maybe it was on discourse.

This looks to be the way it's coded. This will be a problem for every food allergy, every food item. Especially if this allergen system is important to people's immersion. The issue seems to be it compares against the food item and it's material flags, and is not based on what ingredients were used.


consumption.cpp

...
    for( const auto &tp : allergy_tuples ) {
        if( has_trait( std::get<0>( tp ) ) &&
            food.has_flag( std::get<1>( tp ) ) ) {
            return std::get<2>( tp );
        }
...

    if( edible || drinkable ) {
        for( const auto &elem : food.type->materials ) {

...
    // Allergy check for food that is ingested (not gum)
    if( !food.has_flag( flag_NO_INGEST ) ) {
        const auto allergy = allergy_type( food );
        if( allergy != MORALE_NULL ) {
            add_msg_if_player( m_bad, _( "Yuck!  How can anybody eat this stuff?" ) );
            add_morale( allergy, -75, -400, 30_minutes, 24_minutes );
        }
...

offal_dishes.json

...
    "id": "fried_livers",
    "type": "COMESTIBLE",
    "comestible_type": "FOOD",
    "name": { "str": "fried liver" },
    "symbol": "%",
    "looks_like": "meat_cooked",
    "description": "Nothing tastier than something that's deep-fried!",
    "price_postapoc": 150,
    "material": [ "flesh", "wheat", "milk" ],
    "primary_material": "flesh",
    "color": "brown",
...

In OP's example it appears if you made it with cornmeal and coconut milk, it will hit all 3 allergens; flag_ALLERGEN_MEAT, flag_ALLERGEN_WHEAT and flag_ALLERGEN_MILK, regardless that this particular "fried_livers" was constructed dairy-free and gluten-free.

Except the scope of it encompasses all food allergies and all foods.


Just thinking out loud to myself, but,,,

Possible Solution 1

Ingredients should have the allergen flags, not completed foods. The proper way would be to rework the recipe system so that it's per-ingredient and not per-food, nor even per-recipe. If a recipe can have 10 substitutions, then recipe processing, the actual "cooking", should handle the flagging if the completed food item contains allergen/ethics/morals flags.

This requires the most work, and adds a little complexity to found food already constructed, there'll have to be a "default" or "normal" way of making it. But it seems the way to go.

Possible Solution 2

Create "vegetarian" "low carb" "vegan" "lactose intolerant" "gluten-free" etc cookbooks; duplicate the relevant existing recipes but take out the incompatible options, so after learning "LI fried liver" it would only have nut milks as a possibility, the "GF fried liver" would remove flour as a possible ingredient, "V fried liver" would be, well you get the idea...

Simple but lots of duplicode, at leats odds of introducing a regression is low. Still, kludge-y and will probably be perceived as a bandaid by everyone with coding skills. :grimacing:

Possible Solution 3

Drugs! In our current real world, we have multiple OTC things for this, lactase pills, glutenase pills, BEANO!

They could even be constructed we get to mid-game stage, I mean alpha galactosidase that people eat in Beano is made from a mold that grows on mushrooms, that fits right into the cdda narrative. This could temporarily "turn off" the various dietary intolerances. Maybe a survival book on Druidic medicines could incorporate a more survivor-y / foraging-y allergen solution. AFAIK traits are permanent so overriding them with eating meds would probably require turning them into status-like behaviours, I am not sure though.

actual-nh commented 3 years ago

I like solution 1 - in individual (instances of) food items (inputs into and products of recipes), not the recipes, should be where such flags are kept track of.

ccaviness commented 3 years ago

Solution 1 is how I would have thought it worked before I found the bug, so +1 from me.

Xpyder commented 3 years ago

For posterity this also occurs when making Woods Soup from Eggs with Meat Intolerance. For comparison Fried eggs, Scrambled, or Boiled don't trigger the intolerance

ccaviness commented 2 years ago

56393 adds a bunch of lactose-free milk options, but food created with them is still flagged as allergic for Lactose Intolerance.

GuardianDll commented 1 week ago

should be resolved by #74763