From 315d287446bc399710370a95b2299b356c527d20 Mon Sep 17 00:00:00 2001 From: fira Date: Thu, 19 Oct 2023 21:40:43 +0200 Subject: [PATCH] Fixes deleted mobs not unbuckling (#4717) # About the pull request This makes mobs unbuckle on deletion. Why this matters: - Leftover references as buckled_mob on the buckled object - The object cannot be used by someone else, since someone is still buckled to it - In most extreme case eg. shuttle chairs, the shuttle will pull the deleted mob out of nullspace and back to chair when traveling # Explain why it's good for the game Less bugs and less confused admins having to re-spawn an entire tank over it # Testing Photographs and Procedure Tested buckling/deleting without errors --- code/game/objects/objs.dm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 184fc51bd507..3fa16af05875 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -226,9 +226,14 @@ /obj/proc/afterbuckle(mob/M as mob) // Called after somebody buckled / unbuckled handle_rotation() SEND_SIGNAL(src, COSMIG_OBJ_AFTER_BUCKLE, buckled_mob) + if(!buckled_mob) + UnregisterSignal(M, COMSIG_PARENT_QDELETING) + else + RegisterSignal(buckled_mob, COMSIG_PARENT_QDELETING, PROC_REF(unbuckle)) return buckled_mob /obj/proc/unbuckle() + SIGNAL_HANDLER if(buckled_mob && buckled_mob.buckled == src) buckled_mob.buckled = null buckled_mob.anchored = initial(buckled_mob.anchored)