Files
Bubberstation/code/datums/components/rot.dm
SkyratBot 1e705faa19 [MIRROR] Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#709)
* Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#52981)

* Process procs now properly use deltatime when implementing rates, timers and probabilities

* Review fixes

* Geiger counters cleanup

Made hardsuit geiger code more similar to geiger counter code
Geiger counters are more responsive now

* Moved SS*_DT defines to subsystems.dm

* Rebase fix

* Redefined the SS*_DT defines to use the subsystem wait vars

* Implemented suggested changes by @AnturK

* Commented /datum/proc/process about the deltatime stuff

* Send delta_time as a process parameter instead of the defines

Also DTfied acid_processing

* Dtfied new acid component

* Process procs now properly utilize deltatime when implementing rates, timers and probabilities

Co-authored-by: Donkie <daniel.cf.hultgren@gmail.com>
2020-09-09 08:19:23 +02:00

61 lines
1.6 KiB
Plaintext

/datum/component/rot
var/amount = 1
/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/process(delta_time)
var/atom/A = parent
var/turf/open/T = get_turf(A)
if(!istype(T) || 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()
/datum/component/rot/corpse
amount = MIASMA_CORPSE_MOLES
/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.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