Checks for blood splatter in the target location properly and avoids creating too many blood atoms.
This commit is contained in:
KasparoVy
2018-01-09 22:02:10 -05:00
parent 0102dc512d
commit f93c148c54
4 changed files with 42 additions and 19 deletions
+7
View File
@@ -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
@@ -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..."
@@ -58,4 +58,4 @@
/obj/effect/decal/cleanable/blood/oil/streak
random_icon_states = list("mgibbl1", "mgibbl2", "mgibbl3", "mgibbl4", "mgibbl5")
amount = 2
amount = 2
+29 -18
View File
@@ -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