mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 19:44:46 +01:00
Clothing fallback (#18258)
* Clothing fallback Makes clothing have a fallback in the event of a custom species file not having the appropriate icon state. * some logging * testing * swap all unit tests to use icon_exists * Update poster_tests.dm * Update clothing_tests.dm * Update cosmetic_tests.dm * Update robot_tests.dm * whoop * upgrades people, upgrades * port these * Update _atom.dm * adjust all these * Update clothing.dm * TRUEFALSE
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
TEST_ASSERT(C.name != "", "[C.type]: Clothing - Empty name.")
|
||||
|
||||
// Icons
|
||||
if(!("[C.icon_state]" in cached_icon_states(C.icon)))
|
||||
if(!icon_exists(C.icon, C.icon_state))
|
||||
if(C.icon == initial(C.icon) && C.icon_state == initial(C.icon_state))
|
||||
TEST_NOTICE("[C.type]: Clothing - Icon_state \"[C.icon_state]\" is not present in [C.icon].")
|
||||
else
|
||||
@@ -165,7 +165,7 @@
|
||||
return
|
||||
|
||||
// All that matters
|
||||
if(!("[set_state]" in cached_icon_states(set_icon)))
|
||||
if(!icon_exists(set_icon, set_state))
|
||||
TEST_NOTICE("[item_path]: Clothing - Testing \"[species]\" state \"[set_state]\" for slot \"[slot_name]\", but it was not in dmi \"[set_icon]\"")
|
||||
signal_failed = TRUE
|
||||
return
|
||||
|
||||
@@ -38,12 +38,12 @@
|
||||
|
||||
if(istype(accessory, /datum/sprite_accessory/hair))
|
||||
actual_icon_state += "_s"
|
||||
TEST_ASSERT(actual_icon_state in cached_icon_states(accessory::icon), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
TEST_ASSERT(icon_exists(accessory::icon, actual_icon_state), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
return
|
||||
|
||||
if(istype(accessory, /datum/sprite_accessory/facial_hair))
|
||||
actual_icon_state += "_s"
|
||||
TEST_ASSERT(actual_icon_state in cached_icon_states(accessory::icon), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
TEST_ASSERT(icon_exists(accessory::icon, actual_icon_state), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
return
|
||||
|
||||
if(istype(accessory, /datum/sprite_accessory/marking))
|
||||
@@ -52,5 +52,5 @@
|
||||
TEST_ASSERT(body_part in BP_ALL, "[accessory::name] - [accessory::type]: Cosmetic - Has an illegal bodypart \"[body_part]\". ONLY use parts listed in BP_ALL.")
|
||||
|
||||
actual_icon_state = "[accessory::icon_state]-[body_part]"
|
||||
TEST_ASSERT(actual_icon_state in cached_icon_states(accessory::icon), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
TEST_ASSERT(icon_exists(accessory::icon, actual_icon_state), "[accessory::name] - [accessory::type]: Cosmetic - Icon_state \"[actual_icon_state]\" is not present in [accessory::icon].")
|
||||
return
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
var/icon/I = initial(P.icon)
|
||||
if(D.icon_override)
|
||||
I = D.icon_override
|
||||
TEST_ASSERT(D.icon_state in cached_icon_states(I), "[D.type]: Poster - missing icon_state \"[D.icon_state]\" in \"[I]\", as [D.icon_override ? "override" : "base"] dmi.")
|
||||
TEST_ASSERT(icon_exists(I, D.icon_state), "[D.type]: Poster - missing icon_state \"[D.icon_state]\" in \"[I]\", as [D.icon_override ? "override" : "base"] dmi.")
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
if(robot.has_dead_sprite)
|
||||
check_state(robot,"-wreck")
|
||||
if(robot.has_dead_sprite_overlay) // Only one per dmi
|
||||
TEST_ASSERT("wreck-overlay" in cached_icon_states(robot.sprite_icon), "[robot.type]: Robots - Robot sprite \"[robot.name]\", missing icon_state wreck-overlay, in dmi \"[robot.sprite_icon]\".")
|
||||
TEST_ASSERT(icon_exists(robot.sprite_icon, "wreck-overlay"), "[robot.type]: Robots - Robot sprite \"[robot.name]\", missing icon_state wreck-overlay, in dmi \"[robot.sprite_icon]\".")
|
||||
// offset
|
||||
var/icon/I = new(robot.sprite_icon)
|
||||
TEST_ASSERT_EQUAL(robot.icon_x, I.Width(), "[robot.type]: Robots - Robot sprite \"[robot.name]\", icon_x \"[robot.icon_x]\" did not match dmi configured width \"[I.Width()]\"")
|
||||
@@ -167,4 +167,4 @@
|
||||
|
||||
/datum/unit_test/all_robot_sprites_must_be_valid/proc/check_state(datum/robot_sprite/robot, append)
|
||||
var/check_state = "[robot.sprite_icon_state][append]"
|
||||
TEST_ASSERT(check_state in cached_icon_states(robot.sprite_icon), "[robot.type]: Robots - Robot sprite \"[robot.name]\", enabled but missing icon_state \"[check_state]\", in dmi \"[robot.sprite_icon]\".")
|
||||
TEST_ASSERT(icon_exists(robot.sprite_icon, check_state), "[robot.type]: Robots - Robot sprite \"[robot.name]\", enabled but missing icon_state \"[check_state]\", in dmi \"[robot.sprite_icon]\".")
|
||||
|
||||
Reference in New Issue
Block a user