Files
Bubberstation/code/datums/elements/basic_body_temp_sensitive.dm
John Willard 9f2d708007 Drunk people no longer feel cold (#81939)
## About The Pull Request

Simple PR, if you're drunk then you no longer feel the effects (or get
the warnings) of cold temperatures.
This makes things like cryosting and the coldness of space give you no
warning or tell of why you're being hurt, but it also means you don't
suffer its slowdown.

## Why It's Good For The Game

It's a small bit of realism that doesn't do much to change the game, but
gives some extra bonus/drawback to alcohol that isn't really changing
the game by any means.

## Changelog

🆑 JohnFulpWillard, Atlasle
balance: You no longer feel cold if you're drunk. You still take damage,
but get no warning or slowdown.
/🆑
2024-03-12 18:00:50 -04:00

73 lines
2.2 KiB
Plaintext

/**
* When attached to a basic mob, it gives it the ability to be hurt by cold/hot body temperatures
*/
/datum/element/basic_body_temp_sensitive
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
///Min body temp
var/min_body_temp = 250
///Max body temp
var/max_body_temp = 350
////Damage when below min temp
var/cold_damage = 1
///Damage when above max temp
var/heat_damage = 1
/datum/element/basic_body_temp_sensitive/Attach(datum/target, min_body_temp, max_body_temp, cold_damage, heat_damage)
. = ..()
if(!isbasicmob(target))
return ELEMENT_INCOMPATIBLE
if(isnum(min_body_temp))
src.min_body_temp = min_body_temp
if(isnum(max_body_temp))
src.max_body_temp = max_body_temp
if(isnum(cold_damage))
src.cold_damage = cold_damage
if(isnum(heat_damage))
src.heat_damage = heat_damage
RegisterSignal(target, COMSIG_LIVING_LIFE, PROC_REF(on_life))
/datum/element/basic_body_temp_sensitive/Detach(datum/source)
if(source)
UnregisterSignal(source, COMSIG_LIVING_LIFE)
return ..()
/datum/element/basic_body_temp_sensitive/proc/on_life(datum/target, seconds_per_tick, times_fired)
SIGNAL_HANDLER
var/mob/living/basic/basic_mob = target
var/gave_alert = FALSE
if(basic_mob.bodytemperature < min_body_temp)
basic_mob.adjust_health(cold_damage * seconds_per_tick)
if(!basic_mob.has_status_effect(/datum/status_effect/inebriated))
switch(cold_damage)
if(1 to 5)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 1)
if(5 to 10)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 2)
if(10 to INFINITY)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 3)
gave_alert = TRUE
else if(basic_mob.bodytemperature > max_body_temp)
basic_mob.adjust_health(heat_damage * seconds_per_tick)
switch(heat_damage)
if(1 to 5)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 1)
if(5 to 10)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 2)
if(10 to INFINITY)
basic_mob.throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 3)
gave_alert = TRUE
if(!gave_alert)
basic_mob.clear_alert(ALERT_TEMPERATURE)