mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +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:
@@ -284,79 +284,66 @@
|
||||
/obj/item/bodypart/proc/get_limb_icon(dropped)
|
||||
icon_state = "" //to erase the default sprite, we're building the visual aspects of the bodypart through overlays alone.
|
||||
|
||||
var/list/standing = list()
|
||||
. = list()
|
||||
|
||||
var/image_dir
|
||||
var/image_dir = 0
|
||||
if(dropped)
|
||||
image_dir = SOUTH
|
||||
if(dmg_overlay_type)
|
||||
if(brutestate)
|
||||
standing += image("icon"='icons/mob/dam_mob.dmi', "icon_state"="[dmg_overlay_type]_[body_zone]_[brutestate]0", "layer"=-DAMAGE_LAYER, "dir"=image_dir)
|
||||
. += image('icons/mob/dam_mob.dmi', "[dmg_overlay_type]_[body_zone]_[brutestate]0", -DAMAGE_LAYER, image_dir)
|
||||
if(burnstate)
|
||||
standing += image("icon"='icons/mob/dam_mob.dmi', "icon_state"="[dmg_overlay_type]_[body_zone]_0[burnstate]", "layer"=-DAMAGE_LAYER, "dir"=image_dir)
|
||||
. += image('icons/mob/dam_mob.dmi', "[dmg_overlay_type]_[body_zone]_0[burnstate]", -DAMAGE_LAYER, image_dir)
|
||||
|
||||
var/image/limb = image(layer = -BODYPARTS_LAYER, dir = image_dir)
|
||||
. += limb
|
||||
|
||||
if(animal_origin)
|
||||
if(status == BODYPART_ORGANIC)
|
||||
limb.icon = 'icons/mob/animal_parts.dmi'
|
||||
if(species_id == "husk")
|
||||
standing += image("icon"='icons/mob/animal_parts.dmi', "icon_state"="[animal_origin]_husk_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[animal_origin]_husk_[body_zone]"
|
||||
else
|
||||
standing += image("icon"='icons/mob/animal_parts.dmi', "icon_state"="[animal_origin]_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[animal_origin]_[body_zone]"
|
||||
else
|
||||
standing += image("icon"='icons/mob/augments.dmi', "icon_state"="[animal_origin]_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
return standing
|
||||
limb.icon = 'icons/mob/augments.dmi'
|
||||
limb.icon_state = "[animal_origin]_[body_zone]"
|
||||
return
|
||||
|
||||
var/icon_gender = (body_gender == FEMALE) ? "f" : "m" //gender of the icon, if applicable
|
||||
|
||||
if((body_zone != "head" && body_zone != "chest"))
|
||||
should_draw_gender = FALSE
|
||||
|
||||
var/image/I
|
||||
|
||||
if(status == BODYPART_ORGANIC)
|
||||
if(should_draw_greyscale)
|
||||
limb.icon = 'icons/mob/human_parts_greyscale.dmi'
|
||||
if(should_draw_gender)
|
||||
I = image("icon"='icons/mob/human_parts_greyscale.dmi', "icon_state"="[species_id]_[body_zone]_[icon_gender]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
|
||||
else if(use_digitigrade)
|
||||
I = image("icon"='icons/mob/human_parts_greyscale.dmi', "icon_state"="digitigrade_[use_digitigrade]_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "digitigrade_[use_digitigrade]_[body_zone]"
|
||||
else
|
||||
I = image("icon"='icons/mob/human_parts_greyscale.dmi', "icon_state"="[species_id]_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[species_id]_[body_zone]"
|
||||
else
|
||||
limb.icon = 'icons/mob/human_parts.dmi'
|
||||
if(should_draw_gender)
|
||||
I = image("icon"='icons/mob/human_parts.dmi', "icon_state"="[species_id]_[body_zone]_[icon_gender]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
|
||||
else
|
||||
I = image("icon"='icons/mob/human_parts.dmi', "icon_state"="[species_id]_[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[species_id]_[body_zone]"
|
||||
|
||||
else
|
||||
limb.icon = icon
|
||||
if(should_draw_gender)
|
||||
I = image("icon"= icon, "icon_state"="[body_zone]_[icon_gender]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
limb.icon_state = "[body_zone]_[icon_gender]"
|
||||
else
|
||||
I = image("icon"= icon, "icon_state"="[body_zone]", "layer"=-BODYPARTS_LAYER, "dir"=image_dir)
|
||||
standing += I
|
||||
return standing
|
||||
|
||||
|
||||
if(!should_draw_greyscale)
|
||||
standing += I
|
||||
return standing
|
||||
|
||||
//Greyscale Colouring
|
||||
var/draw_color
|
||||
|
||||
if(skin_tone) //Limb has skin color variable defined, use it
|
||||
draw_color = skintone2hex(skin_tone)
|
||||
if(species_color)
|
||||
draw_color = species_color
|
||||
if(mutation_color)
|
||||
draw_color = mutation_color
|
||||
|
||||
if(draw_color)
|
||||
I.color = "#[draw_color]"
|
||||
//End Greyscale Colouring
|
||||
standing += I
|
||||
|
||||
return standing
|
||||
limb.icon_state = "[body_zone]"
|
||||
return
|
||||
|
||||
|
||||
if(should_draw_greyscale)
|
||||
var/draw_color = mutation_color || species_color || (skin_tone && skintone2hex(skin_tone))
|
||||
if(draw_color)
|
||||
limb.color = "#[draw_color]"
|
||||
|
||||
/obj/item/bodypart/deconstruct(disassembled = TRUE)
|
||||
drop_organs()
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
/obj/item/bodypart/head/get_limb_icon(dropped)
|
||||
cut_overlays()
|
||||
var/list/standing = ..()
|
||||
. = ..()
|
||||
if(dropped) //certain overlays only appear when the limb is being detached from its owner.
|
||||
var/datum/sprite_accessory/S
|
||||
|
||||
@@ -128,45 +128,48 @@
|
||||
if(facial_hair_style)
|
||||
S = GLOB.facial_hair_styles_list[facial_hair_style]
|
||||
if(S)
|
||||
var/image/img_facial = image("icon" = S.icon, "icon_state" = "[S.icon_state]", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
img_facial.color = "#" + facial_hair_color
|
||||
img_facial.alpha = hair_alpha
|
||||
standing += img_facial
|
||||
var/image/facial_overlay = image(S.icon, "[S.icon_state]", -HAIR_LAYER, SOUTH)
|
||||
facial_overlay.color = "#" + facial_hair_color
|
||||
facial_overlay.alpha = hair_alpha
|
||||
. += facial_overlay
|
||||
|
||||
var/image/hair_overlay = image(layer = -HAIR_LAYER, dir = SOUTH)
|
||||
. += hair_overlay
|
||||
//Applies the debrained overlay if there is no brain
|
||||
if(!brain)
|
||||
if(animal_origin == ALIEN_BODYPART)
|
||||
standing += image("icon"='icons/mob/animal_parts.dmi', "icon_state" = "debrained_alien", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
hair_overlay.icon = 'icons/mob/animal_parts.dmi'
|
||||
hair_overlay.icon_state = "debrained_alien"
|
||||
else if(animal_origin == LARVA_BODYPART)
|
||||
standing += image("icon"='icons/mob/animal_parts.dmi', "icon_state" = "debrained_larva", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
hair_overlay.icon = 'icons/mob/animal_parts.dmi'
|
||||
hair_overlay.icon_state = "debrained_larva"
|
||||
else if(!(NOBLOOD in species_flags_list))
|
||||
standing += image("icon"='icons/mob/human_face.dmi', "icon_state" = "debrained", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
hair_overlay.icon = 'icons/mob/human_face.dmi'
|
||||
hair_overlay.icon_state = "debrained"
|
||||
else
|
||||
if(hair_style)
|
||||
S = GLOB.hair_styles_list[hair_style]
|
||||
if(S)
|
||||
var/image/img_hair = image("icon" = S.icon, "icon_state" = "[S.icon_state]", "layer" = -HAIR_LAYER, "dir"=SOUTH)
|
||||
img_hair.color = "#" + hair_color
|
||||
img_hair.alpha = hair_alpha
|
||||
standing += img_hair
|
||||
hair_overlay.icon = icon
|
||||
hair_overlay.icon_state = "[S.icon_state]"
|
||||
hair_overlay.color = "#" + hair_color
|
||||
hair_overlay.alpha = hair_alpha
|
||||
|
||||
|
||||
// lipstick
|
||||
if(lip_style)
|
||||
var/image/lips = image("icon"='icons/mob/human_face.dmi', "icon_state"="lips_[lip_style]", "layer" = -BODY_LAYER, "dir"=SOUTH)
|
||||
lips.color = lip_color
|
||||
standing += lips
|
||||
var/image/lips_overlay = image('icons/mob/human_face.dmi', "lips_[lip_style]", -BODY_LAYER, SOUTH)
|
||||
lips_overlay.color = lip_color
|
||||
. += lips_overlay
|
||||
|
||||
// eyes
|
||||
var/image/eyes_overlay = image('icons/mob/human_face.dmi', "eyes", -BODY_LAYER, SOUTH)
|
||||
. += eyes_overlay
|
||||
if(!eyes)
|
||||
standing += image("icon"='icons/mob/human_face.dmi', "icon_state" = "eyes_missing", "layer" = -BODY_LAYER, "dir"=SOUTH)
|
||||
eyes_overlay.icon_state = "eyes_missing"
|
||||
|
||||
else if(eyes.eye_color)
|
||||
var/image/img_eyes = image("icon" = 'icons/mob/human_face.dmi', "icon_state" = "eyes", "layer" = -BODY_LAYER, "dir"=SOUTH)
|
||||
img_eyes.color = "#" + eyes.eye_color
|
||||
standing += img_eyes
|
||||
|
||||
return standing
|
||||
eyes_overlay.color = "#" + eyes.eye_color
|
||||
|
||||
/obj/item/bodypart/head/monkey
|
||||
icon = 'icons/mob/animal_parts.dmi'
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if(iscarbon(M))
|
||||
src.Insert(M)
|
||||
if(implant_overlay)
|
||||
var/image/overlay = new /image(icon, implant_overlay)
|
||||
var/mutable_appearance/overlay = mutable_appearance(icon, implant_overlay)
|
||||
overlay.color = implant_color
|
||||
add_overlay(overlay)
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user