Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Merge peanut butter and imitation peanutbutter

Open FauxNight opened this issue 1 year ago • 2 comments

Summary

Balance "Merge peanut butter and imitation peanutbutter"

Purpose of change

Separating peanut butter from all other nut butters is unnecessary when it can be handled by conditional names based on used components.

Describe the solution

Removed the imitation peanutbutter item and folded it into peanut butter (renamed to nut butter) with conditional names based on which type of nut was used, with a variant so that loot spawned nut butter is still named peanut butter (wasn't sure if this was the best way, but only way I figured out).

Also created an "any_nut" requirement with a more exhaustive list of nuts to use with the nut butter recipe (as well as potentially others) and fixed minor typo, changing "beech nuts" to "beechnuts".

Describe alternatives you've considered

None

Testing

Started the game and crafted various nut butters, making sure the conditional names worked.

Additional context

FauxNight avatar Dec 03 '24 00:12 FauxNight

You need a migration so existing peanutbutter_imitation items turn into peanutbutter on load.

Other than that, seems okay.

RenechCDDA avatar Dec 03 '24 06:12 RenechCDDA

See that peanutbutter_imitation is exactly the same as peanutbutter but with more calories and without removing the peanut allergen, contradicting its description. The PR that added both (#40085) does not address why this is the case. The presence/absense of allergen should be enough to make them distinct from each other, yet again it's missing.

This PR's name is not fully descriptive: it removes the imitation peanut butter and adds several variants for the base item.

As for the "all other nut butters", currently there's just the base, the "imitation", and the spread version. According to the author of the referenced PR, the latter was added to have a solid peanut butter, as the base is liquid and can't be placed outside of containers.

RedMisao avatar Dec 04 '24 01:12 RedMisao

(~[slow] ~[.],starting_items)=> ../tests/iteminfo_test.cpp:1998: FAILED:
(~[slow] ~[.],starting_items)=>   CHECK( item_info_str( ice_cream, { iteminfo_parts::FOOD_NUTRITION, iteminfo_parts::FOOD_QUENCH } ) == "--\n" "Nutrition will <color_cyan>vary with chosen ingredients</color>.\n" "<color_c_white>Calories (kcal)</color>:" " <color_c_yellow>56</color>-<color_c_yellow>532</color>" "  Quench: <color_c_yellow>0</color>\n" )
(~[slow] ~[.],starting_items)=> with expansion:
Error: (~[slow] ~[.],starting_items)=>   "--
(~[slow] ~[.],starting_items)=>   Nutrition will <color_cyan>vary with chosen ingredients</color>.
(~[slow] ~[.],starting_items)=>   <color_c_white>Calories (kcal)</color>: <color_c_yellow>53</color>-
(~[slow] ~[.],starting_items)=>   <color_c_yellow>470</color>  Quench: <color_c_yellow>0</color>
(~[slow] ~[.],starting_items)=>   "
(~[slow] ~[.],starting_items)=>   ==
(~[slow] ~[.],starting_items)=>   "--
(~[slow] ~[.],starting_items)=>   Nutrition will <color_cyan>vary with chosen ingredients</color>.
(~[slow] ~[.],starting_items)=>   <color_c_white>Calories (kcal)</color>: <color_c_yellow>56</color>-
(~[slow] ~[.],starting_items)=>   <color_c_yellow>532</color>  Quench: <color_c_yellow>0</color>
(~[slow] ~[.],starting_items)=>   "
(~[slow] ~[.],starting_items)=> 
(~[slow] ~[.],starting_items)=> ../tests/iteminfo_test.cpp:2004: FAILED:
(~[slow] ~[.],starting_items)=>   CHECK( item_info_str( ice_cream, { iteminfo_parts::FOOD_VITAMINS } ) == "--\n" "Nutrition will <color_cyan>vary with chosen ingredients</color>.\n" "Vitamins (RDA): 63-354 mg Calcium (6-35%), 0-23 mg Iron (0-128%)," " and 0-45 mg Vitamin C (0-50%)\n" )
(~[slow] ~[.],starting_items)=> with expansion:
Error: (~[slow] ~[.],starting_items)=>   "--
(~[slow] ~[.],starting_items)=>   Nutrition will <color_cyan>vary with chosen ingredients</color>.
(~[slow] ~[.],starting_items)=>   Vitamins (RDA): 63-323 mg Calcium (6-32%), 0-20 mg Iron (0-109%), and 0-45 mg
(~[slow] ~[.],starting_items)=>   Vitamin C (0-50%)

Looks like this changes the calorie value of ice cream? Let me know if you need help with that.

Maleclypse avatar Dec 04 '24 04:12 Maleclypse

See that peanutbutter_imitation is exactly the same as peanutbutter but with more calories and without removing the peanut allergen, contradicting its description. The PR that added both (#40085) does not address why this is the case. The presence/absense of allergen should be enough to make them distinct from each other, yet again it's missing.

Does nut_allergen refer specifically to peanuts? I assumed it was more general, including tree nuts and other "not technically nuts but we call them nuts" items, since while people can be allergic to only peanuts, peanuts aren't unique in being a common allergy amongst "nuts".

This PR's name is not fully descriptive: it removes the imitation peanut butter and adds several variants for the base item.

By "variants" are you referring to literal variants, or the inclusion of more potential components to use in the recipe? If it's the former, it's only the one, and it was because it was the only way I figured out to make spawned "nut butter" appear as "peanut butter", so I didn't think it was necessary to put there. If it is, I'll add it.

As for the "all other nut butters", currently there's just the base, the "imitation", and the spread version. According to the author of the referenced PR, the latter was added to have a solid peanut butter, as the base is liquid and can't be placed outside of containers.

Sorry, "all other nut butters" was my way of referring to peanutbutter_imitation, since all other nuts you could make into a nut butter were generically grouped under it. I wasn't including spread_peanutbutter since it isn't craftable anyway.

FauxNight avatar Dec 04 '24 21:12 FauxNight