[MIRROR] Prevents possessed blade spirits and similar entities from being created in a destroyed parent item [MDB IGNORE] (#22655)

* Prevents possessed blade spirits and similar entities from being created in a destroyed parent item (#76978)

## About The Pull Request
Activating any item with a `spirit_holder` component to poll for a new
spirit, then destroying the item before the poll process is completed
would create the spirit in nullspace, which would then dump them to the
error room. These spirits are in GODMODE by default, but are usually
contained within an item. See the issue?

This PR makes the spirit creation process check for whether the parent
item was deleted or not before actually creating the spirit. If the
summoning item was destroyed, the would-be spirit will get a message
about it so they can brag about it in deadchat

## Why It's Good For The Game
Fixes #61935

## Changelog

🆑
fix: fixed possessed sword spirits summoned during destruction of the
sword spawning in the error room. those fellas are in godmode, and y'all
don't need an immortal spirit haunting your station, m'kay?
/🆑

* Prevents possessed blade spirits and similar entities from being created in a destroyed parent item

---------

Co-authored-by: Sealed101 <cool.bullseye@yandex.ru>
This commit is contained in:
SkyratBot
2023-07-24 01:21:38 -04:00
committed by GitHub
co-authored by Sealed101
parent f53231823e
commit a972faf64c
+3
View File
@@ -67,6 +67,9 @@
UnregisterSignal(parent, COMSIG_ITEM_ATTACK_SELF)
var/mob/dead/observer/chosen_spirit = pick(candidates)
if(QDELETED(parent)) //if the thing that we're conjuring a spirit in has been destroyed, don't create a spirit
to_chat(chosen_spirit, span_userdanger("The new vessel for your spirit has been destroyed! You remain an unbound ghost."))
return
bound_spirit = new(parent)
bound_spirit.ckey = chosen_spirit.ckey
bound_spirit.fully_replace_character_name(null, "The spirit of [parent]")