nutrition adjustment wrapper procs.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
. = ..()
|
||||
|
||||
@@ -1287,7 +1287,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)
|
||||
|
||||
@@ -35,9 +35,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)
|
||||
@@ -69,8 +67,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"
|
||||
|
||||
@@ -476,7 +476,7 @@
|
||||
if(SSmobs.times_fired%3==1)
|
||||
if(!(M.status_flags & GODMODE))
|
||||
M.adjustBruteLoss(5)
|
||||
nutrition += 10
|
||||
adjust_nutrition(10)
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -449,7 +449,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)
|
||||
|
||||
Reference in New Issue
Block a user