Files
Bubberstation/code/modules/unit_tests/clothing_drops_items.dm
MrMelbert df7b3e4c31 Reverts a check added in [NO GBP] Fixes drone toolbox issues, fixes clothing unequipping, unit test (#87131)
## About The Pull Request

Fixes #87129

[This
change](https://github.com/tgstation/tgstation/pull/87073/files#diff-c8ab5fbc20de60e202b839834b039649cbb69a1c4b99b27a5e467f3889442ccd)
added in #87073, passing `invdrop = FALSE` to `doUnEquip`, breaks the
behavior of unequipping dropping your items. Because that's what
`invdrop` does. If you pass it as `FALSE` it prevents other items from
dropping off the mob, intended for like, outfit use / "quick swapping"
an item out

So I reverted it. Drone tools still seem to work I guess. @SyncIt21 

## Changelog

🆑 Melbert
fix: Fixes stuff staying on your body after removing your clothes
/🆑
2024-11-14 16:04:17 -08:00

54 lines
2.5 KiB
Plaintext

/// Tests that removing a piece of clothing drops items that hold said piece of clothing
/datum/unit_test/clothing_drops_items
/datum/unit_test/clothing_drops_items/Run()
test_human()
test_android()
/datum/unit_test/clothing_drops_items/proc/test_human()
var/list/dummy_items = allocate_items()
var/mob/living/carbon/human/consistent/dummy = allocate(__IMPLIED_TYPE__)
for(var/slot in dummy_items)
TEST_ASSERT(dummy.equip_to_slot_if_possible(dummy_items[slot], text2num(slot)), \
"[/datum/species/human::name] Dummy failed to equip one of the starting items ([dummy_items[slot]]). Test aborted.")
dummy.dropItemToGround(dummy.w_uniform)
for(var/slot in dummy_items)
var/obj/item/item = dummy_items[slot]
if(item.slot_flags & ITEM_SLOT_ICLOTHING)
continue
else if(item.slot_flags & (ITEM_SLOT_BACK|ITEM_SLOT_FEET))
TEST_ASSERT_EQUAL(item.loc, dummy, "[item] should not have been dropped when unequipping the jumpsuit from \a [/datum/species/human::name].")
else
TEST_ASSERT_EQUAL(item.loc, dummy.loc, "[item] should have been dropped when unequipping the jumpsuit from \a [/datum/species/human::name].")
/datum/unit_test/clothing_drops_items/proc/test_android()
var/list/robo_dummy_items = allocate_items()
var/mob/living/carbon/human/consistent/robo_dummy = allocate(__IMPLIED_TYPE__)
robo_dummy.set_species(/datum/species/android)
for(var/slot in robo_dummy_items)
TEST_ASSERT(robo_dummy.equip_to_slot_if_possible(robo_dummy_items[slot], text2num(slot)), \
"[/datum/species/android::name] Dummy failed to equip one of the starting items ([robo_dummy_items[slot]]). Test aborted.")
robo_dummy.dropItemToGround(robo_dummy.w_uniform)
for(var/slot in robo_dummy_items)
var/obj/item/item = robo_dummy_items[slot]
if(item.slot_flags & ITEM_SLOT_ICLOTHING)
continue
TEST_ASSERT_EQUAL(item.loc, robo_dummy, "[item] should not have been dropped when unequipping the jumpsuit from \a [/datum/species/android::name].")
/datum/unit_test/clothing_drops_items/proc/allocate_items()
return list(
"[ITEM_SLOT_ICLOTHING]" = allocate(/obj/item/clothing/under/color/rainbow), // do this one first, it holds everything
"[ITEM_SLOT_FEET]" = allocate(/obj/item/clothing/shoes/jackboots),
"[ITEM_SLOT_BELT]" = allocate(/obj/item/storage/belt/utility),
"[ITEM_SLOT_BACK]" = allocate(/obj/item/storage/backpack),
"[ITEM_SLOT_ID]" = allocate(/obj/item/card/id/advanced/gold/captains_spare),
"[ITEM_SLOT_RPOCKET]" = allocate(/obj/item/assembly/flash/handheld),
"[ITEM_SLOT_LPOCKET]" = allocate(/obj/item/toy/plush/lizard_plushie),
)