mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01:00
Replaces /image with /mutable_appearance, where appropriate (#26518)
In cases where you're creating an image to use as an overlay, it makes more sense to use a mutable_appearance if you can. The image will create a static appearance for not just the image but also each intermediate step if you change vars along the way. The mutable appearance avoids this unnecessary and expensive process. The only situation that requires an image instead of a mutable_appearance is if the overlay is supposed to be directional. MA's ignore direction while images don't. I dunno why, probably another BYOND-ism. I added a convenience function, mutable_appearance(), designed to emulate image(). Also went ahead and set the default plane of /mutable_appearance to FLOAT_PLANE because it's fucking 0 by default. Several overlays that were image() calls were changed to just text strings when I could. overlays += "string" has the same result as overlays += image(icon, "string") and saves a proc call.
This commit is contained in:
@@ -55,7 +55,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
||||
|
||||
/proc/iconstate2appearance(icon, iconstate)
|
||||
var/static/image/stringbro = new()
|
||||
var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches
|
||||
var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches
|
||||
var/list/cached_icon = icon_states_cache[icon]
|
||||
if (cached_icon)
|
||||
var/cached_appearance = cached_icon["[iconstate]"]
|
||||
@@ -91,7 +91,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
||||
new_overlays[i] = iconstate2appearance(icon, cached_overlay)
|
||||
else if(isicon(cached_overlay))
|
||||
new_overlays[i] = icon2appearance(cached_overlay)
|
||||
else //image probable
|
||||
else //image/mutable_appearance probable
|
||||
appearance_bro.appearance = cached_overlay
|
||||
if(!ispath(cached_overlay))
|
||||
appearance_bro.dir = cached_overlay.dir
|
||||
@@ -99,11 +99,11 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
||||
return new_overlays
|
||||
|
||||
#define NOT_QUEUED_ALREADY (!(flags & OVERLAY_QUEUED))
|
||||
#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.processing += src;
|
||||
#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.processing += src;
|
||||
/atom/proc/cut_overlays(priority = FALSE)
|
||||
var/list/cached_overlays = our_overlays
|
||||
var/list/cached_priority = priority_overlays
|
||||
|
||||
|
||||
var/need_compile = FALSE
|
||||
|
||||
if(LAZYLEN(cached_overlays)) //don't queue empty lists, don't cut priority overlays
|
||||
@@ -165,7 +165,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays)
|
||||
if(cut_old)
|
||||
cut_overlays()
|
||||
return
|
||||
|
||||
|
||||
var/list/cached_other = other.our_overlays
|
||||
if(cached_other)
|
||||
if(cut_old || !LAZYLEN(our_overlays))
|
||||
|
||||
Reference in New Issue
Block a user