[MIRROR] Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart [MDB IGNORE] (#19678)

* Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart (#73678)

## About The Pull Request
So, this spiraled from one missing icon being fixed to an entire check
for said icons.
Several icon files no longer use error icons because its assumed that
the checks will handle any missing ones, but the checks don't apply to
emissives nor overlays at all. This led to the radsuit having an
emissive but no icon_state for it - a relic of the old radsuit. This was
only noticed because of a downstream with an error icon appearing for
it...

I was curious how many were actually having the same issue, so I made a
small little stack_trace in the mutable_appearance proc.
There were like, 2k. Lots of them were icons named, like, "transparent"
or "blank" too...
I moved that check to the emissives proc because I semi-understand that
system so could actually fix it, and it moved to around fourty
roundstart. Much more achievable.

(The error usually has more info if you click on it, including the item
that caused it. I dunno how to add that to the check itself because of
where it's located, though.)

![F99cOII1XJ](https://user-images.githubusercontent.com/76465278/221503786-63dc6980-a48b-4290-b891-23c0499500ff.png)

This fixes all the ones I could find, including...
Nonexistant icons that shouldn't be adding emissives on:
- Empty Barsign
- Radsuit
- Mass Driver Controllers
- Telescreens
- Aux Base Consoles
- PanDEMIC
- Kobayashi computer (holodeck)
- Abductor camera console
- Syndie drop pod
- BSA controller
Entirely missing icons on:
- Pwr Game Vendor (this was just misnamed)
- Generic Soda Vendor
- Engivend
- Security Laptop (proud of this one.,.,)
![dreamseeker_36PwO4HSLO](https://user-images.githubusercontent.com/76465278/221544806-3c5ae33a-1360-49e0-ba80-afea6c0a9339.gif)

There are no doubt more of them hidden about, but I don't really know
what I'm doing... If there's a check that'd be better than this, please
review telling me what to change <3
## Why It's Good For The Game
Fixes missing icons, fixes attempts to add icons where we don't need
them, and adds a check to help fix more of the two issues as they occur.
## Changelog
🆑
fix: fixed missing emissives on the Engivend, Pwr-Game Soda, and generic
Soda vendors. Also fixed the seclaptop having no valid screen icon!
fix: fixed a few items trying to apply emissives when they shouldn't.
code: added a stack_trace for emissives with missing icon states.
/🆑

* Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart

* Update cryopod.dm

---------

Co-authored-by: OrionTheFox <76465278+OrionTheFox@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-10 06:11:13 +00:00
committed by GitHub
co-authored by OrionTheFox Gandalf
parent c43195c5dd
commit 36cf718cc7
17 changed files with 28 additions and 10 deletions
+6
View File
@@ -4,6 +4,12 @@
// Consider removing it someday? (I wonder if we made emissives blend right we could make alpha actually matter. dreams man, dreams)
var/mutable_appearance/appearance = mutable_appearance(icon, icon_state, layer, offset_spokesman, EMISSIVE_PLANE, 255, appearance_flags | EMISSIVE_APPEARANCE_FLAGS, offset_const)
appearance.color = GLOB.emissive_color
//Test to make sure emissives with broken or missing icon states are created
if(PERFORM_ALL_TESTS(focus_only/invalid_emissives))
if(icon_state && !icon_exists(icon, icon_state, scream = FALSE)) //Scream set to False so we can have a custom stack_trace
stack_trace("An emissive appearance was added with non-existant icon_state \"[icon_state]\" in [icon]!")
return appearance
// This is a semi hot proc, so we micro it. saves maybe 150ms
+1 -2
View File
@@ -13,8 +13,6 @@
active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.15
/// Selected barsign being used
var/datum/barsign/chosen_sign
/// If barsign has a lighting mask
var/light_mask = FALSE
/datum/armor/sign_barsign
melee = 20
@@ -411,6 +409,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32)
icon = "empty"
desc = "This sign doesn't seem to be on."
rename_area = FALSE
light_mask = FALSE
// For other locations that aren't in the main bar
/obj/machinery/barsign/all_access
@@ -60,6 +60,8 @@ GLOBAL_LIST_INIT(orion_events, generate_orion_events())
name = "Kobayashi Maru control computer"
desc = "A test for cadets."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_keyboard = null
icon_screen = null
icon_state = "control_boxp"
//kobatashi has a smaller list of events, so we copy from the global list and cut whatever isn't here
var/list/event_whitelist = list(
+1 -1
View File
@@ -141,7 +141,7 @@
name = "\improper Mass Driver Controller"
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_control_standby"
icon_keyboard = null
icon_screen = null
density = FALSE
/obj/machinery/computer/pod/old/mass_driver_controller/ordnancedriver
@@ -4,6 +4,7 @@
icon = 'icons/obj/stationobjs.dmi'
icon_state = "telescreen"
icon_keyboard = null
icon_screen = null
layer = SIGN_LAYER
network = list("thunder")
density = FALSE
@@ -11,6 +11,7 @@
icon = 'icons/obj/abductor.dmi'
icon_state = "camera"
icon_keyboard = null
icon_screen = null
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
/obj/machinery/computer/camera_advanced/abductor/Destroy()
-5
View File
@@ -200,8 +200,3 @@
/obj/item/clothing/suit/utility/radiation/Initialize(mapload)
. = ..()
AddElement(/datum/element/radiation_protected_clothing)
/obj/item/clothing/suit/utility/radiation/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", src, alpha = src.alpha)
@@ -19,6 +19,8 @@
var/list/initial_contents
/// If the machine shows an approximate number of its contents on its sprite
var/visible_contents = TRUE
/// Is this smartfridge going to have a glowing screen? (Drying Racks are not)
var/has_emissive = TRUE
/obj/machinery/smartfridge/Initialize(mapload)
. = ..()
@@ -65,7 +67,7 @@
/obj/machinery/smartfridge/update_overlays()
. = ..()
if(!machine_stat)
if(!machine_stat && has_emissive)
. += emissive_appearance(icon, "[initial(icon_state)]-light-mask", src, alpha = src.alpha)
/obj/machinery/smartfridge/wrench_act(mob/living/user, obj/item/tool)
@@ -269,6 +271,7 @@
base_build_path = /obj/machinery/smartfridge/drying_rack //should really be seeing this without admin fuckery.
use_power = NO_POWER_USE
idle_power_usage = 0
has_emissive = FALSE
var/drying = FALSE
/obj/machinery/smartfridge/drying_rack/on_deconstruction()
@@ -519,6 +519,9 @@ GLOBAL_LIST_EMPTY(tram_doors)
if(!is_operational)
return
if(!signal_direction) //Base type doesnt have directions set
return
var/lights_overlay = "[base_icon_state][signal_direction][signal_state]"
. += mutable_appearance(icon, lights_overlay)
+1
View File
@@ -18,6 +18,7 @@
icon = 'icons/obj/terminals.dmi'
icon_state = "dorm_available"
icon_keyboard = null
icon_screen = null
req_one_access = list(ACCESS_AUX_BASE, ACCESS_COMMAND)
circuit = /obj/item/circuitboard/computer/auxiliary_base
/// Shuttle ID of the base
@@ -6,6 +6,7 @@
icon = 'icons/obj/medical/chemical.dmi'
icon_state = "pandemic0"
icon_keyboard = null
icon_screen = null
base_icon_state = "pandemic"
resistance_flags = ACID_PROOF
circuit = /obj/item/circuitboard/computer/pandemic
+1
View File
@@ -35,6 +35,7 @@
icon = 'icons/obj/terminals.dmi'
icon_state = "dorm_available"
icon_keyboard = null
icon_screen = null
light_color = LIGHT_COLOR_BLUE
req_access = list(ACCESS_SYNDICATE)
shuttleId = "steel_rain"
+2 -1
View File
@@ -264,7 +264,8 @@ GLOBAL_VAR_INIT(bsa_unlock, FALSE)
circuit = /obj/item/circuitboard/computer/bsa_control
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "control_boxp"
icon_keyboard = ""
icon_keyboard = null
icon_screen = null
var/datum/weakref/cannon_ref
var/notice
@@ -6,6 +6,9 @@
/// and you will only test the check for invalid overlays in appearance building.
/datum/unit_test/focus_only
/// Checks that every created emissive has a valid icon_state
/datum/unit_test/focus_only/invalid_emissives
/// Checks that every overlay passed into build_appearance_list exists in the icon
/datum/unit_test/focus_only/invalid_overlays
Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

@@ -22,6 +22,7 @@ GLOBAL_LIST_EMPTY(valid_cryopods)
icon = 'modular_skyrat/modules/cryosleep/icons/cryogenics.dmi'
icon_state = "cellconsole_1"
icon_keyboard = null
icon_screen = null
use_power = FALSE
density = FALSE
interaction_flags_machine = INTERACT_MACHINE_OFFLINE