Make blood generation less garbage

This commit is contained in:
Aronai Sieyes
2020-05-16 16:25:55 -04:00
parent 7061aafbf4
commit 5c268ef2b9
+14 -9
View File
@@ -602,19 +602,24 @@ var/list/global/slot_flags_enumeration = list(
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
return 1 //we applied blood to the item
GLOBAL_LIST_EMPTY(blood_overlays_by_type)
/obj/item/proc/generate_blood_overlay()
// Already got one
if(blood_overlay)
return
// Already cached
if(GLOB.blood_overlays_by_type[type])
blood_overlay = GLOB.blood_overlays_by_type[type]
return
var/icon/I = new /icon(icon, icon_state)
I.Blend(new /icon('icons/effects/blood.dmi', rgb(255,255,255)),ICON_ADD) //fills the icon_state with white (except where it's transparent)
I.Blend(new /icon('icons/effects/blood.dmi', "itemblood"),ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
//not sure if this is worth it. It attaches the blood_overlay to every item of the same type if they don't have one already made.
for(var/obj/item/A in world)
if(A.type == type && !A.blood_overlay)
A.blood_overlay = image(I)
// Firsties!
var/image/blood = image(icon = 'icons/effects/blood.dmi', icon_state = "itemblood") // Needs to be a new one each time since we're slicing it up with filters.
blood.filters += filter(type = "alpha", icon = icon(icon, icon_state)) // Same, this filter is unique for each blood overlay per type
GLOB.blood_overlays_by_type[type] = blood
// And finally
blood_overlay = blood
/obj/item/proc/showoff(mob/user)
for (var/mob/M in view(user))