Merge pull request #6085 from Fox-McCloud/food-rework

Food rework
This commit is contained in:
Crazy Lemon
2017-01-10 12:11:17 -08:00
committed by GitHub
38 changed files with 508 additions and 660 deletions
+22 -19
View File
@@ -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, "<span class='notify'>You [toEat.apply_method] [toEat].</span>")
else
if(toEat.junkiness && satiety < -150 && nutrition > NUTRITION_LEVEL_STARVING + 50 )
to_chat(src, "<span class='notice'>You don't feel like eating any more junk food at the moment.</span>")
return 0
if(fullness <= 50)
to_chat(src, "<span class='warning'>You hungrily chew out a piece of [toEat] and gobble it!</span>")
else if(fullness > 50 && fullness <= 150)
else if(fullness > 50 && fullness < 150)
to_chat(src, "<span class='notice'>You hungrily begin to eat [toEat].</span>")
else if(fullness > 150 && fullness <= 350)
else if(fullness > 150 && fullness < 500)
to_chat(src, "<span class='notice'>You take a bite of [toEat].</span>")
else if(fullness > 350 && fullness <= 550)
else if(fullness > 500 && fullness < 600)
to_chat(src, "<span class='notice'>You unwillingly chew a bit of [toEat].</span>")
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, "<span class='warning'>You cannot force any more of [toEat] to go down your throat.</span>")
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("<span class='warning'>[user] attempts to force [src] to [toEat.apply_method] [toEat].</span>")
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/toEat.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()
. = ..()
@@ -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"
@@ -442,7 +442,7 @@
var/static/list/customableTypes = list(/obj/item/weapon/reagent_containers/food/snacks/customizable,/obj/item/weapon/reagent_containers/food/snacks/breadslice,/obj/item/weapon/reagent_containers/food/snacks/bun,/obj/item/weapon/reagent_containers/food/snacks/sliceable/flatdough,/obj/item/weapon/reagent_containers/food/snacks/boiledspagetti,/obj/item/trash/plate,/obj/item/trash/bowl)
var/static/list/rawtypes = list(/obj/item/weapon/reagent_containers/food/snacks/grown, /obj/item/weapon/reagent_containers/food/snacks/rawcutlet, /obj/item/weapon/reagent_containers/food/snacks/rawmeatball, /obj/item/weapon/reagent_containers/food/snacks/rawsticks, /obj/item/weapon/reagent_containers/food/snacks/salmonmeat, /obj/item/weapon/reagent_containers/food/snacks/carpmeat, /obj/item/weapon/reagent_containers/food/snacks/catfishmeat, /obj/item/weapon/reagent_containers/food/snacks/spagetti, /obj/item/weapon/reagent_containers/food/snacks/dough_ball, /obj/item/weapon/reagent_containers/food/snacks/sliceable/flatdough, /obj/item/weapon/reagent_containers/food/snacks/doughslice, /obj/item/weapon/reagent_containers/food/snacks/meat, /obj/item/weapon/reagent_containers/food/snacks/boiledrice, /obj/item/weapon/reagent_containers/food/snacks/cheesewedge, /obj/item/weapon/reagent_containers/food/snacks/raw_bacon)
var/static/list/rawtypes = list(/obj/item/weapon/reagent_containers/food/snacks/grown, /obj/item/weapon/reagent_containers/food/snacks/rawcutlet, /obj/item/weapon/reagent_containers/food/snacks/rawsticks, /obj/item/weapon/reagent_containers/food/snacks/salmonmeat, /obj/item/weapon/reagent_containers/food/snacks/carpmeat, /obj/item/weapon/reagent_containers/food/snacks/catfishmeat, /obj/item/weapon/reagent_containers/food/snacks/spagetti, /obj/item/weapon/reagent_containers/food/snacks/dough, /obj/item/weapon/reagent_containers/food/snacks/sliceable/flatdough, /obj/item/weapon/reagent_containers/food/snacks/doughslice, /obj/item/weapon/reagent_containers/food/snacks/meat, /obj/item/weapon/reagent_containers/food/snacks/boiledrice, /obj/item/weapon/reagent_containers/food/snacks/cheesewedge, /obj/item/weapon/reagent_containers/food/snacks/raw_bacon)
try
var/list/allContents = getAllContents()
+34 -24
View File
@@ -506,17 +506,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
@@ -676,11 +673,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
@@ -690,6 +696,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, "<span class='notice'>You feel vigorous.</span>")
metabolism_efficiency = 1.25
else if(nutrition < NUTRITION_LEVEL_STARVING + 50)
if(metabolism_efficiency != 0.8)
to_chat(src, "<span class='notice'>You feel sluggish.</span>")
metabolism_efficiency = 0.8
else
if(metabolism_efficiency == 1.25)
to_chat(src, "<span class='notice'>You no longer feel vigorous.</span>")
metabolism_efficiency = 1
if(drowsyness)
AdjustDrowsy(-1)
EyeBlurry(2)
@@ -932,20 +954,8 @@
if(getToxLoss() >= 45 && nutrition > 20)
lastpuke ++
if(lastpuke >= 25) // about 25 second delay I guess
Stun(5)
visible_message("<span class='danger'>[src] throws up!</span>", \
"<span class='userdanger'>[src] throws up!</span>")
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
@@ -557,8 +557,12 @@
switch(H.nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
H.throw_alert("nutrition", /obj/screen/alert/fat)
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FULL)
H.clear_alert("nutrition")
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
H.throw_alert("nutrition", /obj/screen/alert/full)
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
H.throw_alert("nutrition", /obj/screen/alert/well_fed)
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
H.throw_alert("nutrition", /obj/screen/alert/fed)
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
H.throw_alert("nutrition", /obj/screen/alert/hungry)
else
@@ -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))
+1 -1
View File
@@ -337,7 +337,7 @@
SetDruggy(0)
SetHallucinate(0)
blinded = 0
nutrition = 400
nutrition = NUTRITION_LEVEL_FED + 50
bodytemperature = 310
CureBlind()
CureNearsighted()
@@ -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
+2 -1
View File
@@ -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