Files
Bubberstation/code/modules/forensics/forensics_helpers.dm
John Willard b5975bd915 Unit tests now catch decals in walls/space (#75189)
## About The Pull Request

Unit tests will now fail if there's a decal in a wall or open space
turf. Open space turf could be limiting to mappers but I don't think it
makes sense for decals (like dirt, glass shards, etc) to be floating
around in space in the exact same spot.

If there's a decal you want to put in space, decals have a
``turf_loc_check`` var that will bypass this.

**Important note: This is not changing existing behavior. Decals already
delete themselves when they spawn in these incorrect locations, we're
just avoiding them from spawning in the first place.**

### Changes I made

- Ash flora are now lava immune, rivers spawn after flora does, so I
decided that it would be easiest (and more flavorful) to have them be
lava-immune rather than to not have them spawn at all.
- Decals can now be spawned in non-turf locations. This is currently
done by mail, which can give you bones as part of the mail. Currently it
will just delete itself instead.
- Trading Card button is now on the same tile as their display, which
now uses an offset. Before it would spawn it on the tile next to it,
which could be a wall in some instances.
- Mirrors now have floating movement type. They ARE floating since
they're attached to the wall, and it prevents them from burning up due
to lava in the Pride ruin.
- I also added a broken mirror subtype because I thought the icon_state
check was terrible.
- Bubblegum called ``DestroySurroundings`` several times on the same
thing, I hopefully fixed some of that. Their charge ability also
registered ``COMSIG_MOB_STATCHANGE`` despite ``/datum/action`` doing it
by default, so I fixed that too.

## Why It's Good For The Game

Decals in walls is already a bad idea, but currently all it does is
delete it on Initialize. It would be better if we ensured they wouldn't
spawn in the first place.

## Changelog

🆑
fix: Lava will no longer burn 6 of the mirrors in pride ruin
fix: Lava will no longer burn plants that spawn in them.
/🆑
2023-06-15 16:39:22 -07:00

131 lines
4.5 KiB
Plaintext

/// Adds a list of fingerprints to the atom
/atom/proc/add_fingerprint_list(list/fingerprints_to_add) //ASSOC LIST FINGERPRINT = FINGERPRINT
if (isnull(fingerprints_to_add))
return
if (forensics)
forensics.inherit_new(fingerprints = fingerprints_to_add)
else
forensics = new(src, fingerprints = fingerprints_to_add)
return TRUE
/// Adds a single fingerprint to the atom
/atom/proc/add_fingerprint(mob/suspect, ignoregloves = FALSE) //Set ignoregloves to add prints irrespective of the mob having gloves on.
if (QDELING(src))
return
if (isnull(forensics))
forensics = new(src)
forensics.add_fingerprint(suspect, ignoregloves)
return TRUE
/// Add a list of fibers to the atom
/atom/proc/add_fiber_list(list/fibers_to_add) //ASSOC LIST FIBERTEXT = FIBERTEXT
if (isnull(fibers_to_add))
return
if (forensics)
forensics.inherit_new(fibers = fibers_to_add)
else
forensics = new(src, fibers = fibers_to_add)
return TRUE
/// Adds a single fiber to the atom
/atom/proc/add_fibers(mob/living/carbon/human/suspect)
var/old = 0
if(suspect.gloves && istype(suspect.gloves, /obj/item/clothing))
var/obj/item/clothing/gloves/suspect_gloves = suspect.gloves
old = length(GET_ATOM_BLOOD_DNA(suspect_gloves))
if(suspect_gloves.transfer_blood > 1) //bloodied gloves transfer blood to touched objects
if(add_blood_DNA(GET_ATOM_BLOOD_DNA(suspect_gloves)) && GET_ATOM_BLOOD_DNA_LENGTH(suspect_gloves) > old) //only reduces the bloodiness of our gloves if the item wasn't already bloody
suspect_gloves.transfer_blood -= 1
else if(suspect.blood_in_hands > 1)
old = length(GET_ATOM_BLOOD_DNA(suspect))
if(add_blood_DNA(GET_ATOM_BLOOD_DNA(suspect)) && GET_ATOM_BLOOD_DNA_LENGTH(suspect) > old)
suspect.blood_in_hands -= 1
if (isnull(forensics))
forensics = new(src)
forensics.add_fibers(suspect)
return TRUE
/// Adds a list of hiddenprints to the atom
/atom/proc/add_hiddenprint_list(list/hiddenprints_to_add) //NOTE: THIS IS FOR ADMINISTRATION FINGERPRINTS, YOU MUST CUSTOM SET THIS TO INCLUDE CKEY/REAL NAMES! CHECK FORENSICS.DM
if (isnull(hiddenprints_to_add))
return
if (forensics)
forensics.inherit_new(hiddenprints = hiddenprints_to_add)
else
forensics = new(src, hiddenprints = hiddenprints_to_add)
return TRUE
/// Adds a single hiddenprint to the atom
/atom/proc/add_hiddenprint(mob/suspect)
if (isnull(forensics))
forensics = new(src)
forensics.add_hiddenprint(suspect)
return TRUE
/// Adds blood dna to the atom
/atom/proc/add_blood_DNA(list/blood_DNA_to_add) //ASSOC LIST DNA = BLOODTYPE
return FALSE
/obj/add_blood_DNA(list/blood_DNA_to_add)
. = ..()
if (isnull(blood_DNA_to_add))
return .
if (forensics)
forensics.inherit_new(blood_DNA = blood_DNA_to_add)
else
forensics = new(src, blood_DNA = blood_DNA_to_add)
return TRUE
/obj/item/add_blood_DNA(list/blood_DNA_to_add)
if(item_flags & NO_BLOOD_ON_ITEM)
return FALSE
return ..()
/obj/item/clothing/gloves/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
transfer_blood = rand(2, 4)
return ..()
/turf/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
var/obj/effect/decal/cleanable/blood/splatter/blood_splatter = locate() in src
if(!blood_splatter)
blood_splatter = new /obj/effect/decal/cleanable/blood/splatter(src, diseases)
if(!QDELETED(blood_splatter))
blood_splatter.add_blood_DNA(blood_dna) //give blood info to the blood decal.
return TRUE //we bloodied the floor
return FALSE
/turf/closed/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
return FALSE
/mob/living/carbon/human/add_blood_DNA(list/blood_DNA_to_add, list/datum/disease/diseases)
if(wear_suit)
wear_suit.add_blood_DNA(blood_DNA_to_add)
update_worn_oversuit()
else if(w_uniform)
w_uniform.add_blood_DNA(blood_DNA_to_add)
update_worn_undersuit()
if(gloves)
var/obj/item/clothing/gloves/mob_gloves = gloves
mob_gloves.add_blood_DNA(blood_DNA_to_add)
else if(length(blood_DNA_to_add))
if (isnull(forensics))
forensics = new(src)
forensics.inherit_new(blood_DNA = blood_DNA_to_add)
blood_in_hands = rand(2, 4)
update_worn_gloves()
return TRUE
/*
* Transfer all the fingerprints and hidden prints from [src] to [transfer_to].
*/
/atom/proc/transfer_fingerprints_to(atom/transfer_to)
transfer_to.add_fingerprint_list(GET_ATOM_FINGERPRINTS(src))
transfer_to.add_hiddenprint_list(GET_ATOM_HIDDENPRINTS(src))
transfer_to.fingerprintslast = fingerprintslast
/*
* Transfer all the fibers from [src] to [transfer_to].
*/
/atom/proc/transfer_fibers_to(atom/transfer_to)
transfer_to.add_fiber_list(GET_ATOM_FIBRES(src))