Fixing issues with contents of some coded or mapped closets exceeding their storage capacity (#62221)

This commit is contained in:
Ghom
2021-10-20 23:06:20 -07:00
committed by GitHub
parent 0cfb68cd52
commit bc9d83be44
6 changed files with 28 additions and 19 deletions
+1
View File
@@ -51,6 +51,7 @@
#include "card_mismatch.dm"
#include "chain_pull_through_space.dm"
#include "chat_filter.dm"
#include "closets.dm"
#include "combat.dm"
#include "component_tests.dm"
#include "connect_loc.dm"
+12
View File
@@ -0,0 +1,12 @@
/// Checks that the length of the initial contents of a closet doesn't exceed its storage capacity
/datum/unit_test/closets
/datum/unit_test/closets/Run()
var/list/all_closets = subtypesof(/obj/structure/closet)
//Supply pods. They are sent, crashed, opened and never closed again. They also cause exceptions in nullspace.
all_closets -= typesof(/obj/structure/closet/supplypod)
for(var/closet_type in all_closets)
var/obj/structure/closet/closet = allocate(closet_type)
var/contents_len = length(closet.contents)
TEST_ASSERT(contents_len <= closet.storage_capacity, "Initial Contents of [closet.type] ([contents_len]) exceed its storage capacity ([closet.storage_capacity]).")