Merge pull request #12200 from Ghommie/Ghommie-cit738

nutrition adjustment wrapper procs from tg.
This commit is contained in:
kevinz000
2020-05-12 12:28:02 -07:00
committed by GitHub
40 changed files with 94 additions and 95 deletions
@@ -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)
@@ -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)
+1 -1
View File
@@ -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, "<span class='warning'>You feel satiated as you received a new soul.</span>")
update_hud()
switch(SOULVALUE)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
@@ -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)
. = ..()
@@ -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)
@@ -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)
@@ -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("<span class='userdanger'>The radiation beam singes you!</span>")
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"
+1 -1
View File
@@ -476,7 +476,7 @@
if(SSmobs.times_fired%3==1)
if(!(M.status_flags & GODMODE))
M.adjustBruteLoss(5)
nutrition += 10
adjust_nutrition(10)
/*
+1 -1
View File
@@ -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)
@@ -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++
@@ -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)
@@ -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()
+9 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
@@ -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 ..()
@@ -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
@@ -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////
@@ -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, "<span class='warning'>Your stomach feels empty and cramps!</span>")
else
@@ -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 ..()
@@ -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
@@ -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
@@ -35,7 +35,7 @@ Burning extracts:
S.visible_message("<span class='danger'>A baby slime emerges from [src], and it nuzzles [user] before burbling hungrily!</span>")
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
@@ -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, "<span class='notice'>You feel satiated.</span>")
/obj/item/slimecross/regenerative/bluespace
@@ -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, "<span class='notice'>You activate [src], and your body is refilled with fresh slime jelly!</span>")
return 150
@@ -636,7 +636,7 @@
qdel(src)
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>")
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)
+1 -1
View File
@@ -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
@@ -23,7 +23,7 @@
if(owner.nutrition <= hunger_threshold)
synthesizing = TRUE
to_chat(owner, "<span class='notice'>You feel less hungry...</span>")
owner.nutrition += 50
owner.adjust_nutrition(50)
addtimer(CALLBACK(src, .proc/synth_cool), 50)
/obj/item/organ/cyberimp/chest/nutriment/proc/synth_cool()
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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)
+6 -6
View File
@@ -98,7 +98,7 @@
to_chat(M, "<span class='warning'>[digest_alert_prey]</span>")
M.visible_message("<span class='notice'>You watch as [owner]'s form loses its additions.</span>")
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,"<span class='notice'>You suddenly feel solid again </span>")
to_chat(owner,"<span class='notice'>You feel like a part of you is missing.</span>")
owner.nutrition -= 100
owner.adjust_nutrition(-100)
to_update = TRUE
//because dragons need snowflake guts
+1 -1
View File
@@ -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)