From b1cba0d0ebaa268fcfdd4dd280cabaa9f82d5ca5 Mon Sep 17 00:00:00 2001 From: nikothedude <59709059+nikothedude@users.noreply.github.com> Date: Wed, 1 May 2024 18:26:50 -0400 Subject: [PATCH] Fixes jousting bypassing pacifism + Some signal doc (#82986) ## About The Pull Request Closes https://github.com/tgstation/tgstation/issues/82983 Title. Jousting now uses a shiny new post-attack signal, only sent if the attack is actually executed. ## Why It's Good For The Game bgus bad ## Changelog :cl: nikothedude fix: Jousting no longer bypasses pacifism /:cl: --- code/__DEFINES/dcs/signals/signals_object.dm | 3 +++ code/_onclick/item_attack.dm | 2 ++ code/datums/components/jousting.dm | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_object.dm b/code/__DEFINES/dcs/signals/signals_object.dm index 43e3a09a028..f628df0e964 100644 --- a/code/__DEFINES/dcs/signals/signals_object.dm +++ b/code/__DEFINES/dcs/signals/signals_object.dm @@ -448,7 +448,10 @@ /// Prevents click from happening. #define COMPONENT_CANCEL_EQUIPMENT_CLICK (1<<0) +///from base of /obj/item/attack(): (mob/living, mob/living, params) #define COMSIG_ITEM_ATTACK "item_attack" +///from base of /obj/item/attack(): (mob/living, mob/living, params) +#define COMSIG_ITEM_POST_ATTACK "item_post_attack" // called only if the attack was executed ///from base of obj/item/attack_self(): (/mob) #define COMSIG_ITEM_ATTACK_SELF "item_attack_self" //from base of obj/item/attack_self_secondary(): (/mob) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index d5ba848fc8d..1d05ccc16c0 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -236,6 +236,8 @@ user.do_attack_animation(target_mob) target_mob.attacked_by(src, user) + SEND_SIGNAL(src, COMSIG_ITEM_POST_ATTACK, target_mob, user, params) + log_combat(user, target_mob, "attacked", src.name, "(COMBAT MODE: [uppertext(user.combat_mode)]) (DAMTYPE: [uppertext(damtype)])") add_fingerprint(user) diff --git a/code/datums/components/jousting.dm b/code/datums/components/jousting.dm index 56b65c6f758..9c3dab3c8fb 100644 --- a/code/datums/components/jousting.dm +++ b/code/datums/components/jousting.dm @@ -44,7 +44,7 @@ RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip)) RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop)) - RegisterSignal(parent, COMSIG_ITEM_ATTACK, PROC_REF(on_attack)) + RegisterSignal(parent, COMSIG_ITEM_POST_ATTACK, PROC_REF(on_successful_attack)) RegisterSignal(parent, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform)) /datum/component/jousting/UnregisterFromParent() @@ -53,7 +53,7 @@ COMSIG_ATOM_EXAMINE, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED, - COMSIG_ITEM_ATTACK, + COMSIG_ITEM_POST_ATTACK, COMSIG_TRANSFORMING_ON_TRANSFORM, )) @@ -94,7 +94,7 @@ * We deduct the minimum tile charge from the current tile charge to get what will actually be buffed * So your charge will only get benefits from each extra tile after the minimum (and before the maximum). */ -/datum/component/jousting/proc/on_attack(datum/source, mob/living/target, mob/user) +/datum/component/jousting/proc/on_successful_attack(datum/source, mob/living/target, mob/user) SIGNAL_HANDLER if(user != current_holder || !user.buckled) return