From fbd2ce16e69fe45de1ae56e080508adb7056d818 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Tue, 19 May 2015 04:55:30 -0400 Subject: [PATCH] Nutrient Split and Diet Flag Adds Protein and Plant-matter reagents, nutritional values of 15 Reduces nutritional value of Nutriment to 12, down from 15 Adds new flag defines for racial diets, and new dietflags var to species (must be set manually in the species definition, otherwise it will be null) Assigns each species their respective diet's flag: - Carnivores: Unathi, Slime People - Omnivores: Human, Tajaran, Kidan, Vox, IPC, Shadowpeople, Golems, Plasmaman, Nucleation, Vox Armalis - Herbivores: Skrell, Diona, Grey, Wryn Adds checks to all nutrient on_mob_life procs to handle simple_animals versus carbon/human mobs - Simple animals will heal from any nutrient source, but don't gain nutritional value since they don't appear to deplete it Adds check to Nutriment on_mob_life proc to ensure that the diet for a species has been set - Failure to set a diet flag will prevent the species from benefitting from ANY nutrients, while metabolizing the reagents normally - This is largely for ensuring the species is properly defined Adds checks to Protein and Plant-matter on_mob_life procs to handle incompatible diets - Ingesting Protein does not benefit Herbivores, but will metabolize out of the body normally -Ingesting Plant-matter does not benefit Carnivores, but will metabolize out of the body normally --- code/__DEFINES/flags.dm | 5 ++ .../mob/living/carbon/human/species/apollo.dm | 3 +- .../mob/living/carbon/human/species/golem.dm | 1 + .../living/carbon/human/species/plasmaman.dm | 1 + .../mob/living/carbon/human/species/shadow.dm | 1 + code/modules/mob/living/carbon/species.dm | 12 ++++ code/modules/reagents/Chemistry-Reagents.dm | 55 +++++++++++++++++-- 7 files changed, 73 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index a54cef72f86..ea8ceb93c95 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -60,6 +60,11 @@ #define HAS_SKIN_COLOR 32 #define TAIL_WAGGING 64 +//Species Diet Flags +#define DIET_CARN 1 +#define DIET_OMNI 2 +#define DIET_HERB 4 + //bitflags for door switches. #define OPEN 1 diff --git a/code/modules/mob/living/carbon/human/species/apollo.dm b/code/modules/mob/living/carbon/human/species/apollo.dm index a1beed27be9..bddfa770a14 100644 --- a/code/modules/mob/living/carbon/human/species/apollo.dm +++ b/code/modules/mob/living/carbon/human/species/apollo.dm @@ -35,7 +35,7 @@ ) flags = IS_WHITELISTED | HAS_LIPS | HAS_UNDERWEAR | NO_BREATHE | HAS_SKIN_COLOR | NO_SCAN | NO_SCAN | HIVEMIND - + dietflags = DIET_HERB //bees feed off nectar, so bee people feed off plants too base_color = "#704300" flesh_color = "#704300" @@ -88,6 +88,7 @@ burn_mod = 4 // holy shite, poor guys wont survive half a second cooking smores brute_mod = 2 // damn, double wham, double dam flags = IS_WHITELISTED | NO_BREATHE | NO_BLOOD | NO_PAIN | HAS_LIPS | NO_SCAN + dietflags = DIET_OMNI //still human at their core, so they maintain their eating habits and diet has_organ = list( "heart" = /obj/item/organ/heart, diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm index d32de91c2a6..1cc0f1a89dd 100644 --- a/code/modules/mob/living/carbon/human/species/golem.dm +++ b/code/modules/mob/living/carbon/human/species/golem.dm @@ -6,6 +6,7 @@ default_language = "Galactic Common" flags = NO_BREATHE | NO_PAIN | NO_BLOOD | NO_SCAN + dietflags = DIET_OMNI //golems can eat anything because they are magic or something blood_color = "#515573" flesh_color = "#137E8F" diff --git a/code/modules/mob/living/carbon/human/species/plasmaman.dm b/code/modules/mob/living/carbon/human/species/plasmaman.dm index aee4d5660f0..851b970e8fe 100644 --- a/code/modules/mob/living/carbon/human/species/plasmaman.dm +++ b/code/modules/mob/living/carbon/human/species/plasmaman.dm @@ -6,6 +6,7 @@ unarmed_type = /datum/unarmed_attack/punch flags = IS_WHITELISTED | NO_BLOOD + dietflags = DIET_OMNI //default_mutations=list(SKELETON) // This screws things up diff --git a/code/modules/mob/living/carbon/human/species/shadow.dm b/code/modules/mob/living/carbon/human/species/shadow.dm index 35335193c41..8b36b05b18e 100644 --- a/code/modules/mob/living/carbon/human/species/shadow.dm +++ b/code/modules/mob/living/carbon/human/species/shadow.dm @@ -18,6 +18,7 @@ flags = NO_BLOOD | NO_BREATHE | NO_SCAN bodyflags = FEET_NOSLIP + dietflags = DIET_OMNI //the mutation process allowed you to now digest all foods regardless of initial race /datum/species/shadow/handle_death(var/mob/living/carbon/human/H) H.dust() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index a230ad2f7e5..5712d788ce8 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -53,6 +53,7 @@ var/flags = 0 // Various specific features. var/bloodflags=0 var/bodyflags=0 + var/dietflags = 0 // Make sure you set this, otherwise it won't be able to digest a lot of foods var/list/abilities = list() // For species-derived or admin-given powers @@ -321,6 +322,7 @@ path = /mob/living/carbon/human/human flags = HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT bodyflags = HAS_SKIN_TONE + dietflags = DIET_OMNI unarmed_type = /datum/unarmed_attack/punch blurb = "Humanity originated in the Sol system, and over the last five centuries has spread \ colonies across a wide swathe of space. They hold a wide range of forms and creeds.

