From c7f02d7c46d00f6949dcb3dcbb97a6ee35c2fe77 Mon Sep 17 00:00:00 2001 From: EnterTheJake <102721711+EnterTheJake@users.noreply.github.com> Date: Thu, 26 Sep 2024 22:02:46 +0200 Subject: [PATCH] Fixes touch spells on_hand hit signals (#86849) ## About The Pull Request Fixes touch spells on_hand hit signals ## Why It's Good For The Game Mainly fixes the issues with mansus grasp not being able to attack things properly, specifically unanchor the mawed crucible. --- .../heretic/structures/mawed_crucible.dm | 13 ++++++------ .../spells/spell_types/touch/_touch.dm | 20 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/code/modules/antagonists/heretic/structures/mawed_crucible.dm b/code/modules/antagonists/heretic/structures/mawed_crucible.dm index dd1d0d87d40..ea962cbc5a4 100644 --- a/code/modules/antagonists/heretic/structures/mawed_crucible.dm +++ b/code/modules/antagonists/heretic/structures/mawed_crucible.dm @@ -69,12 +69,6 @@ bite_the_hand(user) return TRUE - if(istype(weapon, /obj/item/codex_cicatrix) || istype(weapon, /obj/item/melee/touch_attack/mansus_fist)) - playsound(src, 'sound/items/deconstruct.ogg', 30, TRUE, ignore_walls = FALSE) - set_anchored(!anchored) - balloon_alert(user, "[anchored ? "":"un"]anchored") - return TRUE - if(isbodypart(weapon)) var/obj/item/bodypart/consumed = weapon @@ -99,6 +93,13 @@ return ..() +/obj/structure/destructible/eldritch_crucible/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/codex_cicatrix) || istype(tool, /obj/item/melee/touch_attack/mansus_fist)) + playsound(src, 'sound/items/deconstruct.ogg', 30, TRUE, ignore_walls = FALSE) + set_anchored(!anchored) + balloon_alert(user, "[anchored ? "":"un"]anchored") + return ITEM_INTERACT_SUCCESS + /obj/structure/destructible/eldritch_crucible/attack_hand(mob/user, list/modifiers) . = ..() if(.) diff --git a/code/modules/spells/spell_types/touch/_touch.dm b/code/modules/spells/spell_types/touch/_touch.dm index 355f11f763c..24eefe04d10 100644 --- a/code/modules/spells/spell_types/touch/_touch.dm +++ b/code/modules/spells/spell_types/touch/_touch.dm @@ -170,10 +170,9 @@ SHOULD_NOT_OVERRIDE(TRUE) // DEFINITELY don't put effects here, put them in cast_on_hand_hit if(!can_hit_with_hand(target, caster)) - return + return NONE - INVOKE_ASYNC(src, PROC_REF(do_hand_hit), source, target, caster) - return ITEM_INTERACT_SUCCESS + return do_hand_hit(source, target, caster) /** * Signal proc for [COMSIG_ITEM_INTERACTING_WITH_ATOM_SECONDARY] from our attached hand. @@ -185,10 +184,9 @@ SHOULD_NOT_OVERRIDE(TRUE) if(!can_hit_with_hand(target, caster)) - return + return NONE - INVOKE_ASYNC(src, PROC_REF(do_secondary_hand_hit), source, target, caster) - return ITEM_INTERACT_SUCCESS + return do_secondary_hand_hit(source, target, caster) /// Checks if the passed victim can be cast on by the caster. /datum/action/cooldown/spell/touch/proc/can_hit_with_hand(atom/victim, mob/living/caster) @@ -220,14 +218,15 @@ on_antimagic_triggered(hand, victim, caster) else if(!cast_on_hand_hit(hand, victim, caster)) - return + return NONE log_combat(caster, victim, "cast the touch spell [name] on", hand) - spell_feedback(caster) + INVOKE_ASYNC(src, PROC_REF(spell_feedback), caster) caster.do_attack_animation(victim) caster.changeNext_move(CLICK_CD_MELEE) victim.add_fingerprint(caster) remove_hand(caster) + return ITEM_INTERACT_SUCCESS /** * Calls do_secondary_hand_hit() from the caster onto the victim. @@ -243,11 +242,12 @@ // Continue will remove the hand here and stop if(SECONDARY_ATTACK_CONTINUE_CHAIN) log_combat(caster, victim, "cast the touch spell [name] on", hand, "(secondary / alt cast)") - spell_feedback(caster) + INVOKE_ASYNC(src, PROC_REF(spell_feedback), caster) caster.do_attack_animation(victim) caster.changeNext_move(CLICK_CD_MELEE) victim.add_fingerprint(caster) remove_hand(caster) + return ITEM_INTERACT_SUCCESS // Call normal will call the normal cast proc if(SECONDARY_ATTACK_CALL_NORMAL) @@ -255,7 +255,7 @@ // Cancel chain will do nothing, if(SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) - return + return NONE /** * The actual process of casting the spell on the victim from the caster.