What is nutriment_factor?

How, what and why to code in BYOND.

Moderators: MisterPerson, Giacom, Nienhaus, Code Maintainers

User avatar
Farquaar
 
Joined: Sat Apr 07, 2018 7:20 am
Location: Somewhere north of Hogtown
Byond Username: Farquaar

What is nutriment_factor?

Unread postby Farquaar » Fri Nov 30, 2018 3:47 am #457915

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.



User avatar
Denton
Github User
 
Joined: Wed Aug 23, 2017 3:53 pm
Byond Username: Denton-30
Github Username: 81Denton

Re: What is nutriment_factor?

Unread postby Denton » Sat Dec 01, 2018 9:57 am #458271

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.

User avatar
Farquaar
 
Joined: Sat Apr 07, 2018 7:20 am
Location: Somewhere north of Hogtown
Byond Username: Farquaar

Re: What is nutriment_factor?

Unread postby Farquaar » Sat Dec 01, 2018 9:54 pm #458385

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.

User avatar
Denton
Github User
 
Joined: Wed Aug 23, 2017 3:53 pm
Byond Username: Denton-30
Github Username: 81Denton

Re: What is nutriment_factor?

Unread postby Denton » Sun Dec 02, 2018 1:03 am #458445

They should have a default nutritiom value that's not zero, I'll look into it later.

User avatar
Qustinnus
TGMC Maintainer
 
Joined: Tue Nov 07, 2017 12:30 am
Byond Username: Qustinnus

Re: What is nutriment_factor?

Unread postby Qustinnus » Sun Dec 02, 2018 3:34 am #458474

ctrl + f
"nutriment_factor"
fullness += C.nutriment_factor * C.volume / C.metabolization_rate

User avatar
Mickyan
Github User
 
Joined: Tue Oct 14, 2014 11:59 pm
Byond Username: Mickyan
Github Username: Mickyan

Re: What is nutriment_factor?

Unread postby Mickyan » Sun Dec 02, 2018 3:40 am #458480

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)


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest