From 9526ed6e78eadaf093a34848cb856cc58c72d534 Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Sat, 31 Jan 2026 16:47:36 -0500 Subject: [PATCH] Makes COMSIG_MOB_SWAP_HANDS pass the current and previous held items as args (#95055) ## About The Pull Request Tin, that's all. In a lot of cases you will want to have these, especially if you are using elements with this signal. ## Why It's Good For The Game Better code ## Changelog Not player-facing --- code/datums/components/fullauto.dm | 3 +-- code/datums/components/throwbonus_on_windup.dm | 2 +- code/modules/mob/mob.dm | 2 +- code/modules/tutorials/tutorials/drop.dm | 4 ++-- code/modules/tutorials/tutorials/switch_hands.dm | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/code/datums/components/fullauto.dm b/code/datums/components/fullauto.dm index bf19c5b1672..d7f68e55bae 100644 --- a/code/datums/components/fullauto.dm +++ b/code/datums/components/fullauto.dm @@ -209,8 +209,7 @@ stop_autofiring() return COMPONENT_CLIENT_MOUSEUP_INTERCEPT - -/datum/component/automatic_fire/proc/stop_autofiring(datum/source, atom/object, turf/location, control, params) +/datum/component/automatic_fire/proc/stop_autofiring(mob/living/source, obj/item/swapped_to, obj/item/swapped_from) SIGNAL_HANDLER if(autofire_stat != AUTOFIRE_STAT_FIRING) return diff --git a/code/datums/components/throwbonus_on_windup.dm b/code/datums/components/throwbonus_on_windup.dm index dd12b945f29..0b767939f9f 100644 --- a/code/datums/components/throwbonus_on_windup.dm +++ b/code/datums/components/throwbonus_on_windup.dm @@ -91,7 +91,7 @@ else end_windup() -/datum/component/throwbonus_on_windup/proc/on_hands_swap(mob/living/source) +/datum/component/throwbonus_on_windup/proc/on_hands_swap(mob/living/source, obj/item/swapped_to, obj/item/swapped_from) SIGNAL_HANDLER if(source.get_active_held_item() != parent) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 36efed52c93..3796d8711d1 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -944,7 +944,7 @@ var/result = perform_hand_swap(held_index) if (result) - SEND_SIGNAL(src, COMSIG_MOB_SWAP_HANDS) + SEND_SIGNAL(src, COMSIG_MOB_SWAP_HANDS, get_active_held_item(), held_item) return result diff --git a/code/modules/tutorials/tutorials/drop.dm b/code/modules/tutorials/tutorials/drop.dm index 6ace8bb88a7..6be38f234d2 100644 --- a/code/modules/tutorials/tutorials/drop.dm +++ b/code/modules/tutorials/tutorials/drop.dm @@ -57,10 +57,10 @@ if (STAGE_PICK_SOMETHING_UP) show_instruction("Pick something up!") -/datum/tutorial/drop/proc/on_swap_hands() +/datum/tutorial/drop/proc/on_swap_hands(mob/living/source, obj/item/swapped_to, obj/item/swapped_from) SIGNAL_HANDLER - if (isnull(user.get_active_held_item())) + if (isnull(swapped_to)) if (stage != STAGE_PICK_SOMETHING_UP) stage = STAGE_PICK_SOMETHING_UP show_instructions() diff --git a/code/modules/tutorials/tutorials/switch_hands.dm b/code/modules/tutorials/tutorials/switch_hands.dm index d423667ac38..724d99fca81 100644 --- a/code/modules/tutorials/tutorials/switch_hands.dm +++ b/code/modules/tutorials/tutorials/switch_hands.dm @@ -68,14 +68,14 @@ if (STAGE_PICK_UP_ITEM) show_instruction("Pick something up!") -/datum/tutorial/switch_hands/proc/on_swap_hands() +/datum/tutorial/switch_hands/proc/on_swap_hands(mob/living/source, obj/item/swapped_to, obj/item/swapped_from) SIGNAL_HANDLER //FIXME: this checking breaks easily - if (isnull(user.get_active_held_item())) + if (isnull(swapped_to)) stage = STAGE_PICK_UP_ITEM show_instructions() - else if (isnull(user.get_inactive_held_item())) + else if (isnull(swapped_from)) stage = STAGE_SHOULD_SWAP_HAND show_instructions() else