Files
VOREStation/code/modules/mob/living/simple_mob/life.dm
T
SatinIsle aef230a27d Fixed simple mob nutrition notifications (#19010)
Changed the threshold of simple mob nutrition notifications to match those of humans, as these were set to insane percentages previously. For most simple mobs, this means:
- Starving starts at <150 rather than <3000 nutrition
- Feeling hungry starts at <250 rather than <5400 nutrition

Note that the only thing this effects is the little HUD icon showing the hunger bar.
2026-01-12 21:09:16 -08:00

211 lines
5.5 KiB
Plaintext

/mob/living/simple_mob/Life()
..()
//Health
updatehealth()
if(stat >= DEAD)
return FALSE
handle_sleeping()
handle_stunned()
handle_weakened()
handle_paralysed()
handle_supernatural()
handle_special()
handle_guts()
do_healing() //VOREStation Add
return TRUE
//Should we be dead?
/mob/living/simple_mob/updatehealth()
if(SEND_SIGNAL(src, COMSIG_LIVING_HEALTH_UPDATE) & COMSIG_LIVING_HEALTH_UPDATE_GOD_MODE)
health = getMaxHealth()
set_stat(CONSCIOUS)
return
get_injury_level()
health = getMaxHealth() - getFireLoss() - getBruteLoss() - getToxLoss() - getOxyLoss() - getCloneLoss()
//Alive, becoming dead
if((stat < DEAD) && (health <= 0))
death()
//Overhealth
if(health > getMaxHealth())
health = getMaxHealth()
//Update our hud if we have one
if(healths)
if(stat != DEAD)
var/heal_per = (health / getMaxHealth()) * 100
switch(heal_per)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
//Updates the nutrition while we're here
switch(nutrition)
if(250 to INFINITY)
clear_alert("nutrition")
if(150 to 250)
throw_alert("nutrition", /atom/movable/screen/alert/hungry)
if(-INFINITY to 150)
throw_alert("nutrition", /atom/movable/screen/alert/starving)
//VOREStation ADD START - I made this for catslugs but tbh it's probably cool to give to everything.
//Gives all simplemobs passive healing as long as they can find food.
//Slow enough that it should affect combat basically not at all
/mob/living/simple_mob/proc/do_healing()
if(nutrition < 150)
return
if(health == maxHealth)
return
if(heal_countdown > 0)
heal_countdown --
return
if(resting)
if(bruteloss > 0)
adjustBruteLoss(-10)
else if(fireloss > 0)
adjustFireLoss(-10)
nutrition -= 50
heal_countdown = 5
return
if(bruteloss > 0)
adjustBruteLoss(-1)
else if(fireloss > 0)
adjustFireLoss(-1)
nutrition -= 5
heal_countdown = 5
//VOREStation ADD END
// Override for special bullshit.
/mob/living/simple_mob/proc/handle_special()
return
// Handle interacting with and taking damage from atmos
/mob/living/simple_mob/handle_environment(datum/gas_mixture/environment)
if(in_stasis)
return 1 // return early to skip atmos checks
if(is_incorporeal())
return 1
if( abs(environment.temperature - bodytemperature) > temperature_range )
bodytemperature += ((environment.temperature - bodytemperature) / 5)
var/atmos_unsuitable = 0
if(min_oxy && environment.gas[GAS_O2] < min_oxy)
atmos_unsuitable = 1
throw_alert("oxy", /atom/movable/screen/alert/not_enough_oxy)
else if(max_oxy && environment.gas[GAS_O2] > max_oxy)
atmos_unsuitable = 1
throw_alert("oxy", /atom/movable/screen/alert/too_much_oxy)
else
clear_alert("oxy")
if(min_tox && environment.gas[GAS_PHORON] < min_tox)
atmos_unsuitable = 2
throw_alert("tox_in_air", /atom/movable/screen/alert/not_enough_tox)
else if(max_tox && environment.gas[GAS_PHORON] > max_tox)
atmos_unsuitable = 2
throw_alert("tox_in_air", /atom/movable/screen/alert/tox_in_air)
else
clear_alert("tox_in_air")
if(min_n2 && environment.gas[GAS_N2] < min_n2)
atmos_unsuitable = 1
throw_alert("n2o", /atom/movable/screen/alert/not_enough_nitro)
else if(max_n2 && environment.gas[GAS_N2] > max_n2)
atmos_unsuitable = 1
throw_alert("n2o", /atom/movable/screen/alert/too_much_nitro)
else
clear_alert("n2o")
if(min_co2 && environment.gas[GAS_CO2] < min_co2)
atmos_unsuitable = 1
throw_alert("co2", /atom/movable/screen/alert/not_enough_co2)
else if(max_co2 && environment.gas[GAS_CO2] > max_co2)
atmos_unsuitable = 1
throw_alert("co2", /atom/movable/screen/alert/too_much_co2)
else
clear_alert("co2")
if(min_ch4 && environment.gas[GAS_CH4] < min_ch4)
atmos_unsuitable = 2
throw_alert("methane_in_air", /atom/movable/screen/alert/not_enough_methane)
else if(max_tox && environment.gas[GAS_CH4] > max_ch4)
atmos_unsuitable = 2
throw_alert("methane_in_air", /atom/movable/screen/alert/methane_in_air)
else
clear_alert("methane_in_air")
//Atmos effect
if(bodytemperature < minbodytemp)
adjustFireLoss(cold_damage_per_tick)
throw_alert("temp", /atom/movable/screen/alert/cold, COLD_ALERT_SEVERITY_MAX)
else if(bodytemperature > maxbodytemp)
adjustFireLoss(heat_damage_per_tick)
throw_alert("temp", /atom/movable/screen/alert/hot, HOT_ALERT_SEVERITY_MAX)
else
clear_alert("temp")
if(atmos_unsuitable)
adjustOxyLoss(unsuitable_atoms_damage)
else
adjustOxyLoss(-unsuitable_atoms_damage)
/mob/living/simple_mob/proc/handle_guts()
for(var/obj/item/organ/OR in internal_organs)
OR.process()
for(var/obj/item/organ/OR in organs)
OR.process()
/mob/living/simple_mob/proc/handle_supernatural()
if(purge)
purge -= 1
/mob/living/simple_mob/
var/update_icon_timer
/mob/living/simple_mob/death(gibbed, deathmessage = "dies!")
density = FALSE //We don't block even if we did before
if(has_eye_glow)
remove_eyes()
if(loot_list.len) //Drop any loot
for(var/path in loot_list)
if(prob(loot_list[path]))
new path(get_turf(src))
update_icon_timer = addtimer(CALLBACK(src, PROC_REF(callback_update_icon)), 3, TIMER_STOPPABLE)
return ..(gibbed,deathmessage)
/mob/living/simple_mob/proc/callback_update_icon()
update_icon()
/mob/living/simple_mob/Destroy()
deltimer(update_icon_timer)
update_icon_timer = null
. = ..()