mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-20 14:45:05 +00:00
* Gets rid of an annoying sporadic CI failure on closets by actually properly checking if they're qdeleted or not, no matter their typepath (#70116) * Gets rid of an annoying sporadic CI failure on closets by actually properly checking if they're qdeleted or not, no matter their typepath Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
26 lines
1.3 KiB
Plaintext
26 lines
1.3 KiB
Plaintext
/// Checks that the length of the initial contents of a closet doesn't exceed its storage capacity.
|
|
/// Also checks that nothing inside that isn't immediate is a steal objective.
|
|
/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)
|
|
if(QDELETED(closet)) // this is here because the emcloset subtype has a chance of returning a qdel hint on initialize
|
|
continue
|
|
|
|
// Copy is necessary otherwise closet.contents - immediate_contents returns an empty list
|
|
var/list/immediate_contents = closet.contents.Copy()
|
|
closet.PopulateContents()
|
|
var/contents_len = length(closet.contents)
|
|
|
|
if(contents_len > closet.storage_capacity)
|
|
TEST_FAIL("Initial Contents of [closet.type] ([contents_len]) exceed its storage capacity ([closet.storage_capacity]).")
|
|
|
|
for (var/obj/item/item in closet.contents - immediate_contents)
|
|
if (item.type in GLOB.steal_item_handler.objectives_by_path)
|
|
TEST_FAIL("[closet_type] contains a steal objective [item.type] in PopulateContents(). Move it to populate_contents_immediate().")
|