mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-21 22:24:09 +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>
23 lines
1.1 KiB
Plaintext
23 lines
1.1 KiB
Plaintext
/datum/unit_test/missing_icons
|
|
abstract_type = /datum/unit_test/missing_icons
|
|
var/list/possible_icon_states = list()
|
|
var/default_location = "icons/"
|
|
/// additional_icon_locations is for downstream modularity support for finding missing sprites in additonal DMI file locations.
|
|
/// Make sure these locations are also present in tools/deploy.sh
|
|
var/additional_icon_locations
|
|
|
|
/datum/unit_test/missing_icons/proc/generate_possible_icon_states_list(directory_path)
|
|
if(!directory_path)
|
|
directory_path = default_location
|
|
for(var/file_path in flist(directory_path))
|
|
if(findtext(file_path, ".dmi"))
|
|
for(var/sprite_icon in icon_states("[directory_path][file_path]", 1)) //2nd arg = 1 enables 64x64+ icon support, otherwise you'll end up with "sword0_1" instead of "sword"
|
|
possible_icon_states[sprite_icon] += list("[directory_path][file_path]")
|
|
else
|
|
possible_icon_states += generate_possible_icon_states_list("[directory_path][file_path]")
|
|
|
|
/datum/unit_test/missing_icons/proc/compile_icon_state_locations()
|
|
generate_possible_icon_states_list(default_location)
|
|
for(var/path in additional_icon_locations)
|
|
generate_possible_icon_states_list(path)
|