diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 59afe163b4..787704e848 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -126,7 +126,7 @@ var/datum/reagent/R = E M.reagents.remove_reagent(R.type, actual_power) if(food_conversion) - M.nutrition += 0.3 + M.adjust_nutrition(0.3) if(prob(2)) to_chat(M, "You feel a mild warmth as your blood purifies itself.") return 1 @@ -164,7 +164,7 @@ C.reagents.metabolize(C, can_overdose=TRUE) C.overeatduration = max(C.overeatduration - 2, 0) var/lost_nutrition = 9 - (reduced_hunger * 5) - C.nutrition = max(C.nutrition - (lost_nutrition * HUNGER_FACTOR), 0) //Hunger depletes at 10x the normal speed + C.adjust_nutrition(-lost_nutrition * HUNGER_FACTOR) //Hunger depletes at 10x the normal speed if(prob(2)) to_chat(C, "You feel an odd gurgle in your stomach, as if it was working much faster than normal.") return 1 @@ -454,7 +454,7 @@ "Transmission 6" = "Additionally heals cellular damage and toxin lovers.", "Resistance 7" = "Increases healing speed.", ) - + /datum/symptom/heal/radiation/Start(datum/disease/advance/A) if(!..()) return diff --git a/code/datums/diseases/advance/symptoms/weight.dm b/code/datums/diseases/advance/symptoms/weight.dm index 5eab698750..bb0d9bdcf9 100644 --- a/code/datums/diseases/advance/symptoms/weight.dm +++ b/code/datums/diseases/advance/symptoms/weight.dm @@ -50,4 +50,4 @@ Bonus else to_chat(M, "[pick("So hungry...", "You'd kill someone for a bite of food...", "Hunger cramps seize you...")]") M.overeatduration = max(M.overeatduration - 100, 0) - M.nutrition = max(M.nutrition - 100, 0) \ No newline at end of file + M.adjust_nutrition(-100) \ No newline at end of file diff --git a/code/datums/diseases/tuberculosis.dm b/code/datums/diseases/tuberculosis.dm index 23902603ce..f59a19c7a3 100644 --- a/code/datums/diseases/tuberculosis.dm +++ b/code/datums/diseases/tuberculosis.dm @@ -52,7 +52,7 @@ if(prob(3)) to_chat(affected_mob, "[pick("Your stomach silently rumbles...", "Your stomach seizes up and falls limp, muscles dead and lifeless.", "You could eat a crayon")]") affected_mob.overeatduration = max(affected_mob.overeatduration - 100, 0) - affected_mob.nutrition = max(affected_mob.nutrition - 100, 0) + affected_mob.adjust_nutrition(-100) if(prob(15)) to_chat(affected_mob, "[pick("You feel uncomfortably hot...", "You feel like unzipping your jumpsuit", "You feel like taking off some clothes...")]") affected_mob.adjust_bodytemperature(40) diff --git a/code/game/machinery/computer/arcade/orion_trail.dm b/code/game/machinery/computer/arcade/orion_trail.dm index 2304312953..8b81c69ed2 100644 --- a/code/game/machinery/computer/arcade/orion_trail.dm +++ b/code/game/machinery/computer/arcade/orion_trail.dm @@ -117,7 +117,7 @@ if(food <= 0) dat += "
You ran out of food and starved." if(obj_flags & EMAGGED) - user.nutrition = 0 //yeah you pretty hongry + user.set_nutrition(0) //yeah you pretty hongry to_chat(user, "Your body instantly contracts to that of one who has not eaten in months. Agonizing cramps seize you as you fall to the floor.") if(fuel <= 0) dat += "
You ran out of fuel, and drift, slowly, into a star." diff --git a/code/game/objects/effects/decals/cleanable/misc.dm b/code/game/objects/effects/decals/cleanable/misc.dm index 910c4f4609..e06c172519 100644 --- a/code/game/objects/effects/decals/cleanable/misc.dm +++ b/code/game/objects/effects/decals/cleanable/misc.dm @@ -133,7 +133,7 @@ if(reagents) for(var/datum/reagent/consumable/R in reagents.reagent_list) if(R.nutriment_factor > 0) - H.nutrition += R.nutriment_factor * R.volume + H.adjust_nutrition(R.nutriment_factor * R.volume) reagents.del_reagent(R.type) reagents.trans_to(H, reagents.total_volume) qdel(src) diff --git a/code/game/objects/items/granters.dm b/code/game/objects/items/granters.dm index 0a705df91c..bafffa18e3 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -249,10 +249,8 @@ /obj/item/book/granter/spell/smoke/recoil(mob/user) ..() to_chat(user,"Your stomach rumbles...") - if(user.nutrition) - user.nutrition = 200 - if(user.nutrition <= 0) - user.nutrition = 0 + if(user.nutrition > NUTRITION_LEVEL_STARVING + 50) + user.set_nutrition(NUTRITION_LEVEL_STARVING + 50) /obj/item/book/granter/spell/blind spell = /obj/effect/proc_holder/spell/targeted/trigger/blind diff --git a/code/modules/antagonists/bloodsucker/bloodsucker_life.dm b/code/modules/antagonists/bloodsucker/bloodsucker_life.dm index 1867be1594..8425309b6c 100644 --- a/code/modules/antagonists/bloodsucker/bloodsucker_life.dm +++ b/code/modules/antagonists/bloodsucker/bloodsucker_life.dm @@ -177,7 +177,7 @@ if(owner.current.blood_volume < BLOOD_VOLUME_BAD / 2) owner.current.blur_eyes(8 - 8 * (owner.current.blood_volume / BLOOD_VOLUME_BAD)) // Nutrition - owner.current.nutrition = clamp(owner.current.blood_volume, 545, 0) //The amount of blood is how full we are. + owner.current.set_nutrition(min(owner.current.blood_volume, NUTRITION_LEVEL_FULL)) //The amount of blood is how full we are. //A bit higher regeneration based on blood volume if(owner.current.blood_volume < 700) additional_regen = 0.4 @@ -331,7 +331,7 @@ return var/mob/living/carbon/C = owner.current // Remove Nutrition, Give Bad Food - C.nutrition -= food_nutrition + C.adjust_nutrition(-food_nutrition) foodInGut += food_nutrition // Already ate some bad clams? Then we can back out, because we're already sick from it. if(foodInGut != food_nutrition) diff --git a/code/modules/antagonists/changeling/powers/absorb.dm b/code/modules/antagonists/changeling/powers/absorb.dm index 2d5b38a456..3e2ff6f3dd 100644 --- a/code/modules/antagonists/changeling/powers/absorb.dm +++ b/code/modules/antagonists/changeling/powers/absorb.dm @@ -59,7 +59,7 @@ changeling.trueabsorbs++ if(user.nutrition < NUTRITION_LEVEL_WELL_FED) - user.nutrition = min((user.nutrition + target.nutrition), NUTRITION_LEVEL_WELL_FED) + user.adjust_nutrition(target.nutrition, NUTRITION_LEVEL_WELL_FED) // Absorb a lizard, speak Draconic. user.copy_languages(target, LANGUAGE_ABSORB) diff --git a/code/modules/antagonists/devil/devil.dm b/code/modules/antagonists/devil/devil.dm index e20203d9e6..c12259778e 100644 --- a/code/modules/antagonists/devil/devil.dm +++ b/code/modules/antagonists/devil/devil.dm @@ -183,7 +183,7 @@ GLOBAL_LIST_INIT(devil_suffix, list(" the Red", " the Soulless", " the Master", if(soulsOwned.Find(soul)) return soulsOwned += soul - owner.current.nutrition = NUTRITION_LEVEL_FULL + owner.current.set_nutrition(NUTRITION_LEVEL_FULL) to_chat(owner.current, "You feel satiated as you received a new soul.") update_hud() switch(SOULVALUE) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 41f2c7142f..a5275f677d 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -59,7 +59,7 @@ nutrition_ratio *= 1.2 if(satiety > 80) nutrition_ratio *= 1.25 - nutrition = max(0, nutrition - nutrition_ratio * HUNGER_FACTOR) + adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR) blood_volume = min((BLOOD_VOLUME_NORMAL * blood_ratio), blood_volume + 0.5 * nutrition_ratio) //Effects of bloodloss diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 821b432ea5..f694890b95 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -520,7 +520,7 @@ playsound(get_turf(src), 'sound/effects/splat.ogg', 50, 1) var/turf/T = get_turf(src) if(!blood) - nutrition -= lost_nutrition + adjust_nutrition(-lost_nutrition) adjustToxLoss(-3) for(var/i=0 to distance) if(blood) diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm index fa060d8b34..cc390b9329 100644 --- a/code/modules/mob/living/carbon/carbon_movement.dm +++ b/code/modules/mob/living/carbon/carbon_movement.dm @@ -24,11 +24,12 @@ . = ..() if(. && (movement_type & FLOATING)) //floating is easy if(HAS_TRAIT(src, TRAIT_NOHUNGER)) - nutrition = NUTRITION_LEVEL_FED - 1 //just less than feeling vigorous + set_nutrition(NUTRITION_LEVEL_FED - 1) //just less than feeling vigorous else if(nutrition && stat != DEAD) - nutrition -= HUNGER_FACTOR/10 + var/loss = HUNGER_FACTOR/10 if(m_intent == MOVE_INTENT_RUN) - nutrition -= HUNGER_FACTOR/10 + loss *= 2 + adjust_nutrition(loss) /mob/living/carbon/can_move_under_living(mob/living/other) . = ..() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index ef18a75b33..7444216f4b 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1288,7 +1288,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) H.Jitter(5) hunger_rate = 3 * HUNGER_FACTOR hunger_rate *= H.physiology.hunger_mod - H.nutrition = max(0, H.nutrition - hunger_rate) + H.adjust_nutrition(-hunger_rate) if (H.nutrition > NUTRITION_LEVEL_FULL) diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 7a5e347060..81132080ab 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -293,9 +293,7 @@ if(isturf(H.loc)) //else, there's considered to be no light var/turf/T = H.loc light_amount = min(1,T.get_lumcount()) - 0.5 - H.nutrition += light_amount * 10 - if(H.nutrition > NUTRITION_LEVEL_FULL) - H.nutrition = NUTRITION_LEVEL_FULL + H.adjust_nutrition(light_amount * 10, NUTRITION_LEVEL_FULL) if(light_amount > 0.2) //if there's enough light, heal H.heal_overall_damage(1,1) H.adjustToxLoss(-1) diff --git a/code/modules/mob/living/carbon/human/species_types/podpeople.dm b/code/modules/mob/living/carbon/human/species_types/podpeople.dm index a8b9bbfc8f..fd958ccc13 100644 --- a/code/modules/mob/living/carbon/human/species_types/podpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/podpeople.dm @@ -36,9 +36,7 @@ if(isturf(H.loc)) //else, there's considered to be no light var/turf/T = H.loc light_amount = min(1,T.get_lumcount()) - 0.5 - H.nutrition += light_amount * light_nutrition_gain_factor - if(H.nutrition >= NUTRITION_LEVEL_FULL) - H.nutrition = NUTRITION_LEVEL_FULL - 1 + H.adjust_nutrition(light_amount * light_nutrition_gain_factor, NUTRITION_LEVEL_FULL) if(light_amount > 0.2) //if there's enough light, heal H.heal_overall_damage(light_bruteheal, light_burnheal) H.adjustToxLoss(-light_toxheal) @@ -70,8 +68,7 @@ H.adjustFireLoss(rand(5,15)) H.show_message("The radiation beam singes you!") if(/obj/item/projectile/energy/florayield) - H.nutrition = min(H.nutrition+30, NUTRITION_LEVEL_FULL) - + H.adjust_nutrition(30, NUTRITION_LEVEL_FULL) /datum/species/pod/pseudo_weak name = "Anthromorphic Plant" diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 00a0991e19..d509b25216 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -476,7 +476,7 @@ if(SSmobs.times_fired%3==1) if(!(M.status_flags & GODMODE)) M.adjustBruteLoss(5) - nutrition += 10 + adjust_nutrition(10) /* diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index db5771f75e..ced9fa3200 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -563,7 +563,7 @@ SetAllImmobility(0, FALSE) SetSleeping(0, FALSE) radiation = 0 - nutrition = NUTRITION_LEVEL_FED + 50 + set_nutrition(NUTRITION_LEVEL_FED + 50) bodytemperature = BODYTEMP_NORMAL set_blindness(0) set_blurriness(0) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 4b89d96e64..08a5f0a2c9 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -232,7 +232,7 @@ Feedstop(0, 0) return - add_nutrition((rand(7, 15) * CONFIG_GET(number/damage_multiplier))) + adjust_nutrition((rand(7, 15) * CONFIG_GET(number/damage_multiplier)), get_max_nutrition(), TRUE) //Heal yourself. adjustBruteLoss(-3) @@ -244,15 +244,13 @@ return if(prob(15)) - nutrition -= 1 + is_adult + adjust_nutrition(-1 - is_adult) - if(nutrition <= 0) - nutrition = 0 - if(prob(75)) - adjustBruteLoss(rand(0,5)) + if(nutrition <= 0 && prob(75)) + adjustBruteLoss(rand(0,5)) else if (nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD) - nutrition -= 20 + adjust_nutrition(-20) amount_grown++ update_action_buttons_icon() @@ -262,9 +260,11 @@ else Evolve() -/mob/living/simple_animal/slime/proc/add_nutrition(nutrition_to_add = 0) - nutrition = min((nutrition + nutrition_to_add), get_max_nutrition()) - if(nutrition >= get_grow_nutrition()) +/mob/living/simple_animal/slime/adjust_nutrition(change, max = INFINITY, slime_check = FALSE) + . = ..() + if(!slime_check) + return + if(nutrition == max) if(powerlevel<10) if(prob(30-powerlevel*2)) powerlevel++ diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index d5da6d76fc..0c7f126ad5 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -184,7 +184,7 @@ var/mob/living/simple_animal/slime/M M = new(loc, child_colour) if(ckey) - M.nutrition = new_nutrition //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature! + M.set_nutrition(new_nutrition) //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature! M.powerlevel = new_powerlevel if(i != 1) step_away(M,src) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 78f7b17616..1c5916a249 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -27,6 +27,7 @@ healable = 0 gender = NEUTER blood_volume = 0 //Until someome reworks for them to have slime jelly + nutrition = 700 see_in_dark = 8 @@ -102,7 +103,6 @@ create_reagents(100, NONE, NO_REAGENTS_VALUE) set_colour(new_colour) . = ..() - nutrition = 700 /mob/living/simple_animal/slime/Destroy() for (var/A in actions) @@ -267,8 +267,8 @@ return attacked += 5 if(nutrition >= 100) //steal some nutrition. negval handled in life() - nutrition -= (50 + (40 * M.is_adult)) - M.add_nutrition(50 + (40 * M.is_adult)) + adjust_nutrition(-50 - (40 * M.is_adult)) + M.adjust_nutrition(50 + (40 * M.is_adult), get_max_nutrition(), TRUE) if(health > 0) M.adjustBruteLoss(-10 + (-10 * M.is_adult)) M.updatehealth() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ce3b8bf3d2..6e4bd534af 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -35,7 +35,7 @@ continue var/datum/atom_hud/alternate_appearance/AA = v AA.onNewMob(src) - nutrition = rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX) + set_nutrition(rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX)) . = ..() update_config_movespeed() update_movespeed(TRUE) @@ -1023,6 +1023,14 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) var/datum/language_holder/H = get_language_holder() H.open_language_menu(usr) +///Adjust the nutrition of a mob +/mob/proc/adjust_nutrition(change, max = INFINITY) //Honestly FUCK the oldcoders for putting nutrition on /mob someone else can move it up because holy hell I'd have to fix SO many typechecks + nutrition = clamp(0, nutrition + change, max) + +///Force set the mob nutrition +/mob/proc/set_nutrition(var/change) //Seriously fuck you oldcoders. + nutrition = max(0, change) + /mob/setMovetype(newval) . = ..() update_movespeed(FALSE) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 133fcfc1bf..56ec5bb816 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -450,7 +450,7 @@ var/list/babies = list() for(var/i=1,i<=number,i++) var/mob/living/simple_animal/slime/M = new/mob/living/simple_animal/slime(loc) - M.nutrition = round(nutrition/number) + M.set_nutrition(round(nutrition/number)) step_away(M,src) babies += M new_slime = pick(babies) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 464557f617..b22f34091f 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1834,7 +1834,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/fernet/on_mob_life(mob/living/carbon/M) if(M.nutrition <= NUTRITION_LEVEL_STARVING) M.adjustToxLoss(1*REM, 0) - M.nutrition = max(M.nutrition - 5, 0) + M.adjust_nutrition(-5) M.overeatduration = 0 return ..() @@ -1852,7 +1852,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/fernet_cola/on_mob_life(mob/living/carbon/M) if(M.nutrition <= NUTRITION_LEVEL_STARVING) M.adjustToxLoss(0.5*REM, 0) - M.nutrition = max(M.nutrition - 3, 0) + M.adjust_nutrition(-3) M.overeatduration = 0 return ..() @@ -1868,7 +1868,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_desc = "A glass of Fanciulli. It's just Manhattan with Fernet." /datum/reagent/consumable/ethanol/fanciulli/on_mob_life(mob/living/carbon/M) - M.nutrition = max(M.nutrition - 5, 0) + M.adjust_nutrition(-5) M.overeatduration = 0 return ..() diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index 62aea28009..b157f328c5 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -692,9 +692,8 @@ M.adjustFireLoss(-0.5, 0) M.adjustToxLoss(-0.5, 0) M.adjustOxyLoss(-0.5, 0) - if(M.nutrition && (M.nutrition - 2 > 0)) - if(!(M.mind && M.mind.assigned_role == "Medical Doctor")) //Drains the nutrition of the holder. Not medical doctors though, since it's the Doctor's Delight! - M.nutrition -= 2 + if(!(M.mind && M.mind.assigned_role == "Medical Doctor")) //Drains the nutrition of the holder. Not medical doctors though, since it's the Doctor's Delight! + M.adjust_nutrition(-2) ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index c7ff3f01c9..0e0056f958 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -13,11 +13,12 @@ taste_mult = 4 value = REAGENT_VALUE_VERY_COMMON var/nutriment_factor = 1 * REAGENTS_METABOLISM + var/max_nutrition = INFINITY var/quality = 0 //affects mood, typically higher for mixed drinks with more complex recipes /datum/reagent/consumable/on_mob_life(mob/living/carbon/M) current_cycle++ - M.nutrition += nutriment_factor + M.adjust_nutrition(nutriment_factor, max_nutrition) M.CheckBloodsuckerEatFood(nutriment_factor) holder.remove_reagent(type, metabolization_rate) @@ -694,13 +695,10 @@ description = "A bioengineered protien-nutrient structure designed to decompose in high saturation. In layman's terms, it won't get you fat." reagent_state = SOLID nutriment_factor = 12 * REAGENTS_METABOLISM + max_nutrition = NUTRITION_LEVEL_FULL - 25 color = "#664330" // rgb: 102, 67, 48 value = REAGENT_VALUE_RARE -/datum/reagent/consumable/nutriment/stabilized/on_mob_life(mob/living/carbon/M) - if(M.nutrition > NUTRITION_LEVEL_FULL - 25) - M.nutrition -= 3*nutriment_factor - ..() ////Lavaland Flora Reagents//// diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index e4973dd2d5..416cc0b2bd 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -413,7 +413,7 @@ datum/reagent/medicine/styptic_powder/overdose_start(mob/living/M) /datum/reagent/medicine/mine_salve/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1) if(iscarbon(M) && M.stat != DEAD) if(method in list(INGEST, VAPOR, INJECT)) - M.nutrition -= 5 + M.adjust_nutrition(-5) if(show_message) to_chat(M, "Your stomach feels empty and cramps!") else diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 3169d2d3aa..141367c9d9 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -675,7 +675,7 @@ /datum/reagent/toxin/lipolicide/on_mob_life(mob/living/carbon/M) if(M.nutrition <= NUTRITION_LEVEL_STARVING) M.adjustToxLoss(1*REM, 0) - M.nutrition = max(M.nutrition - 3, 0) // making the chef more valuable, one meme trap at a time + M.adjust_nutrition(-3) // making the chef more valuable, one meme trap at a time M.overeatduration = 0 return ..() diff --git a/code/modules/research/nanites/nanite_programs/utility.dm b/code/modules/research/nanites/nanite_programs/utility.dm index 71aa5bf09a..ebe623d73d 100644 --- a/code/modules/research/nanites/nanite_programs/utility.dm +++ b/code/modules/research/nanites/nanite_programs/utility.dm @@ -144,7 +144,7 @@ return ..() /datum/nanite_program/metabolic_synthesis/active_effect() - host_mob.nutrition -= 0.5 + host_mob.adjust_nutrition(-0.5) nanites.adjust_nanites(src, 0.5) /datum/nanite_program/research diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index 16263928c4..ed43576a61 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -917,7 +917,7 @@ datum/status_effect/stabilized/blue/on_remove() healing_types += CLONE if(length(healing_types)) owner.apply_damage_type(-heal_amount, damagetype=pick(healing_types)) - owner.nutrition += 3 + owner.adjust_nutrition(3) M.adjustCloneLoss(heal_amount * 1.2) //This way, two people can't just convert each other's damage away. else messagedelivered = FALSE diff --git a/code/modules/research/xenobiology/crossbreeding/burning.dm b/code/modules/research/xenobiology/crossbreeding/burning.dm index 48e6f720b0..7b5004e722 100644 --- a/code/modules/research/xenobiology/crossbreeding/burning.dm +++ b/code/modules/research/xenobiology/crossbreeding/burning.dm @@ -35,7 +35,7 @@ Burning extracts: S.visible_message("A baby slime emerges from [src], and it nuzzles [user] before burbling hungrily!") S.Friends[user] = 20 //Gas, gas, gas S.bodytemperature = T0C + 400 //We gonna step on the gas. - S.nutrition = S.get_hunger_nutrition() //Tonight, we fight! + S.set_nutrition(S.get_hunger_nutrition()) //Tonight, we fight! ..() /obj/item/slimecross/burning/orange diff --git a/code/modules/research/xenobiology/crossbreeding/regenerative.dm b/code/modules/research/xenobiology/crossbreeding/regenerative.dm index b33cee3a64..6b2b0b458c 100644 --- a/code/modules/research/xenobiology/crossbreeding/regenerative.dm +++ b/code/modules/research/xenobiology/crossbreeding/regenerative.dm @@ -128,7 +128,7 @@ Regenerative extracts: colour = "silver" /obj/item/slimecross/regenerative/silver/core_effect(mob/living/target, mob/user) - target.nutrition = NUTRITION_LEVEL_FULL - 1 + target.set_nutrition(NUTRITION_LEVEL_FULL - 1) to_chat(target, "You feel satiated.") /obj/item/slimecross/regenerative/bluespace diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 65e1f80ed0..bc78e3ab1a 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -186,7 +186,7 @@ /obj/item/slime_extract/purple/activate(mob/living/carbon/human/user, datum/species/jelly/luminescent/species, activation_type) switch(activation_type) if(SLIME_ACTIVATE_MINOR) - user.nutrition += 50 + user.adjust_nutrition(50) user.blood_volume += 50 to_chat(user, "You activate [src], and your body is refilled with fresh slime jelly!") return 150 @@ -636,7 +636,7 @@ qdel(src) return M.docile = 1 - M.nutrition = 700 + M.set_nutrition(700) to_chat(M, "You absorb the potion and feel your intense desire to feed melt away.") to_chat(user, "You feed the slime the potion, removing its hunger and calming it.") var/newname = reject_bad_name(stripped_input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime", MAX_NAME_LEN), TRUE) diff --git a/code/modules/surgery/lipoplasty.dm b/code/modules/surgery/lipoplasty.dm index 63e828d3c9..5a0fd819f1 100644 --- a/code/modules/surgery/lipoplasty.dm +++ b/code/modules/surgery/lipoplasty.dm @@ -40,7 +40,7 @@ "[user] extracts [target]'s fat!") target.overeatduration = 0 //patient is unfatted var/removednutriment = target.nutrition - target.nutrition = NUTRITION_LEVEL_WELL_FED + target.set_nutrition(NUTRITION_LEVEL_WELL_FED) removednutriment -= 450 //whatever was removed goes into the meat var/mob/living/carbon/human/H = target var/typeofmeat = /obj/item/reagent_containers/food/snacks/meat/slab/human diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 46092ff0c2..fcc3f71b8b 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -23,7 +23,7 @@ if(owner.nutrition <= hunger_threshold) synthesizing = TRUE to_chat(owner, "You feel less hungry...") - owner.nutrition += 50 + owner.adjust_nutrition(50) addtimer(CALLBACK(src, .proc/synth_cool), 50) /obj/item/organ/cyberimp/chest/nutriment/proc/synth_cool() diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 1fee605b12..465c10c4cd 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -221,7 +221,7 @@ obj/item/organ/heart/cybernetic/upgraded/on_life() used_dose() if(ramount < 10) //eats your nutrition to regen epinephrine var/regen_amount = owner.nutrition/2000 - owner.nutrition -= regen_amount + owner.adjust_nutrition(-regen_amount) ramount += regen_amount /obj/item/organ/heart/cybernetic/upgraded/proc/used_dose() diff --git a/code/modules/vore/eating/belly_obj.dm b/code/modules/vore/eating/belly_obj.dm index b188cc0a99..685f8d76bb 100644 --- a/code/modules/vore/eating/belly_obj.dm +++ b/code/modules/vore/eating/belly_obj.dm @@ -512,7 +512,7 @@ if(!digested) items_preserved |= item else -// owner.nutrition += (5 * digested) // haha no. +// owner.adjust_nutrition(5 * digested) // haha no. if(iscyborg(owner)) var/mob/living/silicon/robot/R = owner R.cell.charge += (50 * digested) diff --git a/code/modules/vore/eating/bellymodes.dm b/code/modules/vore/eating/bellymodes.dm index 2caaae401e..77864021b4 100644 --- a/code/modules/vore/eating/bellymodes.dm +++ b/code/modules/vore/eating/bellymodes.dm @@ -98,7 +98,7 @@ to_chat(M, "[digest_alert_prey]") M.visible_message("You watch as [owner]'s form loses its additions.") - owner.nutrition += 400 // so eating dead mobs gives you *something*. + owner.adjust_nutrition(400) // so eating dead mobs gives you *something*. play_sound = pick(pred_death) if(M && M.client && M.client.prefs.cit_toggles & DIGESTION_NOISES) SEND_SOUND(M,prey_death) @@ -112,7 +112,7 @@ // Deal digestion damage (and feed the pred) if(!(M.status_flags & GODMODE)) M.adjustFireLoss(digest_burn) - owner.nutrition += 1 + owner.adjust_nutrition(1) //Contaminate or gurgle items var/obj/item/T = pick(touchable_items) @@ -130,7 +130,7 @@ if(owner.nutrition >= NUTRITION_LEVEL_STARVING && (M.health < M.maxHealth)) M.adjustBruteLoss(-3) M.adjustFireLoss(-3) - owner.nutrition -= 5 + owner.adjust_nutrition(-5) //for when you just want people to squelch around if(DM_NOISY) @@ -155,8 +155,8 @@ if(M.nutrition >= 100) //Drain them until there's no nutrients left. Slowly "absorb" them. var/oldnutrition = (M.nutrition * 0.05) - M.nutrition = (M.nutrition * 0.95) - owner.nutrition += oldnutrition + M.set_nutrition(M.nutrition * 0.95) + owner.adjust_nutrition(oldnutrition) else if(M.nutrition < 100) //When they're finally drained. absorb_living(M) to_update = TRUE @@ -168,7 +168,7 @@ DISABLE_BITFIELD(M.vore_flags, ABSORBED) to_chat(M,"You suddenly feel solid again ") to_chat(owner,"You feel like a part of you is missing.") - owner.nutrition -= 100 + owner.adjust_nutrition(-100) to_update = TRUE //because dragons need snowflake guts diff --git a/code/modules/zombie/items.dm b/code/modules/zombie/items.dm index 0f6ef14cd1..d4d92f54c4 100644 --- a/code/modules/zombie/items.dm +++ b/code/modules/zombie/items.dm @@ -74,4 +74,4 @@ user.adjustCloneLoss(-hp_gained, 0) user.updatehealth() user.adjustOrganLoss(ORGAN_SLOT_BRAIN, -hp_gained) // Zom Bee gibbers "BRAAAAISNSs!1!" - user.nutrition = min(user.nutrition + hp_gained, NUTRITION_LEVEL_FULL) + user.adjust_nutrition(hp_gained, NUTRITION_LEVEL_FULL) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index 277a2e0a79..51b13f8c55 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -113,13 +113,13 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING SM.copy_languages(M, LANGUAGE_MIND) playerClone = TRUE M.next_move_modifier = 1 - M.nutrition -= 500 + M.adjust_nutrition(-500) //Damage the clone SM.blood_volume = (BLOOD_VOLUME_NORMAL*SM.blood_ratio)/2 SM.adjustCloneLoss(60, 0) SM.setOrganLoss(ORGAN_SLOT_BRAIN, 40) - SM.nutrition = startHunger/2 + SM.set_nutrition(startHunger/2) //Transfer remaining reagent to clone. I think around 30u will make a healthy clone, otherwise they'll have clone damage, blood loss, brain damage and hunger. SM.reagents.add_reagent(/datum/reagent/fermi/SDGFheal, volume) @@ -147,23 +147,23 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING if(21) to_chat(M, "You feel the synethic cells rest uncomfortably within your body as they start to pulse and grow rapidly.") if(22 to 29) - M.nutrition = M.nutrition + (M.nutrition/10) + M.adjust_nutrition(M.nutrition/10) if(30) to_chat(M, "You feel the synethic cells grow and expand within yourself, bloating your body outwards.") if(31 to 49) - M.nutrition = M.nutrition + (M.nutrition/5) + M.adjust_nutrition(M.nutrition/5) if(50) to_chat(M, "The synthetic cells begin to merge with your body, it feels like your body is made of a viscous water, making your movements difficult.") M.next_move_modifier += 4//If this makes you fast then please fix it, it should make you slow!! //candidates = pollGhostCandidates("Do you want to play as a clone of [M.name] and do you agree to respect their character and act in a similar manner to them? I swear to god if you diddle them I will be very disapointed in you. ", "FermiClone", null, ROLE_SENTIENCE, 300) // see poll_ignore.dm, should allow admins to ban greifers or bullies if(51 to 79) - M.nutrition = M.nutrition + (M.nutrition/2) + M.adjust_nutrition(M.nutrition/2) if(80) to_chat(M, "The cells begin to precipitate outwards of your body, you feel like you'll split soon...") if (M.nutrition < 20000) - M.nutrition = 20000 //https://www.youtube.com/watch?v=Bj_YLenOlZI + M.set_nutrition(20000) //https://www.youtube.com/watch?v=Bj_YLenOlZI if(86)//Upon splitting, you get really hungry and are capable again. Deletes the chem after you're done. - M.nutrition = 15//YOU BEST BE EATTING AFTER THIS YOU CUTIE + M.set_nutrition(15)//YOU BEST BE EATTING AFTER THIS YOU CUTIE M.next_move_modifier -= 4 to_chat(M, "Your body splits away from the cell clone of yourself, leaving you with a drained and hollow feeling inside.") @@ -204,7 +204,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING M.heal_bodypart_damage(1,1) M.next_move_modifier = 1 if (M.nutrition < 1500) - M.nutrition += 250 + M.adjust_nutrition(250) else if (unitCheck == TRUE && !M.has_status_effect(/datum/status_effect/chem/SGDF))// If they're ingested a little bit (10u minimum), then give them a little healing. unitCheck = FALSE to_chat(M, "the cells fail to hold enough mass to generate a clone, instead diffusing into your system.") @@ -213,7 +213,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING M.blood_volume += 100 M.next_move_modifier = 1 if (M.nutrition < 1500) - M.nutrition += 500 + M.adjust_nutrition(500) /datum/reagent/fermi/SDGF/reaction_mob(mob/living/carbon/human/M, method=TOUCH, reac_volume) if(volume<5) @@ -245,7 +245,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING SM.blood_volume = (BLOOD_VOLUME_NORMAL*SM.blood_ratio)/1.5 SM.adjustCloneLoss((bodydamage/10), 0) SM.setOrganLoss(ORGAN_SLOT_BRAIN, (bodydamage/10)) - SM.nutrition = 400 + SM.adjust_nutrition(400) if(bodydamage>200) SM.gain_trauma_type(BRAIN_TRAUMA_MILD) if(bodydamage>300) @@ -285,7 +285,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING M.blood_volume += 10 M.adjustCloneLoss(-2, 0) M.setOrganLoss(ORGAN_SLOT_BRAIN, -1) - M.nutrition += 10 + M.adjust_nutrition(10) ..() //Unobtainable, used if SDGF is impure but not too impure @@ -318,27 +318,27 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING to_chat(M, "You feel the synethic cells rest uncomfortably within your body as they start to pulse and grow rapidly.") startHunger = M.nutrition if(21 to 29) - M.nutrition = M.nutrition + (M.nutrition/10) + M.adjust_nutrition(M.nutrition/10) if(30) to_chat(M, "You feel the synethic cells grow and expand within yourself, bloating your body outwards.") if(31 to 49) - M.nutrition = M.nutrition + (M.nutrition/5) + M.adjust_nutrition(M.nutrition/5) if(50) to_chat(M, "The synethic cells begin to merge with your body, it feels like your body is made of a viscous water, making your movements difficult.") M.next_move_modifier = 4//If this makes you fast then please fix it, it should make you slow!! if(51 to 73) - M.nutrition = M.nutrition + (M.nutrition/2) + M.adjust_nutrition(M.nutrition/2) if(74) to_chat(M, "The cells begin to precipitate outwards of your body, but... something is wrong, the sythetic cells are beginnning to rot...") if (M.nutrition < 20000) //whoever knows the maxcap, please let me know, this seems a bit low. - M.nutrition = 20000 //https://www.youtube.com/watch?v=Bj_YLenOlZI + M.set_nutrition(20000) //https://www.youtube.com/watch?v=Bj_YLenOlZI if(75 to 85) M.adjustToxLoss(1, 0)// the warning! if(86)//mean clone time! if (!M.reagents.has_reagent(/datum/reagent/medicine/pen_acid))//Counterplay is pent.) message_admins("(non-infectious) SDZF: Zombie spawned at [M] [COORD(M)]!") - M.nutrition = startHunger - 500//YOU BEST BE RUNNING AWAY AFTER THIS YOU BADDIE + M.set_nutrition(startHunger - 500) //YOU BEST BE RUNNING AWAY AFTER THIS YOU BADDIE M.next_move_modifier = 1 to_chat(M, "Your body splits away from the cell clone of yourself, your attempted clone birthing itself violently from you as it begins to shamble around, a terrifying abomination of science.") M.visible_message("[M] suddenly shudders, and splits into a funky smelling copy of themselves!") @@ -354,7 +354,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING else//easier to deal with to_chat(M, "The pentetic acid seems to have stopped the decay for now, clumping up the cells into a horrifying tumour!") - M.nutrition = startHunger - 500 + M.set_nutrition(startHunger - 500) var/mob/living/simple_animal/slime/S = new(get_turf(M.loc),"grey") //TODO: replace slime as own simplemob/add tumour slime cores for science/chemistry interplay S.damage_coeff = list(BRUTE = ((1 / volume)**0.1) , BURN = 2, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) S.name = "Living teratoma" diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/eigentstasium.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/eigentstasium.dm index 28645cdc7b..1500d52b25 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/eigentstasium.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/eigentstasium.dm @@ -94,7 +94,7 @@ to_chat(M, "Your wavefunction feels like it's been ripped in half. You feel empty inside.") log_game("FERMICHEM: [M] ckey: [M.key] has become addicted to eigenstasium") M.Jitter(10) - M.nutrition = M.nutrition - (M.nutrition/15) + M.adjust_nutrition(-M.nutrition/15) ..() /datum/reagent/fermi/eigenstate/addiction_act_stage2(mob/living/M)