[MIRROR] Adds unit test for items that can be equipped to suit storage slots that are missing sprites [MDB IGNORE] (#17195)

* Adds unit test for items that can be equipped to suit storage slots that are missing sprites (#70643)

* Adds unit test for items that can be equipped to suit storage slots that are missing sprites

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-10-26 22:03:07 -04:00
committed by GitHub
co-authored by ShizCalev
parent 3baff89fe6
commit ffb2324b0c
6 changed files with 56 additions and 3 deletions
-2
View File
@@ -131,8 +131,6 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
var/armour_penetration = 0
///Whether or not our object is easily hindered by the presence of armor
var/weak_against_armour = FALSE
///What objects the suit storage can store
var/list/allowed = null
///In deciseconds, how long an item takes to equip; counts only for normal clothing slots, not pockets etc.
var/equip_delay_self = 0
///In deciseconds, how long an item takes to put on another person
@@ -96,7 +96,6 @@
/obj/item/changeling
name = "flesh"
slot_flags = ALL
allowed = list(/obj/item/changeling)
item_flags = DROPDEL
//ATTACK HAND IGNORING PARENT RETURN VALUE
+2
View File
@@ -23,6 +23,8 @@
var/cooldown = 0
var/clothing_flags = NONE
///List of items that can be equipped in the suit storage slot while we're worn.
var/list/allowed
var/can_be_bloody = TRUE
+1
View File
@@ -183,6 +183,7 @@
#include "stomach.dm"
#include "strippable.dm"
#include "subsystem_init.dm"
#include "suit_storage_icons.dm"
#include "surgeries.dm"
#include "teleporters.dm"
#include "tgui_create_message.dm"
@@ -0,0 +1,51 @@
/// Makes sure suit slot items aren't using CS:S fallbacks.
/datum/unit_test/suit_storage_icons
/datum/unit_test/suit_storage_icons/Run()
var/list/wearable_item_paths = list()
for(var/obj/item/item_path as anything in subtypesof(/obj/item))
var/cached_slot_flags = initial(item_path.slot_flags)
if(!(cached_slot_flags & ITEM_SLOT_SUITSTORE) || (initial(item_path.item_flags) & ABSTRACT))
continue
wearable_item_paths |= item_path
for(var/clothing_path in (subtypesof(/obj/item/clothing) - typesof(/obj/item/clothing/head/mob_holder) - typesof(/obj/item/clothing/suit/space/santa))) //mob_holder is a psuedo abstract item. santa suit is a VERY SNOWFLAKE admin spawn suit that can hold /every/ possible item.
var/obj/item/clothing/spawned_item = new clothing_path
for(var/path in spawned_item.allowed) //find all usable suit storage stuff.
wearable_item_paths |= path
qdel(spawned_item)
for(var/mod_path in subtypesof(/obj/item/mod/control))
var/obj/item/mod/control/control_mod = new
for(var/path in control_mod.chestplate.allowed)
wearable_item_paths |= path
qdel(control_mod)
var/list/already_warned_icons = list()
var/count = 1 //to be removed once the test goes live / into CI failure mode.
for(var/obj/item/item_path as anything in typecacheof(wearable_item_paths))
if(initial(item_path.item_flags) & ABSTRACT)
continue
var/worn_icon = initial(item_path.worn_icon) //override icon file. where our sprite is contained if set. (ie modularity stuff)
var/worn_icon_state = initial(item_path.worn_icon_state) //overrides icon_state.
var/icon_state = worn_icon_state || initial(item_path.icon_state) //icon_state. what sprite name we are looking for.
if(isnull(icon_state))
continue //no sprite for the item.
if(icon_state in already_warned_icons)
continue
if(worn_icon) //easiest to check since we override everything.
if(!(icon_state in icon_states(worn_icon)))
log_test("\t[count] - [item_path] using invalid [worn_icon_state ? "worn_icon_state" : "icon_state"], \"[icon_state]\" in worn_icon override file, '[worn_icon]'")
count++
continue
if(!(icon_state in icon_states('icons/mob/clothing/belt_mirror.dmi')))
already_warned_icons += icon_state
log_test("\t[count] - [item_path] using invalid [worn_icon_state ? "worn_icon_state" : "icon_state"], \"[icon_state]\"")
count++
+2
View File
@@ -11,6 +11,7 @@ fi
mkdir -p \
$1/_maps \
$1/icons/mob/clothing \
$1/icons/mob/inhands \
$1/icons/runtime \
$1/sound/runtime \
@@ -25,6 +26,7 @@ fi
cp tgstation.dmb tgstation.rsc $1/
cp -r _maps/* $1/_maps/
cp -r icons/mob/clothing/* $1/icons/mob/clothing/
cp -r icons/mob/inhands/* $1/icons/mob/inhands/
cp -r icons/runtime/* $1/icons/runtime/
cp -r sound/runtime/* $1/sound/runtime/