Files
Bubberstation/code/modules/detectivework
SkyratBot 2f5a976935 [MIRROR] Putting mobs into evidence bags no longer causes harddels [MDB IGNORE] (#23085)
* Putting mobs into evidence bags no longer causes harddels (#77583)

## About The Pull Request

Fun interaction. Since evidence bags make you drop held items to the
floor and then forcemove the item into the bag, mob holders would dump
the mob on the floor, be qdeleted and have their references cleared and
then be put inside the bag's contents, bugging the fuck out and staying
in the bag (`put_in_hands()` fails if the item in question is qdeleted)
until it's eventually harddeleted because the reference to it in the
evidence bag never gets cleared.

![image](https://github.com/tgstation/tgstation/assets/80640114/42cc4748-653f-4ed7-98fa-4c9cd39615e9)
<details>

<summary>Harddel logs</summary>

```
[2023-08-13 12:05:25.908] RUNTIME: ## REF SEARCH Beginning search for references to a /obj/item/clothing/head/mob_holder.
[2023-08-13 12:05:26.089] RUNTIME: ## REF SEARCH Finished searching globals
[2023-08-13 12:05:26.353] RUNTIME: ## REF SEARCH Finished searching native globals
[2023-08-13 12:05:59.099] RUNTIME: ## REF SEARCH Found /obj/item/clothing/head/mob_holder [0x2001ffb] in list World -> /obj/item/evidencebag [0x20140e8] -> contents (list).
[2023-08-13 12:09:22.401] RUNTIME: ## REF SEARCH Finished searching atoms
[2023-08-13 12:09:50.415] RUNTIME: ## REF SEARCH Finished searching datums
[2023-08-13 12:09:50.419] RUNTIME: ## REF SEARCH Finished searching clients
[2023-08-13 12:09:50.421] RUNTIME: ## REF SEARCH Completed search for references to a /obj/item/clothing/head/mob_holder.
[2023-08-13 12:09:50.427] RUNTIME: ## TESTING: GC: -- [0x2001ffb] | /obj/item/clothing/head/mob_holder was unable to be GC'd
```

</details>

My solution was to change the checks of the evidence bag. Rather than
making you drop the item, they will check that the item is in your hands
and that it doesn't have `TRAIT_NODROP`. If either isn't true, it will
fail, which I think covers all the relevant cases for this. It should
avoid any similar issues in the future with items that dissapear when
dropped. (Hand gestures would have also suffered from this if they
weren't excluded in an earlier check, for example).

As an additional fallback, it will also check if the item is qdeleted
before trying to forcemove it.
## Why It's Good For The Game

Closes #77197.
Hard deletes are bad, real bad.
## Changelog
🆑
fix: mob holders no longer bug out and harddel when put into evidence
bags.
/🆑

* Putting mobs into evidence bags no longer causes harddels

---------

Co-authored-by: A miscellaneous Fern <80640114+FernandoJ8@users.noreply.github.com>
2023-08-14 20:42:38 -04:00
..