From 85887aaa1f2527234c73ef5c0611a5ae78c2322b Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 15 Oct 2023 23:01:04 +0100 Subject: [PATCH] fix movement reuse bug with designator --- code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm | 4 ++++ code/game/objects/items/devices/binoculars.dm | 6 +++++- code/modules/mob/living/carbon/human/human_movement.dm | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm b/code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm index 0a9e00b59e04..6614272d33e5 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm @@ -36,6 +36,10 @@ #define COMSIG_HUMAN_UPDATE_SIGHT "human_update_sight" #define COMPONENT_OVERRIDE_UPDATE_SIGHT (1<<0) +///from /mob/living/carbon/human/movement_delay() +#define COMSIG_HUMAN_MOVEMENT_CANCEL_INTERACTION "human_movement_cancel_interaction" + #define COMPONENT_HUMAN_MOVEMENT_KEEP_USING (1<<0) + ///from /mob/living/carbon/human/update_sight() #define COMSIG_HUMAN_POST_UPDATE_SIGHT "human_post_update_sight" ///from /mob/living/carbon/human/movement_delay(): (list/movedata) diff --git a/code/game/objects/items/devices/binoculars.dm b/code/game/objects/items/devices/binoculars.dm index a4589fb1dd78..2d44ce076f30 100644 --- a/code/game/objects/items/devices/binoculars.dm +++ b/code/game/objects/items/devices/binoculars.dm @@ -38,10 +38,14 @@ /obj/item/device/binoculars/on_set_interaction(mob/user) flags_atom |= RELAY_CLICK - + RegisterSignal(user, COMSIG_HUMAN_MOVEMENT_CANCEL_INTERACTION, PROC_REF(interaction_handler)) /obj/item/device/binoculars/on_unset_interaction(mob/user) flags_atom &= ~RELAY_CLICK + UnregisterSignal(user, COMSIG_HUMAN_MOVEMENT_CANCEL_INTERACTION) + +/obj/item/device/binoculars/proc/interaction_handler() + return COMPONENT_HUMAN_MOVEMENT_KEEP_USING /obj/item/device/binoculars/civ desc = "A pair of binoculars." diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index e4ed65107f03..1a906dfa5c11 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -4,7 +4,8 @@ recalculate_move_delay = FALSE if(interactee)// moving stops any kind of interaction - unset_interaction() + if(!(SEND_SIGNAL(src, COMSIG_HUMAN_MOVEMENT_CANCEL_INTERACTION) & COMPONENT_HUMAN_MOVEMENT_KEEP_USING)) + unset_interaction() if(species.slowdown) . += species.slowdown