mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 23:54:14 +01:00
8042c69b4f
## About The Pull Request Gives the 3 main missing icon tests a shared parent for behavior. Made the list of icon states not static because of this but that shouldn't really matter. Additional icon locations is made a list for evil down streams that are grandchildren of TG rather then just children, or repos with multiple spots for icons, `modular_downstream/master_files/icons` and `modular_downstream/modules` can both have icons in alot of them Was considering also making them filter out abstract_types but maybe should be a diff pr. ## Why It's Good For The Game All 3 present unit tests copy paste ALOT of their behavior, but very low hanging fruit is the compiling of folders, which while claiming have modularity support its a bit silly to require 3 separate additions just to make sure all tests are properly working. ## Changelog N/A --------- Co-authored-by: Jordan Dominion <dominion@tgstation13.org>
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
/// Makes sure objects actually have icons that exist!
|
|
/datum/unit_test/missing_icons/icon_state
|
|
default_location = "icons/obj/"
|
|
|
|
/datum/unit_test/missing_icons/icon_state/compile_icon_state_locations()
|
|
. = ..()
|
|
generate_possible_icon_states_list("icons/effects/")
|
|
|
|
/datum/unit_test/missing_icons/icon_state/Run()
|
|
compile_icon_state_locations()
|
|
|
|
//Add EVEN MORE paths if needed here!
|
|
//generate_possible_icon_states_list("your/folder/path/")
|
|
var/list/bad_list = list()
|
|
for(var/obj/obj_path as anything in subtypesof(/obj))
|
|
if(ispath(obj_path, /obj/item))
|
|
var/obj/item/item_path = obj_path
|
|
if(initial(item_path.item_flags) & ABSTRACT)
|
|
continue
|
|
|
|
if(initial(obj_path.greyscale_colors) && initial(obj_path.greyscale_config)) //GAGS has its own unit test.
|
|
continue
|
|
|
|
var/icon = initial(obj_path.icon)
|
|
if(isnull(icon))
|
|
continue
|
|
var/icon_state = initial(obj_path.icon_state)
|
|
if(isnull(icon_state))
|
|
continue
|
|
|
|
if(length(bad_list) && (icon_state in bad_list[icon]))
|
|
continue
|
|
|
|
if(icon_exists(icon, icon_state))
|
|
continue
|
|
|
|
bad_list[icon] += list(icon_state)
|
|
|
|
var/match_message
|
|
if(icon_state in possible_icon_states)
|
|
for(var/file_place in possible_icon_states[icon_state])
|
|
match_message += (match_message ? " & '[file_place]'" : " - Matching sprite found in: '[file_place]'")
|
|
|
|
TEST_FAIL("Missing icon_state for [obj_path] in '[icon]'.\n\ticon_state = \"[icon_state]\"[match_message]")
|
|
|