\ @@ -348,6 +350,7 @@ flags = HAS_LIPS | HAS_UNDERWEAR bodyflags = FEET_CLAWS | HAS_TAIL | HAS_SKIN_COLOR | TAIL_WAGGING + dietflags = DIET_CARN cold_level_1 = 280 //Default 260 - Lower is better cold_level_2 = 220 //Default 200 @@ -397,6 +400,7 @@ flags = HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT bodyflags = FEET_PADDED | HAS_TAIL | HAS_SKIN_COLOR | TAIL_WAGGING + dietflags = DIET_OMNI flesh_color = "#AFA59E" base_color = "#333333" @@ -423,6 +427,7 @@ flags = HAS_LIPS | HAS_UNDERWEAR bodyflags = HAS_SKIN_COLOR + dietflags = DIET_HERB flesh_color = "#8CD7A3" blood_color = "#1D2CBF" @@ -461,6 +466,7 @@ poison_type = "oxygen" flags = NO_SCAN | IS_WHITELISTED + dietflags = DIET_OMNI blood_color = "#2299FC" flesh_color = "#808D11" @@ -514,6 +520,7 @@ poison_type = "oxygen" flags = NO_SCAN | NO_BLOOD | HAS_TAIL | NO_PAIN | IS_WHITELISTED + dietflags = DIET_OMNI //should inherit this from vox, this is here just in case blood_color = "#2299FC" flesh_color = "#808D11" @@ -546,6 +553,7 @@ flags = IS_WHITELISTED bodyflags = FEET_CLAWS + dietflags = DIET_OMNI blood_color = "#FB9800" @@ -563,6 +571,7 @@ flags = IS_WHITELISTED | NO_BREATHE | HAS_LIPS | NO_INTORGANS | NO_SCAN bodyflags = HAS_SKIN_COLOR bloodflags = BLOOD_SLIME + dietflags = DIET_CARN //ventcrawler = 1 //ventcrawling commented out @@ -587,6 +596,7 @@ primitive = /mob/living/carbon/monkey // TODO flags = IS_WHITELISTED | HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT + dietflags = DIET_HERB blood_color = "#A200FF" @@ -634,6 +644,7 @@ water and other radiation." flags = NO_BREATHE | REQUIRE_LIGHT | IS_PLANT | RAD_ABSORB | NO_BLOOD | NO_PAIN + dietflags = DIET_HERB //Diona regenerate nutrition in light, but could assimilate plantmatter if they ingest it body_temperature = T0C + 15 //make the plant people have a bit lower body temperature, why not @@ -719,6 +730,7 @@ synth_temp_gain = 10 //this should cause IPCs to stabilize at ~80 C in a 20 C environment. flags = IS_WHITELISTED | NO_BREATHE | NO_SCAN | NO_BLOOD | NO_PAIN | IS_SYNTHETIC | NO_INTORGANS + dietflags = DIET_OMNI //IPCs can't eat, this is here for the sake of standardized code blood_color = "#1F181F" flesh_color = "#AAAAAA" diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index fc2c8567525..90a89c43490 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -1485,10 +1485,31 @@ datum /////////////////////////Food Reagents//////////////////////////// // Part of the food code. Nutriment is used instead of the old "heal_amt" code. Also is where all the food // condiments, additives, and such go. - nutriment + nutriment // Pure nutriment, universally digestable and thus slightly less effective name = "Nutriment" id = "nutriment" - description = "All the vitamins, minerals, and carbohydrates the body needs in pure form." + description = "A questionable mixture of various pure nutrients commonly found in processed foods." + reagent_state = SOLID + nutriment_factor = 12 * REAGENTS_METABOLISM + color = "#664330" // rgb: 102, 67, 48 + + on_mob_life(var/mob/living/M as mob) + if(!M) M = holder.my_atom + if(!(M.mind in ticker.mode.vampires)) + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.species && H.species.dietflags) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients + H.nutrition += nutriment_factor // For hunger and fatness + if(prob(50)) M.heal_organ_damage(1,0) + if(istype(M,/mob/living/simple_animal)) //Any nutrients can heal simple animals + if(prob(50)) M.heal_organ_damage(1,0) + ..() + return + + protein // Meat-based protein, digestable by carnivores and omnivores, worthless to herbivores + name = "Protein" + id = "protein" + description = "Various essential proteins and fats commonly found in animal flesh and blood." reagent_state = SOLID nutriment_factor = 15 * REAGENTS_METABOLISM color = "#664330" // rgb: 102, 67, 48 @@ -1496,8 +1517,34 @@ datum on_mob_life(var/mob/living/M as mob) if(!M) M = holder.my_atom if(!(M.mind in ticker.mode.vampires)) - M.nutrition += nutriment_factor // For hunger and fatness - if(prob(50)) M.heal_organ_damage(1,0) + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.species && H.species.dietflags && !(H.species.dietflags & DIET_HERB)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients + H.nutrition += nutriment_factor // For hunger and fatness + if(prob(50)) M.heal_organ_damage(1,0) + if(istype(M,/mob/living/simple_animal)) //Any nutrients can heal simple animals + if(prob(50)) M.heal_organ_damage(1,0) + ..() + return + + plantmatter // Plant-based biomatter, digestable by herbivores and omnivores, worthless to carnivores + name = "Plant-matter" + id = "plantmatter" + description = "Vitamin-rich fibers and natural sugars commonly found in fresh produce." + reagent_state = SOLID + nutriment_factor = 15 * REAGENTS_METABOLISM + color = "#664330" // rgb: 102, 67, 48 + + on_mob_life(var/mob/living/M as mob) + if(!M) M = holder.my_atom + if(!(M.mind in ticker.mode.vampires)) + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.species && H.species.dietflags && !(H.species.dietflags & DIET_CARN)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients + H.nutrition += nutriment_factor // For hunger and fatness + if(prob(50)) M.heal_organ_damage(1,0) + if(istype(M,/mob/living/simple_animal)) //Any nutrients can heal simple animals + if(prob(50)) M.heal_organ_damage(1,0) ..() return