During unit tests, does extra verification on text based overlays (#59553)

This makes it so during unit tests, adding a text based overlay to something will runtime if the icon does not have an icon state matching that text. I would do this during normal compiles as well but getting the icon states from an icon is surprisingly expensive.

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
Emmett Gaines
2021-06-20 17:02:01 -04:00
committed by GitHub
parent 0f5e8357ae
commit 5adb8df64a
22 changed files with 72 additions and 26 deletions
@@ -12,6 +12,10 @@
armor = list(MELEE = 20, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 10, BIO = 0, RAD = 0, FIRE = 70, ACID = 60)
blocks_emissive = EMISSIVE_BLOCK_UNIQUE
/// Controls whether a door overlay should be applied using the icon_door value as the icon state
var/enable_door_overlay = TRUE
var/has_opened_overlay = TRUE
var/has_closed_overlay = TRUE
var/icon_door = null
var/icon_door_override = FALSE //override to have open overlay use icon different to its base's
var/secure = FALSE //secure locker or not, also used if overriding a non-secure locker with a secure door overlay to add fancy lights
@@ -80,14 +84,18 @@
/obj/structure/closet/proc/closet_update_overlays(list/new_overlays)
. = new_overlays
if(enable_door_overlay)
if(opened && has_opened_overlay)
. += "[icon_door_override ? icon_door : icon_state]_open"
var/mutable_appearance/door_blocker = mutable_appearance(icon, "[icon_door || icon_state]_open", plane = EMISSIVE_PLANE)
door_blocker.color = GLOB.em_block_color
. += door_blocker // If we don't do this the door doesn't block emissives and it looks weird.
else if(has_closed_overlay)
. += "[icon_door || icon_state]_door"
if(opened)
. += "[icon_door_override ? icon_door : icon_state]_open"
var/mutable_appearance/door_blocker = mutable_appearance(icon, "[icon_door || icon_state]_open", plane = EMISSIVE_PLANE)
door_blocker.color = GLOB.em_block_color
. += door_blocker // If we don't do this the door doesn't block emissives and it looks weird.
return
. += mutable_appearance(icon, "[icon_door || icon_state]_door")
if(welded)
. += icon_welded
@@ -16,6 +16,7 @@
anchorable = FALSE
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
drag_slowdown = 0
has_closed_overlay = FALSE
var/foldedbag_path = /obj/item/bodybag
var/obj/item/bodybag/foldedbag_instance = null
var/tagged = FALSE // so closet code knows to put the tag overlay back
@@ -16,6 +16,7 @@
close_sound = 'sound/machines/cardboard_box.ogg'
open_sound_volume = 35
close_sound_volume = 35
enable_door_overlay = FALSE
var/move_speed_multiplier = 1
var/move_delay = FALSE
var/egged = 0
+3 -3
View File
@@ -28,10 +28,10 @@
icon = 'icons/obj/computer.dmi'
icon_state = "computer"
/obj/structure/showcase/fakesec/Initialize()
/obj/structure/showcase/fakesec/update_overlays()
. = ..()
add_overlay("security")
add_overlay("security_key")
. += "security"
. += "security_key"
/obj/structure/showcase/horrific_experiment
name = "horrific experiment"