Fixes #55112 - Swapping items no longer eats things (#55122)

Quick swapping items no longer hides them in the mobs contents
This commit is contained in:
Jared-Fogle
2020-11-24 14:54:01 -08:00
committed by GitHub
parent ac33f91413
commit cf9ae02e39
4 changed files with 49 additions and 33 deletions
@@ -19,6 +19,7 @@
// Make sure the health analyzer was dropped as part of the swap
// Since health analyzers are an invalid suit storage item
TEST_ASSERT_EQUAL(human.s_store, null, "Human didn't drop the health analyzer")
TEST_ASSERT_EQUAL(human.get_inactive_held_item(), analyzer, "Human doesn't have the health analyzer in their other hand")
// Give the human an emergency oxygen tank
// This is valid suit storage for both the winter coat AND the hardsuit
@@ -41,9 +42,24 @@
TEST_ASSERT_EQUAL(human.screens["nearsighted"], null, "Human equipped glasses, but still has overlay")
var/obj/item/clothing/glasses/monocle/monocle = allocate(/obj/item/clothing/glasses/monocle)
human.put_in_active_hand(monocle)
TEST_ASSERT(human.equip_to_slot_if_possible(monocle, ITEM_SLOT_EYES, swap = TRUE), "Couldn't quick swap to monocle")
TEST_ASSERT_EQUAL(human.get_active_held_item(), glasses, "Human doesn't have previously equipped glasses in their hand")
TEST_ASSERT_NOTEQUAL(human.screens["nearsighted"], null, "Human quick swapped to monocle, but has no nearsighted overlay")
TEST_ASSERT(human.equip_to_slot_if_possible(glasses, ITEM_SLOT_EYES, swap = TRUE), "Couldn't quick swap to glasses")
TEST_ASSERT_EQUAL(human.screens["nearsighted"], null, "Human quick swapped to glasses, but still has nearsighted overlay")
/datum/unit_test/quick_swap_jumpsuit/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/obj/item/jumpsuit = allocate(/obj/item/clothing/under/color/grey)
TEST_ASSERT(human.equip_to_slot_if_possible(jumpsuit, ITEM_SLOT_ICLOTHING), "Couldn't equip grey jumpsuit")
var/obj/item/toolbelt = allocate(/obj/item/storage/belt/utility)
TEST_ASSERT(human.equip_to_slot_if_possible(toolbelt, ITEM_SLOT_BELT), "Couldn't equip belt")
var/obj/item/other_jumpsuit = allocate(/obj/item/clothing/under/color/red)
TEST_ASSERT(human.equip_to_slot_if_possible(other_jumpsuit, ITEM_SLOT_ICLOTHING, swap = TRUE), "Couldn't quick swap to other jumpsuit")
TEST_ASSERT_EQUAL(human.belt, toolbelt, "Human dropped belt after quick swapping to jumpsuit")