mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +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:
@@ -37,10 +37,10 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
//These variables store hair data if the ghost originates from a species with head and/or facial hair.
|
||||
var/hair_style
|
||||
var/hair_color
|
||||
var/image/hair_image
|
||||
var/mutable_appearance/hair_overlay
|
||||
var/facial_hair_style
|
||||
var/facial_hair_color
|
||||
var/image/facial_hair_image
|
||||
var/mutable_appearance/facial_hair_overlay
|
||||
|
||||
var/updatedir = 1 //Do we have to update our dir as the ghost moves around?
|
||||
var/lastsetting = null //Stores the last setting that ghost_others was set to, for a little more efficiency when we update ghost images. Null means no update is necessary
|
||||
@@ -161,13 +161,13 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
ghost_accs = client.prefs.ghost_accs
|
||||
ghost_others = client.prefs.ghost_others
|
||||
|
||||
if(hair_image)
|
||||
cut_overlay(hair_image)
|
||||
hair_image = null
|
||||
if(hair_overlay)
|
||||
cut_overlay(hair_overlay)
|
||||
hair_overlay = null
|
||||
|
||||
if(facial_hair_image)
|
||||
cut_overlay(facial_hair_image)
|
||||
facial_hair_image = null
|
||||
if(facial_hair_overlay)
|
||||
cut_overlay(facial_hair_overlay)
|
||||
facial_hair_overlay = null
|
||||
|
||||
|
||||
if(new_form)
|
||||
@@ -188,19 +188,19 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
if(facial_hair_style)
|
||||
S = GLOB.facial_hair_styles_list[facial_hair_style]
|
||||
if(S)
|
||||
facial_hair_image = image("icon" = S.icon, "icon_state" = "[S.icon_state]", "layer" = -HAIR_LAYER)
|
||||
facial_hair_overlay = mutable_appearance(S.icon, "[S.icon_state]", -HAIR_LAYER)
|
||||
if(facial_hair_color)
|
||||
facial_hair_image.color = "#" + facial_hair_color
|
||||
facial_hair_image.alpha = 200
|
||||
add_overlay(facial_hair_image)
|
||||
facial_hair_overlay.color = "#" + facial_hair_color
|
||||
facial_hair_overlay.alpha = 200
|
||||
add_overlay(facial_hair_overlay)
|
||||
if(hair_style)
|
||||
S = GLOB.hair_styles_list[hair_style]
|
||||
if(S)
|
||||
hair_image = image("icon" = S.icon, "icon_state" = "[S.icon_state]", "layer" = -HAIR_LAYER)
|
||||
hair_overlay = mutable_appearance(S.icon, "[S.icon_state]", -HAIR_LAYER)
|
||||
if(hair_color)
|
||||
hair_image.color = "#" + hair_color
|
||||
hair_image.alpha = 200
|
||||
add_overlay(hair_image)
|
||||
hair_overlay.color = "#" + hair_color
|
||||
hair_overlay.alpha = 200
|
||||
add_overlay(hair_overlay)
|
||||
|
||||
/*
|
||||
* Increase the brightness of a color by calculating the average distance between the R, G and B values,
|
||||
|
||||
Reference in New Issue
Block a user