build_appearance_list no longer edits the list it is passed (#32066)
* build_appearance_list no longer edits the list it is passed * Mistakes were made * Update overlays.dm
This commit is contained in:
@@ -89,23 +89,24 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
|||||||
. = iconbro.appearance
|
. = iconbro.appearance
|
||||||
icon_cache[icon] = .
|
icon_cache[icon] = .
|
||||||
|
|
||||||
/atom/proc/build_appearance_list(new_overlays)
|
/atom/proc/build_appearance_list(old_overlays)
|
||||||
var/static/image/appearance_bro = new()
|
var/static/image/appearance_bro = new()
|
||||||
if (!islist(new_overlays))
|
var/list/new_overlays = list()
|
||||||
new_overlays = list(new_overlays)
|
if (!islist(old_overlays))
|
||||||
else
|
old_overlays = list(old_overlays)
|
||||||
listclearnulls(new_overlays)
|
for (var/overlay in old_overlays)
|
||||||
for (var/i in 1 to length(new_overlays))
|
if(!overlay)
|
||||||
var/image/cached_overlay = new_overlays[i]
|
continue
|
||||||
if (istext(cached_overlay))
|
if (istext(overlay))
|
||||||
new_overlays[i] = iconstate2appearance(icon, cached_overlay)
|
new_overlays += iconstate2appearance(icon, overlay)
|
||||||
else if(isicon(cached_overlay))
|
else if(isicon(overlay))
|
||||||
new_overlays[i] = icon2appearance(cached_overlay)
|
new_overlays += icon2appearance(overlay)
|
||||||
else //image/mutable_appearance probable
|
else
|
||||||
appearance_bro.appearance = cached_overlay
|
appearance_bro.appearance = overlay //this works for images and atoms too!
|
||||||
if(!ispath(cached_overlay))
|
if(!ispath(overlay))
|
||||||
appearance_bro.dir = cached_overlay.dir
|
var/image/I = overlay
|
||||||
new_overlays[i] = appearance_bro.appearance
|
appearance_bro.dir = I.dir
|
||||||
|
new_overlays += appearance_bro.appearance
|
||||||
return new_overlays
|
return new_overlays
|
||||||
|
|
||||||
#define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1))
|
#define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1))
|
||||||
@@ -142,7 +143,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
|||||||
if(priority)
|
if(priority)
|
||||||
LAZYREMOVE(cached_priority, overlays)
|
LAZYREMOVE(cached_priority, overlays)
|
||||||
|
|
||||||
if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_priority)) || (init_p_len != LAZYLEN(cached_overlays))))
|
if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_overlays)) || (init_p_len != LAZYLEN(cached_priority))))
|
||||||
QUEUE_FOR_COMPILE
|
QUEUE_FOR_COMPILE
|
||||||
|
|
||||||
/atom/proc/add_overlay(list/overlays, priority = FALSE)
|
/atom/proc/add_overlay(list/overlays, priority = FALSE)
|
||||||
|
|||||||
Reference in New Issue
Block a user