From e134100164ce1b6df0c7cb5a64bd3571b7239d31 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Mon, 28 Nov 2016 13:17:46 -0500 Subject: [PATCH] Hunger Rework --- code/datums/diseases/_MobProcs.dm | 4 +- code/datums/diseases/_disease.dm | 2 +- .../gamemodes/changeling/powers/absorb.dm | 4 +- code/game/gamemodes/shadowling/shadowling.dm | 4 +- code/game/gamemodes/vampire/vampire.dm | 10 +-- code/game/machinery/vending.dm | 4 +- code/modules/food_and_drinks/food.dm | 5 +- code/modules/food_and_drinks/food/candy.dm | 4 +- code/modules/food_and_drinks/food/snacks.dm | 29 +++++--- code/modules/mob/living/carbon/carbon.dm | 41 ++++++----- .../mob/living/carbon/human/examine.dm | 6 +- code/modules/mob/living/carbon/human/life.dm | 58 +++++++++------- .../living/carbon/human/species/station.dm | 4 +- code/modules/mob/living/living.dm | 2 +- code/modules/mob/living/living_defines.dm | 1 + code/modules/mob/mob_defines.dm | 3 +- code/modules/power/apc.dm | 6 +- .../modules/projectiles/projectile/special.dm | 13 ++-- code/modules/reagents/chemistry/reagents.dm | 2 +- .../reagents/chemistry/reagents/food.dm | 69 ++++++++++--------- .../reagents/chemistry/reagents/medicine.dm | 4 ++ .../surgery/organs/augments_internal.dm | 4 +- code/modules/surgery/organs/blood.dm | 2 +- 23 files changed, 157 insertions(+), 124 deletions(-) diff --git a/code/datums/diseases/_MobProcs.dm b/code/datums/diseases/_MobProcs.dm index 894e88e3a08..0252977dcf4 100644 --- a/code/datums/diseases/_MobProcs.dm +++ b/code/datums/diseases/_MobProcs.dm @@ -77,8 +77,8 @@ if(prob(15/D.permeability_mod)) return -/* if(satiety>0 && prob(satiety/10)) // positive satiety makes it harder to contract the disease. - return*/ + if(satiety > 0 && prob(satiety/10)) // positive satiety makes it harder to contract the disease. + return var/target_zone = pick(head_ch;1,body_ch;2,hands_ch;3,feet_ch;4) diff --git a/code/datums/diseases/_disease.dm b/code/datums/diseases/_disease.dm index d38c65beb8c..c55a42e397c 100644 --- a/code/datums/diseases/_disease.dm +++ b/code/datums/diseases/_disease.dm @@ -102,7 +102,7 @@ var/list/diseases = subtypesof(/datum/disease) return if(affected_mob) - if(affected_mob.reagents.has_reagent("spaceacillin")) + if(affected_mob.reagents.has_reagent("spaceacillin") || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10))) return var/spread_range = 1 diff --git a/code/game/gamemodes/changeling/powers/absorb.dm b/code/game/gamemodes/changeling/powers/absorb.dm index 3800597709a..57b69358f6b 100644 --- a/code/game/gamemodes/changeling/powers/absorb.dm +++ b/code/game/gamemodes/changeling/powers/absorb.dm @@ -58,8 +58,8 @@ if(!changeling.has_dna(target.dna)) changeling.absorb_dna(target, user) - if(user.nutrition < 450) // Nutrition level before overeat_duration starts ticking for you to become obese. - user.nutrition = min((user.nutrition + target.nutrition), 450) + if(user.nutrition < NUTRITION_LEVEL_WELL_FED) + user.nutrition = min((user.nutrition + target.nutrition), NUTRITION_LEVEL_WELL_FED) if(target.mind)//if the victim has got a mind diff --git a/code/game/gamemodes/shadowling/shadowling.dm b/code/game/gamemodes/shadowling/shadowling.dm index c9f29cefc2f..54b92e1f01e 100644 --- a/code/game/gamemodes/shadowling/shadowling.dm +++ b/code/game/gamemodes/shadowling/shadowling.dm @@ -311,7 +311,7 @@ Made by Xhuis if(!H.weakeyes) H.weakeyes = 1 //Makes them more vulnerable to flashes and flashbangs var/light_amount = 0 - H.nutrition = 450 //i aint never get hongry + H.nutrition = NUTRITION_LEVEL_WELL_FED //i aint never get hongry if(isturf(H.loc)) var/turf/T = H.loc light_amount = T.get_lumcount() * 10 @@ -346,7 +346,7 @@ Made by Xhuis if(!H.weakeyes) H.weakeyes = 1 //Makes them more vulnerable to flashes and flashbangs var/light_amount = 0 - H.nutrition = 450 //i aint never get hongry + H.nutrition = NUTRITION_LEVEL_WELL_FED //i aint never get hongry if(isturf(H.loc)) var/turf/T = H.loc light_amount = T.get_lumcount() * 10 diff --git a/code/game/gamemodes/vampire/vampire.dm b/code/game/gamemodes/vampire/vampire.dm index dd40a6817b6..635d5efb4c5 100644 --- a/code/game/gamemodes/vampire/vampire.dm +++ b/code/game/gamemodes/vampire/vampire.dm @@ -300,7 +300,7 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha H.vessel.remove_reagent("blood", 25) if(ishuman(owner)) var/mob/living/carbon/human/V = owner - V.nutrition = min(450, V.nutrition + (blood / 2)) + V.nutrition = min(NUTRITION_LEVEL_WELL_FED, V.nutrition + (blood / 2)) draining = null to_chat(owner, "You stop draining [H.name] of blood.") @@ -325,8 +325,8 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha else if(istype(p, /datum/vampire_passive)) var/datum/vampire_passive/power = p to_chat(owner, "[power.gain_desc]") - - + + /datum/game_mode/proc/remove_vampire(datum/mind/vampire_mind) if(vampire_mind in vampires) ticker.mode.vampires -= vampire_mind @@ -335,12 +335,12 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha if(vampire_mind.vampire) vampire_mind.vampire.remove_vampire_powers() qdel(vampire_mind.vampire) - vampire_mind.vampire = null + vampire_mind.vampire = null if(issilicon(vampire_mind.current)) to_chat(vampire_mind.current, "You have been turned into a robot! You can feel your powers fading away...") else to_chat(vampire_mind.current, "You have been brainwashed! You are no longer a vampire.") - ticker.mode.update_vampire_icons_removed(vampire_mind) + ticker.mode.update_vampire_icons_removed(vampire_mind) //prepare for copypaste /datum/game_mode/proc/update_vampire_icons_added(datum/mind/vampire_mind) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 4199bf72d68..3378c3919ab 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -795,8 +795,8 @@ desc = "A self-serving Chinese food machine, for all your Chinese food needs." product_slogans = "Taste 5000 years of culture!" icon_state = "snack" - products = list(/obj/item/weapon/reagent_containers/food/snacks/chinese/chowmein = 5, /obj/item/weapon/reagent_containers/food/snacks/chinese/tao = 5, /obj/item/weapon/reagent_containers/food/snacks/chinese/newdles = 5, - /obj/item/weapon/reagent_containers/food/snacks/chinese/rice = 5, /obj/item/weapon/reagent_containers/food/snacks/wingfangchu = 5) + products = list(/obj/item/weapon/reagent_containers/food/snacks/chinese/chowmein = 6, /obj/item/weapon/reagent_containers/food/snacks/chinese/tao = 6, /obj/item/weapon/reagent_containers/food/snacks/chinese/newdles = 6, + /obj/item/weapon/reagent_containers/food/snacks/chinese/rice = 6) prices = list(/obj/item/weapon/reagent_containers/food/snacks/chinese/chowmein = 50, /obj/item/weapon/reagent_containers/food/snacks/chinese/tao = 50, /obj/item/weapon/reagent_containers/food/snacks/chinese/newdles = 50, /obj/item/weapon/reagent_containers/food/snacks/chinese/rice = 50, /obj/item/weapon/reagent_containers/food/snacks/wingfangchu = 50) diff --git a/code/modules/food_and_drinks/food.dm b/code/modules/food_and_drinks/food.dm index f14c0d19254..36280683c21 100644 --- a/code/modules/food_and_drinks/food.dm +++ b/code/modules/food_and_drinks/food.dm @@ -5,6 +5,7 @@ possible_transfer_amounts = null volume = 50 //Sets the default container amount for all food items. var/filling_color = "#FFFFFF" //Used by sandwiches. + var/junkiness = 0 //for junk food. used to lower human satiety. var/bitesize = 1 var/consume_sound = 'sound/items/eatfood.ogg' var/apply_type = INGEST @@ -15,5 +16,5 @@ /obj/item/weapon/reagent_containers/food/New() ..() - pixel_x = rand(-10, 10) //Randomizes postion - pixel_y = rand(-10, 10) \ No newline at end of file + pixel_x = rand(-5, 5) //Randomizes postion + pixel_y = rand(-5, 5) \ No newline at end of file diff --git a/code/modules/food_and_drinks/food/candy.dm b/code/modules/food_and_drinks/food/candy.dm index 32a4a584a88..d6c0aaece02 100644 --- a/code/modules/food_and_drinks/food/candy.dm +++ b/code/modules/food_and_drinks/food/candy.dm @@ -134,7 +134,9 @@ trash = /obj/item/trash/candy filling_color = "#7D5F46" bitesize = 3 - list_reagents = list("nutriment" = 2, "chocolate" = 5) + junkiness = 25 + list_reagents = list("nutriment" = 1, "chocolate" = 1) + /obj/item/weapon/reagent_containers/food/snacks/candy/candycane name = "candy cane" diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 49cd0c1fa3b..b3354517676 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -47,7 +47,7 @@ qdel(src) return 0 - if(istype(M, /mob/living/carbon)) + if(iscarbon(M)) var/mob/living/carbon/C = M if(C.eat(src, user)) bitecount++ @@ -263,6 +263,7 @@ icon_state = "chips" trash = /obj/item/trash/chips filling_color = "#E8C31E" + junkiness = 20 list_reagents = list("nutriment" = 3, "sodiumchloride" = 1) /obj/item/weapon/reagent_containers/food/snacks/cornchips @@ -913,7 +914,8 @@ trash = /obj/item/trash/sosjerky filling_color = "#631212" bitesize = 2 - list_reagents = list("protein" = 4) + junkiness = 25 + list_reagents = list("protein" = 1, "sugar" = 3) /obj/item/weapon/reagent_containers/food/snacks/pistachios name = "Pistachios" @@ -921,7 +923,8 @@ desc = "A snack of deliciously salted pistachios. A perfectly valid choice..." trash = /obj/item/trash/pistachios filling_color = "#BAD145" - list_reagents = list("plantmatter" = 6, "sodiumchloride" = 1) + junkiness = 20 + list_reagents = list("plantmatter" = 2, "sodiumchloride" = 1, "sugar" = 4) /obj/item/weapon/reagent_containers/food/snacks/no_raisin name = "4no Raisins" @@ -929,7 +932,8 @@ desc = "Best raisins in the universe. Not sure why." trash = /obj/item/trash/raisins filling_color = "#343834" - list_reagents = list("plantmatter" = 6) + junkiness = 25 + list_reagents = list("plantmatter" = 2, "sugar" = 4) /obj/item/weapon/reagent_containers/food/snacks/spacetwinkie name = "Space Twinkie" @@ -937,6 +941,7 @@ desc = "Guaranteed to survive longer then you will." filling_color = "#FFE591" bitesize = 2 + junkiness = 25 list_reagents = list("sugar" = 4) /obj/item/weapon/reagent_containers/food/snacks/cheesiehonkers @@ -946,35 +951,40 @@ trash = /obj/item/trash/cheesie filling_color = "#FFA305" bitesize = 2 - list_reagents = list("nutriment" = 4, "fake_cheese" = 2) + junkiness = 25 + list_reagents = list("nutriment" = 1, "fake_cheese" = 2, "sugar" = 3) /obj/item/weapon/reagent_containers/food/snacks/chinese/chowmein name = "chow mein" desc = "What is in this anyways?" icon_state = "chinese1" bitesize = 2 - list_reagents = list("nutriment" = 6, "beans" = 3, "msg" = 4) + junkiness = 25 + list_reagents = list("nutriment" = 1, "beans" = 3, "msg" = 4, "sugar" = 2) /obj/item/weapon/reagent_containers/food/snacks/chinese/tao name = "Admiral Yamamoto carp" desc = "Tastes like chicken." icon_state = "chinese2" bitesize = 2 - list_reagents = list("nutriment" = 4, "protein" = 2, "msg" = 4) + junkiness = 25 + list_reagents = list("nutriment" = 1, "protein" = 1, "msg" = 4, "sugar" = 4) /obj/item/weapon/reagent_containers/food/snacks/chinese/newdles name = "chinese newdles" desc = "Made fresh, weekly!" icon_state = "chinese3" bitesize = 2 - list_reagents = list("nutriment" = 6, "msg" = 4) + junkiness = 25 + list_reagents = list("nutriment" = 1, "msg" = 4, "sugar" = 3) /obj/item/weapon/reagent_containers/food/snacks/chinese/rice name = "fried rice" desc = "A timeless classic." icon_state = "chinese4" bitesize = 2 - list_reagents = list("nutriment" = 3, "rice" = 3, "msg" = 4) + junkiness = 20 + list_reagents = list("nutriment" = 1, "rice" = 3, "msg" = 4, "sugar" = 2) /obj/item/weapon/reagent_containers/food/snacks/syndicake name = "Syndi-Cakes" @@ -2659,4 +2669,5 @@ trash = /obj/item/trash/tastybread filling_color = "#A66829" bitesize = 2 + junkiness = 20 list_reagents = list("nutriment" = 6) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f62df2ab76b..804c401798e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -34,12 +34,12 @@ /mob/living/carbon/Move(NewLoc, direct) . = ..() if(.) - if(src.nutrition && src.stat != 2) - src.nutrition -= HUNGER_FACTOR/10 - if(src.m_intent == "run") - src.nutrition -= HUNGER_FACTOR/10 - if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360) - src.bodytemperature += 2 + if(nutrition && stat != DEAD) + nutrition -= HUNGER_FACTOR/10 + if(m_intent == "run") + nutrition -= HUNGER_FACTOR/10 + if((FAT in mutations) && m_intent == "run" && bodytemperature <= 360) + bodytemperature += 2 // Moving around increases germ_level faster if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8)) @@ -939,9 +939,10 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, /mob/living/carbon/proc/eat(var/obj/item/weapon/reagent_containers/food/toEat, mob/user) if(!istype(toEat)) return 0 - var/fullness = 0 + var/fullness = nutrition + 10 if(istype(toEat, /obj/item/weapon/reagent_containers/food/snacks)) - fullness = nutrition + (reagents.get_reagent_amount("nutriment") * 20) + (reagents.get_reagent_amount("protein") * 25) + (reagents.get_reagent_amount("plantmatter") * 25) + for(var/datum/reagent/consumable/C in reagents.reagent_list) //we add the nutrition value of what we're currently digesting + fullness += C.nutriment_factor * C.volume / C.metabolization_rate if(user == src) if(istype(toEat, /obj/item/weapon/reagent_containers/food/drinks)) if(!selfDrink(toEat)) @@ -960,15 +961,18 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, if(istype(toEat, /obj/item/weapon/reagent_containers/food/pill)) to_chat(src, "You [toEat.apply_method] [toEat].") else + if(toEat.junkiness && satiety < -150 && nutrition > NUTRITION_LEVEL_STARVING + 50 ) + to_chat(src, "You don't feel like eating any more junk food at the moment.") + return 0 if(fullness <= 50) to_chat(src, "You hungrily chew out a piece of [toEat] and gobble it!") - else if(fullness > 50 && fullness <= 150) + else if(fullness > 50 && fullness < 150) to_chat(src, "You hungrily begin to eat [toEat].") - else if(fullness > 150 && fullness <= 350) + else if(fullness > 150 && fullness < 500) to_chat(src, "You take a bite of [toEat].") - else if(fullness > 350 && fullness <= 550) + else if(fullness > 500 && fullness < 600) to_chat(src, "You unwillingly chew a bit of [toEat].") - else if(fullness > (550 * (1 + overeatduration / 2000))) // The more you eat - the more you can eat + else if(fullness > (600 * (1 + overeatduration / 2000))) // The more you eat - the more you can eat to_chat(src, "You cannot force any more of [toEat] to go down your throat.") return 0 return 1 @@ -977,7 +981,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, return 1 /mob/living/carbon/proc/forceFed(var/obj/item/weapon/reagent_containers/food/toEat, mob/user, fullness) - if(fullness <= (550 * (1 + overeatduration / 1000))) + if(fullness <= (600 * (1 + overeatduration / 1000))) if(!toEat.instant_application) visible_message("[user] attempts to force [src] to [toEat.apply_method] [toEat].") else @@ -1005,15 +1009,14 @@ so that different stomachs can handle things in different ways VB*/ /mob/living/carbon/proc/consume(var/obj/item/weapon/reagent_containers/food/toEat) if(!toEat.reagents) return + if(satiety > -200) + satiety -= toEat.junkiness if(toEat.consume_sound) playsound(loc, toEat.consume_sound, rand(10,50), 1) if(toEat.reagents.total_volume) - toEat.reagents.reaction(src, toEat.apply_type) - spawn(0) - if(toEat.reagents.total_volume > toEat.bitesize) - toEat.reagents.trans_to(src, toEat.bitesize*toEat.transfer_efficiency) - else - toEat.reagents.trans_to(src, toEat.reagents.total_volume*toEat.transfer_efficiency) + var/fraction = min(toEat.bitesize/reagents.total_volume, 1) + toEat.reagents.reaction(src, toEat.apply_type, fraction) + toEat.reagents.trans_to(src, toEat.bitesize*toEat.transfer_efficiency) /mob/living/carbon/get_access() . = ..() diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index ff7622731d6..22aced84b68 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -253,10 +253,10 @@ if(5) msg += "[t_He] looks absolutely soaked.\n" - if(nutrition < 100) + if(nutrition < NUTRITION_LEVEL_STARVING - 50) msg += "[t_He] [t_is] severely malnourished.\n" - else if(nutrition >= 500) - if(user.nutrition < 100) + else if(nutrition >= NUTRITION_LEVEL_FAT) + if(user.nutrition < NUTRITION_LEVEL_STARVING - 50) msg += "[t_He] [t_is] plump and delicious looking - Like a fat little piggy. A tasty piggy.\n" else msg += "[t_He] [t_is] quite chubby.\n" diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index cfeb6e88faa..6aee419ad00 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -511,17 +511,14 @@ //END FIRE CODE /mob/living/carbon/human/proc/stabilize_temperature_from_calories() + var/body_temperature_difference = species.body_temperature - bodytemperature + if(bodytemperature <= species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. - if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up. - nutrition -= 2 - var/body_temperature_difference = species.body_temperature - bodytemperature - bodytemperature += max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) + bodytemperature += max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) if(bodytemperature >= species.cold_level_1 && bodytemperature <= species.heat_level_1) - var/body_temperature_difference = species.body_temperature - bodytemperature - bodytemperature += body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR + bodytemperature += body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR if(bodytemperature >= species.heat_level_1) //360.15 is 310.15 + 50, the temperature where you start to feel effects. //We totally need a sweat system cause it totally makes sense...~ - var/body_temperature_difference = species.body_temperature - bodytemperature bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers @@ -681,11 +678,20 @@ becomeFat() // nutrition decrease - if(nutrition > 0 && stat != 2) - nutrition = max (0, nutrition - HUNGER_FACTOR) + if(nutrition > 0 && stat != DEAD) + // THEY HUNGER + var/hunger_rate = HUNGER_FACTOR + if(satiety > 0) + satiety-- + if(satiety < 0) + satiety++ + if(prob(round(-satiety/40))) + Jitter(5) + hunger_rate = 3 * HUNGER_FACTOR + nutrition = max(0, nutrition - hunger_rate) - if(nutrition > 450) - if(overeatduration < 800) //capped so people don't take forever to unfat + if(nutrition > NUTRITION_LEVEL_FULL) + if(overeatduration < 600) //capped so people don't take forever to unfat overeatduration++ else @@ -695,6 +701,22 @@ else overeatduration -= 2 + //metabolism change + if(nutrition > NUTRITION_LEVEL_FAT) + metabolism_efficiency = 1 + else if(nutrition > NUTRITION_LEVEL_FED && satiety > 80) + if(metabolism_efficiency != 1.25) + to_chat(src, "You feel vigorous.") + metabolism_efficiency = 1.25 + else if(nutrition < NUTRITION_LEVEL_STARVING + 50) + if(metabolism_efficiency != 0.8) + to_chat(src, "You feel sluggish.") + metabolism_efficiency = 0.8 + else + if(metabolism_efficiency == 1.25) + to_chat(src, "You no longer feel vigorous.") + metabolism_efficiency = 1 + if(drowsyness) AdjustDrowsy(-1) EyeBlurry(2) @@ -937,20 +959,8 @@ if(getToxLoss() >= 45 && nutrition > 20) lastpuke ++ if(lastpuke >= 25) // about 25 second delay I guess - Stun(5) - - visible_message("[src] throws up!", \ - "[src] throws up!") - playsound(loc, 'sound/effects/splat.ogg', 50, 1) - - var/turf/location = loc - if(istype(location, /turf/simulated)) - location.add_vomit_floor(src, 1) - - nutrition -= 20 + vomit(20, 0, 1, 0, 1) adjustToxLoss(-3) - - // make it so you can only puke so fast lastpuke = 0 //0.1% chance of playing a scary sound to someone who's in complete darkness diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm index 1a6c8254a3e..0a9067ea5d4 100644 --- a/code/modules/mob/living/carbon/human/species/station.dm +++ b/code/modules/mob/living/carbon/human/species/station.dm @@ -817,8 +817,8 @@ H.nutrition += light_amount H.traumatic_shock -= light_amount - if(H.nutrition > 450) - H.nutrition = 450 + if(H.nutrition > NUTRITION_LEVEL_WELL_FED) + H.nutrition = NUTRITION_LEVEL_WELL_FED if((light_amount >= 5) && !H.suiciding) //if there's enough light, heal H.adjustBruteLoss(-(light_amount/2)) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6be18445b44..77158b95d8a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -333,7 +333,7 @@ SetDruggy(0) SetHallucinate(0) blinded = 0 - nutrition = 400 + nutrition = NUTRITION_LEVEL_FED + 50 bodytemperature = 310 CureBlind() CureNearsighted() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index c3dab651906..3d4638f43ce 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -32,6 +32,7 @@ var/implanting = 0 //Used for the mind-slave implant var/floating = 0 var/mob_size = MOB_SIZE_HUMAN + var/metabolism_efficiency = 1 //more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature.. var/nightvision = 0 var/bloodcrawl = 0 //0 No blood crawling, 1 blood crawling, 2 blood crawling+mob devour diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 6cb582e94c1..1d6a7eb43fe 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -67,7 +67,8 @@ var/bodytemperature = 310.055 //98.7 F var/flying = 0 var/charges = 0.0 - var/nutrition = 400.0//Carbon + var/nutrition = NUTRITION_LEVEL_FED + 50 //Carbon + var/satiety = 0 //Carbon var/overeatduration = 0 // How long this guy is overeating //Carbon var/intent = null//Living diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index b8ee00a9a5d..5afa1b8c96b 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -678,7 +678,7 @@ to_chat(H, "The APC power currents surge erratically, damaging your chassis!") H.adjustFireLoss(10,0) else if(src.cell && src.cell.charge > 0) - if(H.nutrition < 450) + if(H.nutrition < NUTRITION_LEVEL_WELL_FED) if(src.cell.charge >= 500) H.nutrition += 50 src.cell.charge -= 500 @@ -689,8 +689,8 @@ to_chat(user, "You slot your fingers into the APC interface and siphon off some of the stored charge for your own use.") if(src.cell.charge < 0) src.cell.charge = 0 - if(H.nutrition > 500) - H.nutrition = 500 + if(H.nutrition > NUTRITION_LEVEL_WELL_FED + 50) + H.nutrition = NUTRITION_LEVEL_WELL_FED + 50 src.charging = 1 else to_chat(user, "You are already fully charged.") diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index bcc4335f66a..e0576170368 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -136,12 +136,11 @@ var/mob/living/M = target if(ishuman(target)) var/mob/living/carbon/human/H = M - if((H.species.flags & IS_PLANT) && (M.nutrition < 500)) + if(H.species.flags & IS_PLANT) if(prob(15)) M.apply_effect((rand(30,80)),IRRADIATE) M.Weaken(5) - for(var/mob/V in viewers(src)) - V.show_message("[M] writhes in pain as \his vacuoles boil.", 3, "You hear the crunching of leaves.", 2) + M.visible_message("[M] writhes in pain as \his vacuoles boil.", "You writhe in pain as your vacuoles boil!", "You hear the crunching of leaves.") if(prob(35)) if(prob(80)) randmutb(M) @@ -152,7 +151,7 @@ else M.adjustFireLoss(rand(5,15)) M.show_message("The radiation beam singes you!") - else if(istype(target, /mob/living/carbon/)) + else if(iscarbon(target)) M.show_message("The radiation beam dissipates harmlessly through your body.") else return 1 @@ -170,9 +169,9 @@ var/mob/M = target if(ishuman(target)) //These rays make plantmen fat. var/mob/living/carbon/human/H = M - if((H.species.flags & IS_PLANT) && (M.nutrition < 500)) - M.nutrition += 30 - else if(istype(target, /mob/living/carbon/)) + if(H.species.flags & IS_PLANT) + H.nutrition = min(H.nutrition+30, NUTRITION_LEVEL_FULL) + else if(iscarbon(target)) M.show_message("The radiation beam dissipates harmlessly through your body.") else return 1 diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 367c747c4e0..1e043d88b7c 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -73,7 +73,7 @@ /datum/reagent/proc/on_mob_life(mob/living/M) current_cycle++ - holder.remove_reagent(id, metabolization_rate) //By default it slowly disappears. + holder.remove_reagent(id, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. /datum/reagent/proc/on_mob_death(mob/living/M) //use this to have chems have a "death-triggered" effect return diff --git a/code/modules/reagents/chemistry/reagents/food.dm b/code/modules/reagents/chemistry/reagents/food.dm index e2aef002060..ffac4411fbc 100644 --- a/code/modules/reagents/chemistry/reagents/food.dm +++ b/code/modules/reagents/chemistry/reagents/food.dm @@ -21,7 +21,7 @@ id = "nutriment" description = "A questionable mixture of various pure nutrients commonly found in processed foods." reagent_state = SOLID - nutriment_factor = 12 * REAGENTS_METABOLISM + nutriment_factor = 15 * REAGENTS_METABOLISM color = "#664330" // rgb: 102, 67, 48 /datum/reagent/consumable/nutriment/on_mob_life(mob/living/M) @@ -42,14 +42,12 @@ name = "Protein" id = "protein" description = "Various essential proteins and fats commonly found in animal flesh and blood." - nutriment_factor = 15 * REAGENTS_METABOLISM diet_flags = DIET_CARN | DIET_OMNI /datum/reagent/consumable/nutriment/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." - nutriment_factor = 15 * REAGENTS_METABOLISM diet_flags = DIET_HERB | DIET_OMNI /datum/reagent/consumable/vitamin @@ -63,6 +61,8 @@ if(prob(50)) M.adjustBruteLoss(-1) M.adjustFireLoss(-1) + if(M.satiety < 600) + M.satiety += 30 if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.species.exotic_blood) @@ -72,6 +72,38 @@ H.vessel.add_reagent("blood", 0.5) ..() +/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 + nutriment_factor = 5 * REAGENTS_METABOLISM + overdose_threshold = 200 // Hyperglycaemic shock + +/datum/reagent/consumable/sugar/on_mob_life(mob/living/M) + M.AdjustDrowsy(-5) + if(current_cycle >= 90) + M.AdjustJitter(2) + if(prob(50)) + M.AdjustParalysis(-1) + M.AdjustStunned(-1) + M.AdjustWeakened(-1) + if(prob(4)) + M.reagents.add_reagent("epinephrine", 1.2) + ..() + +/datum/reagent/consumable/sugar/overdose_start(mob/living/M) + to_chat(M, "You pass out from hyperglycemic shock!") + M.emote("collapse") + ..() + +/datum/reagent/consumable/sugar/overdose_process(mob/living/M, severity) + M.Paralyse(3 * severity) + M.Weaken(4 * severity) + if(prob(8)) + M.adjustToxLoss(severity) + /datum/reagent/consumable/soysauce name = "Soysauce" id = "soysauce" @@ -671,37 +703,6 @@ ///Food Related, but non-nutritious -/datum/reagent/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 - overdose_threshold = 200 // Hyperglycaemic shock - -/datum/reagent/sugar/on_mob_life(mob/living/M) - M.AdjustDrowsy(-5) - if(current_cycle >= 90) - M.AdjustJitter(2) - if(prob(50)) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) - if(prob(4)) - M.reagents.add_reagent("epinephrine", 1.2) - ..() - -/datum/reagent/sugar/overdose_start(mob/living/M) - to_chat(M, "You pass out from hyperglycemic shock!") - M.emote("collapse") - ..() - -/datum/reagent/sugar/overdose_process(mob/living/M, severity) - M.Paralyse(3 * severity) - M.Weaken(4 * severity) - if(prob(8)) - M.adjustToxLoss(severity) - /datum/reagent/questionmark // food poisoning name = "????" id = "????" diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index b3b94ff7e88..de539ef52ba 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -2,6 +2,10 @@ name = "Medicine" id = "medicine" +/datum/reagent/medicine/on_mob_life(mob/living/M) + current_cycle++ + holder.remove_reagent(id, metabolization_rate / M.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism + /datum/reagent/medicine/hydrocodone name = "Hydrocodone" id = "hydrocodone" diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 88f8078a2ba..153f169efca 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -164,7 +164,7 @@ desc = "This implant with synthesize and pump into your bloodstream a small amount of nutriment when you are starving." icon_state = "chest_implant" implant_color = "#00AA00" - var/hunger_threshold = 150 + var/hunger_threshold = NUTRITION_LEVEL_STARVING var/synthesizing = 0 var/poison_amount = 5 slot = "stomach" @@ -195,7 +195,7 @@ desc = "This implant will synthesize and pump into your bloodstream a small amount of nutriment when you are hungry." icon_state = "chest_implant" implant_color = "#006607" - hunger_threshold = 300 + hunger_threshold = NUTRITION_LEVEL_HUNGRY poison_amount = 10 origin_tech = "materials=5;programming=3;biotech=5" diff --git a/code/modules/surgery/organs/blood.dm b/code/modules/surgery/organs/blood.dm index f71e9bff0be..1bdf29dd191 100644 --- a/code/modules/surgery/organs/blood.dm +++ b/code/modules/surgery/organs/blood.dm @@ -66,7 +66,7 @@ if(mind) //Handles vampires "eating" blood that isn't their own. if(mind in ticker.mode.vampires) for(var/datum/reagent/blood/BL in vessel.reagent_list) - if(nutrition >= 450) + if(nutrition >= NUTRITION_LEVEL_WELL_FED) break //We don't want blood tranfusions making vampires fat. if(BL.data["donor"] != src) nutrition += (15 * REAGENTS_METABOLISM)