Gibs now rot and generate miasma (#41782)

* Gibs now rot and generate miasma

🆑 coiax
add: Gibs will now rot if not cleaned, and produce small amounts of miasma, approximately
equal to a quarter of a corpse.
/🆑

Miasma is fun. Gives the janitor more of a reason to do work. It will only become
dangerous if you have a lot of gibs in a small space. So better keep those Hopline shutters
open.

* Rot component, for things that rot

* Whoops

* No longer processes, so doesn't need to stop
This commit is contained in:
coiax
2018-12-09 13:29:42 +00:00
committed by yogstation13-bot
parent 5ac80d837e
commit 5c9ca7ff22
5 changed files with 77 additions and 33 deletions

View File

@@ -298,3 +298,6 @@ GLOBAL_LIST_INIT(pipe_paint_colors, list(
"violet" = rgb(64,0,128),
"yellow" = rgb(255,198,0)
))
#define MIASMA_CORPSE_MOLES 0.02
#define MIASMA_GIBS_MOLES 0.005

View File

@@ -0,0 +1,60 @@
/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()
var/atom/A = parent
var/turf/open/T = get_turf(A)
if(!istype(T))
return
var/datum/gas_mixture/air = T.return_air()
var/list/cached_gases = air.gases
ASSERT_GAS(/datum/gas/miasma, air)
cached_gases[/datum/gas/miasma][MOLES] += amount
T.air_update_turf()
/datum/component/rot/corpse
amount = MIASMA_CORPSE_MOLES
/datum/component/rot/corpse/Initialize()
if(!ishuman(parent))
return COMPONENT_INCOMPATIBLE
. = ..()
/datum/component/rot/corpse/process()
var/mob/living/carbon/human/H = parent
if(H.stat != DEAD)
qdel(src)
return
// Wait a bit before decaying
if(world.time - H.timeofdeath < 2 MINUTES)
return
// Properly stored corpses shouldn't create miasma
if(istype(H.loc, /obj/structure/closet/crate/coffin)|| istype(H.loc, /obj/structure/closet/body_bag) || istype(H.loc, /obj/structure/bodycontainer))
return
// No decay if formaldehyde in corpse or when the corpse is charred
if(H.reagents.has_reagent("formaldehyde", 15) || H.has_trait(TRAIT_HUSK))
return
// Also no decay if corpse chilled or not organic/undead
if(H.bodytemperature <= T0C-10 || (!(MOB_ORGANIC in H.mob_biotypes) && !(MOB_UNDEAD in H.mob_biotypes)))
return
..()
/datum/component/rot/gibs
amount = MIASMA_GIBS_MOLES

View File

@@ -54,9 +54,20 @@
random_icon_states = list("gib1", "gib2", "gib3", "gib4", "gib5", "gib6")
mergeable_decal = FALSE
var/already_rotting = FALSE
/obj/effect/decal/cleanable/blood/gibs/Initialize(mapload, list/datum/disease/diseases)
. = ..()
reagents.add_reagent("liquidgibs", 5)
if(already_rotting)
start_rotting(rename=FALSE)
else
addtimer(CALLBACK(src, .proc/start_rotting), 2 MINUTES)
/obj/effect/decal/cleanable/blood/gibs/proc/start_rotting(rename=TRUE)
name = "rotting [initial(name)]"
desc += " It smells terrible."
AddComponent(/datum/component/rot/gibs)
/obj/effect/decal/cleanable/blood/gibs/ex_act(severity, target)
return
@@ -108,6 +119,7 @@
name = "old rotting gibs"
desc = "Space Jesus, why didn't anyone clean this up? It smells terrible."
bloodiness = 0
already_rotting = TRUE
/obj/effect/decal/cleanable/blood/gibs/old/Initialize(mapload, list/datum/disease/diseases)
. = ..()

View File

@@ -33,7 +33,7 @@
if(stat == DEAD)
stop_sound_channel(CHANNEL_HEARTBEAT)
rot()
LoadComponent(/datum/component/rot/corpse)
//Updates the number of stored chemicals for powers
handle_changeling()
@@ -303,38 +303,6 @@
if(!.)
return FALSE //to differentiate between no internals and active, but empty internals
// Make corpses rot, emitting miasma
/mob/living/carbon/proc/rot()
// Properly stored corpses shouldn't create miasma
if(istype(loc, /obj/structure/closet/crate/coffin)|| istype(loc, /obj/structure/closet/body_bag) || istype(loc, /obj/structure/bodycontainer))
return
// No decay if formaldehyde in corpse or when the corpse is charred
if(reagents.has_reagent("formaldehyde", 15) || has_trait(TRAIT_HUSK))
return
// Also no decay if corpse chilled or not organic/undead
if(bodytemperature <= T0C-10 || (!(MOB_ORGANIC in mob_biotypes) && !(MOB_UNDEAD in mob_biotypes)))
return
// Wait a bit before decaying
if(world.time - timeofdeath < 1200)
return
var/deceasedturf = get_turf(src)
// Closed turfs don't have any air in them, so no gas building up
if(!istype(deceasedturf,/turf/open))
return
var/turf/open/miasma_turf = deceasedturf
var/list/cached_gases = miasma_turf.air.gases
ASSERT_GAS(/datum/gas/miasma, miasma_turf.air)
cached_gases[/datum/gas/miasma][MOLES] += 0.02
miasma_turf.air_update_turf()
/mob/living/carbon/proc/handle_blood()
return

View File

@@ -356,6 +356,7 @@
#include "code\datums\components\radioactive.dm"
#include "code\datums\components\remote_materials.dm"
#include "code\datums\components\riding.dm"
#include "code\datums\components\rot.dm"
#include "code\datums\components\rotation.dm"
#include "code\datums\components\signal_redirect.dm"
#include "code\datums\components\slippery.dm"