Nutrition Refactor (#12389)

This commit is contained in:
Fox McCloud
2019-09-24 18:17:55 -04:00
committed by variableundefined
parent 082dcc9910
commit 86e6d85093
40 changed files with 135 additions and 111 deletions
+1 -1
View File
@@ -1934,7 +1934,7 @@
H.reagents.add_reagent("ice", 40)
logmsg = "cold."
if("Hunger")
H.nutrition = NUTRITION_LEVEL_CURSED
H.set_nutrition(NUTRITION_LEVEL_CURSED)
logmsg = "starvation."
if("Cluwne")
H.makeCluwne()
+2 -2
View File
@@ -991,12 +991,12 @@
/obj/machinery/hydroponics/attack_animal(mob/living/user)
if(istype(user, /mob/living/simple_animal/diona))
if(weedlevel > 0)
user.nutrition += weedlevel * 15
user.adjust_nutrition(weedlevel * 15)
adjustWeeds(-10)
update_icon()
visible_message("<span class='danger'>[user] begins rooting through [src], ripping out weeds and eating them noisily.</span>","<span class='danger'>You begin rooting through [src], ripping out weeds and eating them noisily.</span>")
else if(nutrilevel < 10)
user.nutrition -= ((10 - nutrilevel) * 5)
user.adjust_nutrition(-((10 - nutrilevel) * 5))
adjustNutri(10)
update_icon()
visible_message("<span class='danger'>[user] secretes a trickle of green liquid from its tail, refilling [src]'s nutrient tray.</span>","<span class='danger'>You secrete a trickle of green liquid from your tail, refilling [src]'s nutrient tray.</span>")
+3 -3
View File
@@ -26,9 +26,9 @@
. = ..()
if(.)
if(nutrition && stat != DEAD)
nutrition -= hunger_drain / 10
adjust_nutrition(-(hunger_drain * 0.1))
if(m_intent == MOVE_INTENT_RUN)
nutrition -= hunger_drain / 10
adjust_nutrition(-(hunger_drain * 0.1))
if((FAT in mutations) && m_intent == MOVE_INTENT_RUN && bodytemperature <= 360)
bodytemperature += 2
@@ -110,7 +110,7 @@
else
if(T)
T.add_vomit_floor()
nutrition -= lost_nutrition
adjust_nutrition(-lost_nutrition)
if(stun)
adjustToxLoss(-3)
T = get_step(T, dir)
@@ -1900,6 +1900,16 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
.["Make superhero"] = "?_src_=vars;makesuper=[UID()]"
. += "---"
/mob/living/carbon/human/adjust_nutrition(change)
if(NO_HUNGER in dna.species.species_traits)
return FALSE
return ..()
/mob/living/carbon/human/set_nutrition(change)
if(NO_HUNGER in dna.species.species_traits)
return FALSE
return ..()
/mob/living/carbon/human/proc/special_post_clone_handling()
if(mind && mind.assigned_role == "Cluwne") //HUNKE your suffering never stops
makeCluwne()
+47 -46
View File
@@ -597,54 +597,55 @@
if(status_flags & GODMODE)
return 0 //godmode
//The fucking FAT mutation is the greatest shit ever. It makes everyone so hot and bothered.
if(CAN_BE_FAT in dna.species.species_traits)
if(FAT in mutations)
if(overeatduration < 100)
becomeSlim()
else
if(overeatduration > 500)
becomeFat()
// nutrition decrease
if(nutrition > 0 && stat != DEAD)
// THEY HUNGER
var/hunger_rate = hunger_drain
if(satiety > 0)
satiety--
if(satiety < 0)
satiety++
if(prob(round(-satiety/40)))
Jitter(5)
hunger_rate = 3 * hunger_drain
nutrition = max(0, nutrition - hunger_rate)
if(nutrition > NUTRITION_LEVEL_FULL)
if(overeatduration < 600) //capped so people don't take forever to unfat
overeatduration++
else
if(overeatduration > 1)
if(OBESITY in mutations)
overeatduration -= 1 // Those with obesity gene take twice as long to unfat
if(!(NO_HUNGER in dna.species.species_traits))
//The fucking FAT mutation is the greatest shit ever. It makes everyone so hot and bothered.
if(CAN_BE_FAT in dna.species.species_traits)
if(FAT in mutations)
if(overeatduration < 100)
becomeSlim()
else
overeatduration -= 2
if(overeatduration > 500)
becomeFat()
//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
// nutrition decrease
if(nutrition > 0 && stat != DEAD)
// THEY HUNGER
var/hunger_rate = hunger_drain
if(satiety > 0)
satiety--
if(satiety < 0)
satiety++
if(prob(round(-satiety/40)))
Jitter(5)
hunger_rate = 3 * hunger_drain
adjust_nutrition(-hunger_rate)
if(nutrition > NUTRITION_LEVEL_FULL)
if(overeatduration < 600) //capped so people don't take forever to unfat
overeatduration++
else
if(overeatduration > 1)
if(OBESITY in mutations)
overeatduration -= 1 // Those with obesity gene take twice as long to unfat
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)
@@ -814,6 +814,8 @@
H.healthdoll.cached_healthdoll_overlays = new_overlays
/datum/species/proc/handle_hud_icons_nutrition(mob/living/carbon/human/H)
if(NO_HUNGER in species_traits)
return FALSE
if(H.mind && H.mind.vampire && (H.mind in SSticker.mode.vampires)) //Vampires
switch(H.nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
@@ -11,13 +11,14 @@
"liver" = /obj/item/organ/internal/liver,
"kidneys" = /obj/item/organ/internal/kidneys,
"brain" = /obj/item/organ/internal/brain/abductor,
"appendix" = /obj/item/organ/internal/appendix,
"eyes" = /obj/item/organ/internal/eyes/abductor //3 darksight.
)
species_traits = list(NO_BLOOD, NO_BREATHE, VIRUSIMMUNE, NOGUNS, NO_EXAMINE)
species_traits = list(NO_BLOOD, NO_BREATHE, VIRUSIMMUNE, NOGUNS, NO_HUNGER, NO_EXAMINE)
dies_at_threshold = TRUE
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
dietflags = DIET_OMNI
reagent_tag = PROCESS_ORG
@@ -91,9 +91,9 @@
H.clear_alert("nolight")
else
H.throw_alert("nolight", /obj/screen/alert/nolight)
H.nutrition += light_amount * 10
H.adjust_nutrition(light_amount * 10)
if(H.nutrition > NUTRITION_LEVEL_ALMOST_FULL)
H.nutrition = NUTRITION_LEVEL_ALMOST_FULL
H.set_nutrition(NUTRITION_LEVEL_ALMOST_FULL)
if(light_amount > 0.2 && !H.suiciding) //if there's enough light, heal
if(!pod && H.health <= 0)
return
@@ -341,8 +341,7 @@
heat_level_2 = 340
heat_level_3 = 400
dietflags = 0 //Regenerate nutrition in light, no diet necessary
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE
dietflags = DIET_HERB // Plants eat...plants?
info_text = "As a <span class='danger'>Wooden Golem</span>, you have plant-like traits: you take damage from extreme temperatures, can be set on fire, and have lower armor than a normal golem. You regenerate when in the light and wither in the darkness."
prefix = "Wooden"
@@ -361,9 +360,9 @@
H.clear_alert("nolight")
else
H.throw_alert("nolight", /obj/screen/alert/nolight)
H.nutrition += light_amount * 10
H.adjust_nutrition(light_amount * 10)
if(H.nutrition > NUTRITION_LEVEL_ALMOST_FULL)
H.nutrition = NUTRITION_LEVEL_ALMOST_FULL
H.set_nutrition(NUTRITION_LEVEL_ALMOST_FULL)
if(light_amount > 0.2 && !H.suiciding) //if there's enough light, heal
H.adjustBruteLoss(-1)
H.adjustFireLoss(-1)
@@ -1,4 +1,4 @@
/datum/species/plasmaman // /vg/
/datum/species/plasmaman
name = "Plasmaman"
name_plural = "Plasmamen"
icobase = 'icons/mob/human_races/r_plasmaman_sb.dmi'
@@ -6,12 +6,14 @@
dangerous_existence = TRUE //So so much
//language = "Clatter"
species_traits = list(IS_WHITELISTED, RADIMMUNE, NO_BLOOD, NOTRANSSTING)
species_traits = list(IS_WHITELISTED, RADIMMUNE, NO_BLOOD, NO_HUNGER, NOTRANSSTING)
forced_heartattack = TRUE // Plasmamen have no blood, but they should still get heart-attacks
skinned_type = /obj/item/stack/sheet/mineral/plasma // We're low on plasma, R&D! *eyes plasmaman co-worker intently*
dietflags = DIET_OMNI
reagent_tag = PROCESS_ORG
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE //skeletons can't taste anything
butt_sprite = "plasma"
breathid = "tox"
@@ -34,7 +36,6 @@
"liver" = /obj/item/organ/internal/liver/plasmaman,
"kidneys" = /obj/item/organ/internal/kidneys/plasmaman,
"brain" = /obj/item/organ/internal/brain/plasmaman,
"appendix" = /obj/item/organ/internal/appendix,
"eyes" = /obj/item/organ/internal/eyes/plasmaman
)
@@ -9,7 +9,7 @@
blood_color = "#555555"
flesh_color = "#222222"
species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE, NOGUNS, NO_EXAMINE) //Can't use guns due to muzzle flash
species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE, NOGUNS, NO_HUNGER, NO_EXAMINE) //Can't use guns due to muzzle flash
burn_mod = 1.5 //1.5x burn damage, 2x is excessive
heatmod = 1.5
@@ -24,7 +24,6 @@
if(!H.weakeyes)
H.weakeyes = 1 //Makes them more vulnerable to flashes and flashbangs
var/light_amount = 0
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
@@ -60,7 +59,7 @@
blood_color = "#CCCCCC"
flesh_color = "#AAAAAA"
species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE, NO_EXAMINE)
species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE, NO_HUNGER, NO_EXAMINE)
burn_mod = 1.1
heatmod = 1.1
@@ -68,7 +67,6 @@
if(!H.weakeyes)
H.weakeyes = 1 //Makes them more vulnerable to flashes and flashbangs
var/light_amount = 0
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
@@ -10,10 +10,12 @@
blood_color = "#FFFFFF"
flesh_color = "#E6E6C6"
species_traits = list(NO_BREATHE, NO_BLOOD, RADIMMUNE, VIRUSIMMUNE, PIERCEIMMUNE)
species_traits = list(NO_BREATHE, NO_BLOOD, RADIMMUNE, VIRUSIMMUNE, NO_HUNGER, PIERCEIMMUNE)
dies_at_threshold = TRUE
skinned_type = /obj/item/stack/sheet/bone
taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE //skeletons can't taste anything
dietflags = DIET_OMNI
reagent_tag = PROCESS_ORG
@@ -171,7 +171,7 @@
H.update_body()
H.updatehealth()
H.UpdateDamageIcon()
H.nutrition -= SLIMEPERSON_HUNGERCOST
H.adjust_nutrition(-SLIMEPERSON_HUNGERCOST)
H.visible_message("<span class='notice'>[H] finishes regrowing [H.p_their()] missing [new_limb]!</span>", "<span class='notice'>You finish regrowing your [limb_select]</span>")
else
to_chat(H, "<span class='warning'>You need to hold still in order to regrow a limb!</span>")
@@ -19,6 +19,7 @@
clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS
bodyflags = HAS_TAIL | HAS_HEAD_ACCESSORY | HAS_BODY_MARKINGS | HAS_HEAD_MARKINGS | HAS_SKIN_COLOR | HAS_ALT_HEADS | TAIL_WAGGING
dietflags = DIET_CARN
taste_sensitivity = TASTE_SENSITIVITY_SHARP
cold_level_1 = 280 //Default 260 - Lower is better
cold_level_2 = 220 //Default 200
@@ -110,7 +111,7 @@
name_plural = "Ash Walkers"
blurb = "These reptillian creatures appear to be related to the Unathi, but seem significantly less evolved. \
They roam the wastes of Lavaland, worshipping a dead city and capturing unsuspecting miners."
They roam the wastes of Lavaland, worshipping a dead city and capturing unsuspecting miners."
language = "Sinta'unathi"
default_language = "Sinta'unathi"
+1 -1
View File
@@ -253,7 +253,7 @@
continue
if(times_fired % 3 == 1)
M.adjustBruteLoss(5)
nutrition += 10
adjust_nutrition(10)
//this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
+1 -1
View File
@@ -427,7 +427,7 @@
radiation = 0
SetDruggy(0)
SetHallucinate(0)
nutrition = NUTRITION_LEVEL_FED + 50
set_nutrition(NUTRITION_LEVEL_FED + 50)
bodytemperature = 310
CureBlind()
CureNearsighted()
+8
View File
@@ -1398,3 +1398,11 @@ var/list/slot_equipment_priority = list( \
suffix = "_8"
S.icon_state = "[initial(S.icon_state)][suffix]"
///Adjust the nutrition of a mob
/mob/proc/adjust_nutrition(change)
nutrition = max(0, nutrition + change)
///Force set the mob nutrition
/mob/proc/set_nutrition(change)
nutrition = max(0, change)
+1 -1
View File
@@ -154,7 +154,7 @@
var/list/babies = list()
for(var/i=1,i<=number,i++)
var/mob/living/carbon/slime/M = new/mob/living/carbon/slime(loc)
M.nutrition = round(nutrition/number)
M.set_nutrition(round(nutrition / number))
step_away(M,src)
babies += M
new_slime = pick(babies)
@@ -171,7 +171,7 @@
if(ishuman(target)) //These rays make plantmen fat.
var/mob/living/carbon/human/H = M
if(IS_PLANT in H.dna.species.species_traits)
H.nutrition = min(H.nutrition+30, NUTRITION_LEVEL_FULL)
H.set_nutrition(min(H.nutrition+30, NUTRITION_LEVEL_FULL))
else if(iscarbon(target))
M.show_message("<span class='notice'>The radiation beam dissipates harmlessly through your body.</span>")
else
@@ -16,7 +16,7 @@
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.can_eat(diet_flags)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients
H.nutrition += nutriment_factor // For hunger and fatness
H.adjust_nutrition(nutriment_factor) // For hunger and fatness
return ..()
/datum/reagent/consumable/nutriment // Pure nutriment, universally digestable and thus slightly less effective
@@ -838,13 +838,16 @@
color = "#63DE63"
taste_description = "burned food"
/datum/reagent/questionmark/reaction_mob(mob/living/M, method=TOUCH, volume)
if(method == INGEST)
M.Stun(2, FALSE)
M.Weaken(2, FALSE)
M.update_canmove()
to_chat(M, "<span class='danger'>Ugh! Eating that was a terrible idea!</span>")
M.ForceContractDisease(new /datum/disease/food_poisoning(0))
/datum/reagent/questionmark/reaction_mob(mob/living/carbon/human/H, method = TOUCH, volume)
if(istype(H) && method == INGEST)
if(H.dna.species.taste_sensitivity < TASTE_SENSITIVITY_NO_TASTE) // If you can taste it, then you know how awful it is.
H.Stun(2, FALSE)
H.Weaken(2, FALSE)
H.update_canmove()
to_chat(H, "<span class='danger'>Ugh! Eating that was a terrible idea!</span>")
if(NO_HUNGER in H.dna.species.species_traits) //If you don't eat, then you can't get food poisoning
return
H.ForceContractDisease(new /datum/disease/food_poisoning(0))
/datum/reagent/msg
name = "Monosodium glutamate"
@@ -874,8 +874,8 @@
to_chat(M, "<span class='warning'>Your stomach grumbles painfully!</span>")
else
if(prob(60))
var/fat_to_burn = max(round(M.nutrition/100,1), 5)
M.nutrition = max(0, M.nutrition-fat_to_burn)
var/fat_to_burn = max(round(M.nutrition / 100, 1), 5)
M.adjust_nutrition(-fat_to_burn)
M.overeatduration = 0
return ..() | update_flags
@@ -151,7 +151,7 @@
return
M.docile = 1
M.nutrition = 700
M.set_nutrition(700)
to_chat(M, "<span class='warning'>You absorb the potion and feel your intense desire to feed melt away.</span>")
to_chat(user, "<span class='notice'>You feed the slime the potion, removing its hunger and calming it.</span>")
being_used = 1
+2 -2
View File
@@ -337,11 +337,11 @@
break
A.charging = 1
if(A.cell.charge >= 500)
H.nutrition += 50
H.adjust_nutrition(50)
A.cell.charge -= 500
to_chat(H, "<span class='notice'>You siphon off some of the stored charge for your own use.</span>")
else
H.nutrition += A.cell.charge/10
H.adjust_nutrition(A.cell.charge * 0.1)
A.cell.charge = 0
to_chat(H, "<span class='notice'>You siphon off the last of \the [A]'s charge.</span>")
break
@@ -229,7 +229,7 @@
if(owner.nutrition <= hunger_threshold)
synthesizing = 1
to_chat(owner, "<span class='notice'>You feel less hungry...</span>")
owner.nutrition += 50
owner.adjust_nutrition(50)
spawn(50)
synthesizing = 0
@@ -285,7 +285,7 @@
/obj/item/organ/internal/honktumor/cursed/on_life() //No matter what you do, no matter who you are, no matter where you go, you're always going to be a fat, stuttering dimwit.
..()
owner.setBrainLoss(80)
owner.nutrition = 9000
owner.set_nutrition(9000)
owner.overeatduration = 9000
@@ -41,7 +41,7 @@
owner.visible_message("<span class='notice'>[owner] fades to dark.</span>")
return
owner.nutrition = max(owner.nutrition - KIDAN_LANTERN_HUNGERCOST, KIDAN_LANTERN_HUNGERCOST)
owner.set_nutrition(max(owner.nutrition - KIDAN_LANTERN_HUNGERCOST, KIDAN_LANTERN_HUNGERCOST))
var/new_light = calculate_glow(KIDAN_LANTERN_LIGHT)