tgstation icon indicating copy to clipboard operation
tgstation copied to clipboard

Refactor tasting code and reagent taste carrying, no longer taste your stomach contents or have non-existing flavours win out

Open 00-Steven opened this issue 4 months ago • 0 comments

About The Pull Request

Soooooooooooooooooooooooooooooooo tasting code has been jank for a good damn while, and with this we aim to fix that- let's start from the beginning.

Earlier when I was making a food item, I noticed that it'd never actually have the taste I gave it, just tasting indescribable as things without tastes do. Weird, cause it definitely has a taste set, and plenty of nutriment subtype reagents!... When looking into it, I noticed that we only copy the tastes to specifically the base nutriment and the vitamin subtype: https://github.com/tgstation/tgstation/blob/57b718ad20c3b6af02dbdbc87f3cae4dd4d7e297/code/datums/components/food/edible.dm#L215-L216 But! Surely the other reagents should have tastes, right?.... No: https://github.com/tgstation/tgstation/blob/57b718ad20c3b6af02dbdbc87f3cae4dd4d7e297/code/modules/reagents/chemistry/reagents/food_reagents.dm#L119-L120 we were always returning the tastes data, but never actually setting it except for those two reagents, overriding any and all tastes. This caused the non-taste of the proteins and fats to override the food taste applied to the vitamins with their volume.

So, to fix this, we replace these hardcoded ids with a check for carry_food_tastes on the nutriment reagent, such that each can individually define whether they carry food tastes. This lets oils have their own tastes, while letting all other nutriments carry the tastes. We then make get_taste_description(...) return the base flavour if no special flavour is found, and add base flavours to proteins and vitamins based on what pure proteins/vitamins with no further additives would roughly taste like.

This fixes our issue!....... Except, we now always taste something "rich earthy pungent" when we eat. Looking into it, that's the organ tissue reagent, used in our stomachs: https://github.com/tgstation/tgstation/blob/57b718ad20c3b6af02dbdbc87f3cae4dd4d7e297/code/modules/reagents/chemistry/reagents/food_reagents.dm#L232-L236 ....Because whenever we ingest something, we taste the contents of our stomach. This was previously less noticeable, as while it did count, it only added a weight for no flavour.

To fix this we just, well, make it so you taste what you're eating and not the container itself. It's as simple as separating the tasting code from the reagent holder, and making the tasting that happens on ingest exposure use that logic instead. We keep the old logic for the INTJ skillchip and tasting machine, just re-routed through this, and split up some procs to avoid too much duplication.

This fixes our issue! Though, there's still some minor issues. This lets us add organ tissue instead of nutriment to other organs so they no longer taste indescribable, as it actually works properly now, but letting organ tissue hold flavours would risk having the stomach organ tissue permanently leech the flavours of the organ tissue you eat. So we make a subtype of organ tissue for the stomach, stomach lining, which cannot hold flavours. This lets us apply the base organ tissue to all other organs without risking stomach contamination.

Why It's Good For The Game

It's jank to taste your stomach contents. It's jank for organs to taste like nothing. It's jank for reagents with flavours to never taste like anything. It's jank for tasteless reagents to block out food flavours. It's jank for organs to only sometimes contain organ tissues. yeah.

Changelog

:cl: refactor: Refactored tasting code. Please report any jank tasting behaviours. fix: You taste what you eat instead of the contents of your own stomach. fix: Other basic nutriment subtypes also carry food flavours, instead of outweighing the food flavours with their lack of flavour. fix: Basic nutriment subtypes have a flavour they default to, in case of not carrying any food flavours. fix: Oils taste like oil instead of tasting indescribable. fix: Clothing eaten by moths actually carries its flavours instead of tasting indescribable. fix: Organs use organ tissue instead of nutriment. fix: You can actually taste organ tissue. qol: Mineral slurry tastes like minerals instead of tasting indescribable. /:cl:

00-Steven avatar Oct 20 '24 17:10 00-Steven