Skip to content

Commit 210eefd

Browse files
out-of-phazecomma
authored andcommitted
Fix coating overlay color being shared globally between identical items
1 parent 300690e commit 210eefd

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

code/game/objects/items/__item.dm

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -829,21 +829,19 @@
829829
LAZYSET(blood_DNA, unique_enzymes, blood_type)
830830
return TRUE
831831

832-
var/global/list/_coating_overlay_cache = list()
832+
var/global/list/icon/_coating_overlay_cache = list()
833833
var/global/icon/_item_coating_mask = icon('icons/effects/blood.dmi', "itemblood")
834834
/obj/item/proc/generate_coating_overlay(force = FALSE)
835835
if(coating_overlay && !force)
836836
return
837-
var/cache_key = "[icon]-[icon_state]"
838-
if(global._coating_overlay_cache[cache_key])
839-
coating_overlay = global._coating_overlay_cache[cache_key]
840-
return
841-
var/icon/I = new /icon(icon, icon_state)
842-
I.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) // Sets the icon RGB channel to pure white.
843-
I.Blend(global._item_coating_mask, ICON_MULTIPLY) // Masks the coating overlay against the generated mask.
844-
coating_overlay = image(I)
837+
var/cache_key = "\ref[icon]-[icon_state]" // this needs to use ref because of stringification
838+
if(!global._coating_overlay_cache[cache_key])
839+
var/icon/I = new /icon(icon, icon_state)
840+
I.MapColors(0,0,0, 0,0,0, 0,0,0, 1,1,1) // Sets the icon RGB channel to pure white.
841+
I.Blend(global._item_coating_mask, ICON_MULTIPLY) // Masks the coating overlay against the generated mask.
842+
global._coating_overlay_cache[cache_key] = I
843+
coating_overlay = image(global._coating_overlay_cache[cache_key])
845844
coating_overlay.appearance_flags |= NO_CLIENT_COLOR|RESET_COLOR
846-
global._coating_overlay_cache[cache_key] = coating_overlay
847845

848846
/obj/item/proc/showoff(mob/user)
849847
for(var/mob/M in view(user))

0 commit comments

Comments
 (0)