mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## About The Pull Request generally cleans up the code a bit. fixes the issue where if you had clothing on yourself already and you tried extending when active it still went through the sealing process even though it didnt extend the part, causing weird desyncs. fixes the issues with part enabled modules that would not activate, makes stealth and radproof modules require the whole suit to be out cause thinking about it they wouldnt really work without that i think reverts quick activation to try put parts on you instead of removing them as priority, i think that plays nicer with separate part activation fixes #87413
39 lines
1.5 KiB
Plaintext
39 lines
1.5 KiB
Plaintext
/**
|
|
* Unit test to check that held items are dropped correctly when we are dismembered.
|
|
*
|
|
* Also tests for edge cases such as undroppable items.
|
|
*/
|
|
/datum/unit_test/dismemberment/Run()
|
|
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
|
|
|
|
var/obj/item/testing_item = allocate(/obj/item/analyzer)
|
|
testing_item.name = "testing item"
|
|
|
|
// Standard situation: We're holding a normal item and get dismembered.
|
|
test_item(dummy, testing_item)
|
|
|
|
// Abnormal situation: We're holding an undroppable item and get dismembered.
|
|
ADD_TRAIT(testing_item, TRAIT_NODROP, TRAIT_GENERIC)
|
|
test_item(dummy, testing_item, status_text = " after applying TRAIT_NODROP to the testing item")
|
|
|
|
|
|
/datum/unit_test/dismemberment/proc/test_item(mob/living/carbon/human/dummy, obj/item/testing_item, status_text = "")
|
|
//Check both to make sure being the active hand doesn't make a difference.
|
|
dummy.put_in_l_hand(testing_item)
|
|
check_dismember(dummy, BODY_ZONE_L_ARM, status_text)
|
|
|
|
dummy.put_in_r_hand(testing_item)
|
|
check_dismember(dummy, BODY_ZONE_R_ARM, status_text)
|
|
|
|
|
|
/datum/unit_test/dismemberment/proc/check_dismember(mob/living/carbon/human/dummy, which_arm, status_text)
|
|
var/obj/item/bodypart/dismembered_limb = dummy.get_bodypart(which_arm)
|
|
var/obj/item/held_item = dummy.get_item_for_held_index(dismembered_limb.held_index)
|
|
|
|
dismembered_limb.dismember()
|
|
TEST_ASSERT(held_item in dummy.loc, "Dummy did not drop [held_item] when [dismembered_limb] was dismembered[status_text].")
|
|
// Clean up after ourselves
|
|
qdel(dismembered_limb)
|
|
dummy.fully_heal(HEAL_ALL)
|
|
|