Page 1 of 1

What is nutriment_factor?

PostPosted: Fri Nov 30, 2018 3:47 am
by Farquaar
I'm currently working on creating balanced nutriment and vitamin values for food items based on the quantity and quality of ingredients and amount of cooking steps required for each recipe. I'm a bit stumped when it comes to reagents in terms of their nutriment value, however. I want to know how many units of nutriment one gets out of one unit of sugar, one unit of milk, one unit of soy milk etc.

In my quest, I found a variable called nutriment_factor, that seems to be a property of several edible reagents. https://github.com/tgstation/tgstation/ ... eagents.dm

Nutriment
Spoiler:
Code: Select all
/datum/reagent/consumable/nutriment
   name = "Nutriment"
   id = "nutriment"
   description = "All the vitamins, minerals, and carbohydrates the body needs in pure form."
   reagent_state = SOLID
   nutriment_factor = 15 * REAGENTS_METABOLISM
   color = "#664330" // rgb: 102, 67, 48

   var/brute_heal = 1
var/burn_heal = 0

Sugar
Spoiler:
Code: Select all
/datum/reagent/consumable/sugar
   name = "Sugar"
   id = "sugar"
   description = "The organic compound commonly known as table sugar and sometimes called saccharose. This white, odorless, crystalline powder has a pleasing, sweet taste."
   reagent_state = SOLID
   color = "#FFFFFF" // rgb: 255, 255, 255
   taste_mult = 1.5 // stop sugar drowning out other flavours
   nutriment_factor = 10 * REAGENTS_METABOLISM
   metabolization_rate = 2 * REAGENTS_METABOLISM
   overdose_threshold = 200 // Hyperglycaemic shock
   taste_description = "sweetness"

Soy Sauce
Spoiler:
Code: Select all
/datum/reagent/consumable/soysauce
   name = "Soysauce"
   id = "soysauce"
   description = "A salty sauce made from the soy plant."
   nutriment_factor = 2 * REAGENTS_METABOLISM
   color = "#792300" // rgb: 121, 35, 0
taste_description = "umami"


I'm not quite sure what it is, but I think it has something to do with the amount of food one is digesting. I'm not much of a coder in any language, so it's a bit difficult for me to interpret. If anyone knows what the variable means in terms of gameplay and could explain it to me, I'd be in your debt.

Re: What is nutriment_factor?

PostPosted: Sat Dec 01, 2018 9:57 am
by Denton
nutriment_factor determines how much nutrition you get from 1u of that reagent. For example, that's why corn oil is so good for getting people fat.

Re: What is nutriment_factor?

PostPosted: Sat Dec 01, 2018 9:54 pm
by Farquaar
Denton wrote:nutriment_factor determines how much nutrition you get from 1u of that reagent. For example, that's why corn oil is so good for getting people fat.

Ah, so if I understand this correctly:
Corn oil's nutriment_factor is 20, so drinking thirty units would take a person starving at 0 nutrition to fat at 600 nutrition.
Spoiler:
Code: Select all
/datum/reagent/consumable/cornoil
   name = "Corn Oil"
   id = "cornoil"
   description = "An oil derived from various types of corn."
   nutriment_factor = 20 * REAGENTS_METABOLISM
   color = "#302000" // rgb: 48, 32, 0
taste_description = "slime"

Milk has no defined nutriment_factor, so drinking a whole carton would do nothing for one's nutrition. The same is true for soy milk.
Spoiler:
Code: Select all
/datum/reagent/consumable/milk
   name = "Milk"
   id = "milk"
   description = "An opaque white liquid produced by the mammary glands of mammals."
   color = "#DFDFDF" // rgb: 223, 223, 223
   taste_description = "milk"
   glass_icon_state = "glass_white"
   glass_name = "glass of milk"
glass_desc = "White and nutritious goodness!"

Code: Select all
/datum/reagent/consumable/soymilk
   name = "Soy Milk"
   id = "soymilk"
   description = "An opaque white liquid made from soybeans."
   color = "#DFDFC7" // rgb: 223, 223, 199
   taste_description = "soy milk"
   glass_icon_state = "glass_white"
   glass_name = "glass of soy milk"
glass_desc = "White and nutritious soy goodness!"

If that's the case, it might be worth it for me to re-balance it. A man who chugs a carton of milk should be more full than the one who puts a drop of soy sauce on his tongue.

Re: What is nutriment_factor?

PostPosted: Sun Dec 02, 2018 1:03 am
by Denton
They should have a default nutritiom value that's not zero, I'll look into it later.

Re: What is nutriment_factor?

PostPosted: Sun Dec 02, 2018 3:34 am
by Qustinnus
ctrl + f
"nutriment_factor"
fullness += C.nutriment_factor * C.volume / C.metabolization_rate

Re: What is nutriment_factor?

PostPosted: Sun Dec 02, 2018 3:40 am
by Mickyan
The default is 1 * REAGENTS_METABOLISM, set in /datum/reagent/consumable

if an object doesn't have a variable explicitly defined, it takes the value of its parent object (a dummy consumable in this case)