Fixes changing species causing you to drop held items, Fixes loss of right arm not applying typical "lost arm" effects (#73356)

## About The Pull Request

`drop_limb(special = TRUE)` will now no longer drop held items. This can
cause issues if people are misusing `special`, but if people are not
then it's fine, as it's supposed to be replaced just after.

Also cut out some copy-pasta from arm and leg `drop_limb`. Since they're
one unified type, they no longer needed to carry across both. This fixed
another bug

Also also, I was able to move the held index check out of core bodypart
code, and down to arm level. This MAY have side effects, which I'm
observing for.

## Why It's Good For The Game

Changing species let you drop no-drop items, super lame

## Changelog

🆑 Melbert
fix: Changing species no longer drops all held items
fix: Losing your right hand not un-cuffing you or dropping your gloves
/🆑
This commit is contained in:
MrMelbert
2023-02-13 13:11:54 -06:00
committed by GitHub
parent 09122e5e7a
commit 809a0b5eba
3 changed files with 40 additions and 53 deletions
@@ -27,3 +27,21 @@
var/obj/item/human_collar = morphing_human.get_item_by_slot(ITEM_SLOT_NECK)
TEST_ASSERT_NOTEQUAL(equipped_collar, human_collar, "Human still has a Monkey collar after changing species.")
///Gives a Human items in both hands, then swaps them to be another species. Held items should remain.
/datum/unit_test/species_change_held_items
/datum/unit_test/species_change_held_items/Run()
var/mob/living/carbon/human/morphing_human = allocate(/mob/living/carbon/human/dummy/consistent)
var/obj/item/item_a = allocate(/obj/item/storage/toolbox)
var/obj/item/item_b = allocate(/obj/item/melee/baton/security/loaded)
morphing_human.put_in_hands(item_a)
morphing_human.put_in_hands(item_b)
var/pre_change_num = length(morphing_human.get_empty_held_indexes())
TEST_ASSERT_EQUAL(pre_change_num, 0, "Human had empty hands before the species change happened.")
morphing_human.set_species(/datum/species/lizard)
var/post_change_num = length(morphing_human.get_empty_held_indexes())
TEST_ASSERT_EQUAL(post_change_num, 0, "Human had empty hands after the species change happened, but they should've kept their items.")