Files
Bubberstation/code/datums/components/rot.dm
SkyratBot f79e91462c [MIRROR] LINDA Reforged (#2573)
* LINDA Reforged

* Update airlock.dm

* Update biohazard_blob_controller.dm

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Azarak <azarak10@gmail.com>
2021-01-08 18:52:35 +01:00

75 lines
2.1 KiB
Plaintext

/datum/component/rot
/// Amount of miasma we're spawning per tick
var/amount = 1
/// Time remaining before we remove the component
var/time_remaining = 5 MINUTES
/datum/component/rot/Initialize(new_amount)
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
if(new_amount)
amount = new_amount
START_PROCESSING(SSprocessing, src)
/datum/component/rot/Destroy(force, silent)
STOP_PROCESSING(SSprocessing, src)
. = ..()
/datum/component/rot/process(delta_time)
var/atom/A = parent
//SSprocessing goes off per 1 second
time_remaining -= delta_time * 1 SECONDS
if(time_remaining <= 0)
qdel(src)
return
var/turf/open/T = get_turf(A)
if(!istype(T) || T.planetary_atmos || T.return_air().return_pressure() > (WARNING_HIGH_PRESSURE - 10))
return
var/datum/gas_mixture/stank = new
ADD_GAS(/datum/gas/miasma, stank.gases)
stank.gases[/datum/gas/miasma][MOLES] = amount * delta_time
stank.temperature = BODYTEMP_NORMAL // otherwise we have gas below 2.7K which will break our lag generator
T.assume_air(stank)
T.air_update_turf(FALSE, FALSE)
/datum/component/rot/corpse
amount = MIASMA_CORPSE_MOLES
time_remaining = 7 MINUTES //2 minutes more to compensate for the delay
/datum/component/rot/corpse/Initialize()
if(!iscarbon(parent))
return COMPONENT_INCOMPATIBLE
. = ..()
/datum/component/rot/corpse/process()
var/mob/living/carbon/C = parent
if(C.stat != DEAD)
qdel(src)
return
// Wait a bit before decaying
if(world.time - C.timeofdeath < 2 MINUTES)
return
// Properly stored corpses shouldn't create miasma
if(istype(C.loc, /obj/structure/closet/crate/coffin)|| istype(C.loc, /obj/structure/closet/body_bag) || istype(C.loc, /obj/structure/bodycontainer))
return
// No decay if formaldehyde in corpse or when the corpse is charred
if(C.reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 15) || HAS_TRAIT(C, TRAIT_HUSK))
return
// Also no decay if corpse chilled or not organic/undead
if(C.bodytemperature <= T0C-10 || !(C.mob_biotypes & (MOB_ORGANIC|MOB_UNDEAD)))
return
..()
/datum/component/rot/gibs
amount = MIASMA_GIBS_MOLES