Fix some signal registration issues with arm implants (#95510)

## About The Pull Request

- `COMSIG_CARBON_POST_ATTACH_LIMB` and `COMSIG_KB_MOB_DROPITEM_DOWN`
were not being unregistered on limb removal, leading to duplicate
registration runtimes if the same limb was amputated and then reattached
- `/obj/item/organ/cyberimp/arm/on_limb_attached` early returns if the
attached limb isn't in the implant's body zone i.e. it's unrelated, the
child override `/obj/item/organ/cyberimp/arm/toolkit/on_limb_attached`
calls the parent but doesn't early return if the parent did, leading to
erroneous signal registration on unrelated limbs
This commit is contained in:
Roxy
2026-03-26 18:23:30 -05:00
committed by GitHub
parent 5c2a99f8e8
commit 4e2b76ef80
@@ -22,12 +22,16 @@
/obj/item/organ/cyberimp/arm/on_mob_remove(mob/living/carbon/arm_owner)
. = ..()
UnregisterSignal(arm_owner, COMSIG_CARBON_POST_ATTACH_LIMB)
on_limb_detached(hand)
/obj/item/organ/cyberimp/arm/proc/on_limb_attached(mob/living/carbon/source, obj/item/bodypart/limb)
SIGNAL_HANDLER
if(!limb || QDELETED(limb) || limb.body_zone != zone)
return
handle_attachment(limb)
/obj/item/organ/cyberimp/arm/proc/handle_attachment(obj/item/bodypart/limb)
if(hand)
on_limb_detached(hand)
RegisterSignal(limb, COMSIG_BODYPART_REMOVED, PROC_REF(on_limb_detached))
@@ -88,9 +92,10 @@
/obj/item/organ/cyberimp/arm/toolkit/on_mob_remove(mob/living/carbon/arm_owner)
. = ..()
UnregisterSignal(arm_owner, COMSIG_KB_MOB_DROPITEM_DOWN)
Retract()
/obj/item/organ/cyberimp/arm/toolkit/on_limb_attached(mob/living/carbon/source, obj/item/bodypart/limb)
/obj/item/organ/cyberimp/arm/toolkit/handle_attachment(obj/item/bodypart/limb)
. = ..()
RegisterSignal(limb, COMSIG_ITEM_ATTACK_SELF, PROC_REF(on_item_attack_self))