diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 614cee7d234..740dfdc5e51 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1923,3 +1923,10 @@ var/mob/dview/dview_mob = new shift = list("x" = -amount_x, "y" = -amount_y) return shift + +//Return a list of atoms in a location of a given type. Can be refined to look for pixel-shift. +/proc/get_atoms_of_type_here(var/atom/here, var/type, var/p_x = 0, var/p_y = 0) + . = list() + for(var/atom/thing in here) + if(istype(thing, type) && (p_x && thing.pixel_x == p_x) && (p_y && thing.pixel_y == p_y)) + . += thing diff --git a/code/game/objects/effects/decals/Cleanable/aliens.dm b/code/game/objects/effects/decals/Cleanable/aliens.dm index a3c2bc2c649..9e84f52a959 100644 --- a/code/game/objects/effects/decals/Cleanable/aliens.dm +++ b/code/game/objects/effects/decals/Cleanable/aliens.dm @@ -6,6 +6,11 @@ bloodiness = MAX_SHOE_BLOODINESS blood_state = BLOOD_STATE_XENO + +/obj/effect/decal/cleanable/blood/xeno/splatter + random_icon_states = list("mgibbl1", "mgibbl2", "mgibbl3", "mgibbl4", "mgibbl5") + amount = 2 + /obj/effect/decal/cleanable/blood/gibs/xeno name = "xeno gibs" desc = "Gnarly..." diff --git a/code/game/objects/effects/decals/Cleanable/robots.dm b/code/game/objects/effects/decals/Cleanable/robots.dm index a3582ef0874..5bce827604c 100644 --- a/code/game/objects/effects/decals/Cleanable/robots.dm +++ b/code/game/objects/effects/decals/Cleanable/robots.dm @@ -58,4 +58,4 @@ /obj/effect/decal/cleanable/blood/oil/streak random_icon_states = list("mgibbl1", "mgibbl2", "mgibbl3", "mgibbl4", "mgibbl5") - amount = 2 \ No newline at end of file + amount = 2 diff --git a/code/modules/surgery/organs/blood.dm b/code/modules/surgery/organs/blood.dm index bc19b6c6159..e7b2156c605 100644 --- a/code/modules/surgery/organs/blood.dm +++ b/code/modules/surgery/organs/blood.dm @@ -260,11 +260,14 @@ return // Find a blood decal or create a new one. - var/obj/effect/decal/cleanable/blood/B - if(!(locate(B) in T) || pixel_x || pixel_y) - B = new /obj/effect/decal/cleanable/blood/splatter(T) - else - B = locate() in T + var/obj/effect/decal/cleanable/blood/splatter/B = locate() in T + var/list/bloods = get_atoms_of_type_here(T, B, 0, 0) //Get all the non-projectile-splattered blood on this turf. + if(shift_x || shift_y) + bloods = get_atoms_of_type_here(T, B, shift_x, shift_y) //Get all the projectile-splattered blood at these pixels on this turf. + B = locate() in bloods + if(!B) + B = new(T) + B.transfer_mob_blood_dna(src) //give blood info to the blood decal. if(temp_blood_DNA) B.blood_DNA |= temp_blood_DNA @@ -282,11 +285,15 @@ /mob/living/carbon/alien/add_splatter_floor(turf/T, small_drip, shift_x, shift_y) if(!T) T = get_turf(src) - var/obj/effect/decal/cleanable/blood/xeno/B - if(!(locate(B) in T) || pixel_x || pixel_y) + + var/obj/effect/decal/cleanable/blood/xeno/splatter/B = locate() in T + var/list/bloods = get_atoms_of_type_here(T, B, 0, 0) //The more the better. + if(shift_x || shift_y) + bloods = get_atoms_of_type_here(T, B, shift_x, shift_y) + B = locate() in bloods + if(!B) B = new(T) - else - B = locate() in T + B.blood_DNA["UNKNOWN DNA"] = "X*" B.pixel_x = (shift_x) B.pixel_y = (shift_y) @@ -297,13 +304,17 @@ /mob/living/silicon/robot/add_splatter_floor(turf/T, small_drip, shift_x, shift_y) if(!T) T = get_turf(src) - var/obj/effect/decal/cleanable/blood/oil/B - if(!(locate(B) in T) || pixel_x || pixel_y) - B = new(T) - else - B = locate() in T - B.pixel_x = (shift_x) - B.pixel_y = (shift_y) + + var/obj/effect/decal/cleanable/blood/oil/streak/O = locate() in T + var/list/oils = get_atoms_of_type_here(T, O, 0, 0) //Don't let OSHA catch wind of this. if(shift_x || shift_y) - B.off_floor = TRUE - B.layer = BELOW_MOB_LAYER + oils = get_atoms_of_type_here(T, O, shift_x, shift_y) + O = locate() in oils + if(!O) + O = new(T) + + O.pixel_x = (shift_x) + O.pixel_y = (shift_y) + if(shift_x || shift_y) + O.off_floor = TRUE + O.layer = BELOW_MOB_LAYER