From aac92ef0299f4e2a7f1a4e67de07b3e7d7744ccc Mon Sep 17 00:00:00 2001 From: SandPoot Date: Tue, 25 Jan 2022 12:40:57 -0300 Subject: [PATCH 1/2] Update mob.dm --- code/modules/keybindings/keybind/mob.dm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/modules/keybindings/keybind/mob.dm b/code/modules/keybindings/keybind/mob.dm index 15911d831e..c9b44e7fc3 100644 --- a/code/modules/keybindings/keybind/mob.dm +++ b/code/modules/keybindings/keybind/mob.dm @@ -88,3 +88,19 @@ var/atom/A = user.mouseObject if(A) A.attempt_examinate(user.mob) + +/datum/keybinding/mob/cancel_action + hotkey_keys = list("Unbound") + name = "cancel_action" + full_name = "Cancel Action" + description = "Cancel the current action." + +/datum/keybinding/mob/cancel_action/down(client/user) + var/mob/M = user.mob + if(length(M.do_afters)) + var/atom/target = M.do_afters[M.do_afters.len] + to_chat(M, "You stop interacting with \the [target].") + LAZYREMOVE(M.do_afters, target) + else + to_chat(M, "There's nothing that you can cancel right now.") + return TRUE From de35e561b5e5f4f08e5753925c4beacd9a422dc3 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Tue, 25 Jan 2022 12:52:11 -0300 Subject: [PATCH 2/2] Update files --- code/modules/keybindings/keybind/living.dm | 22 ++++++++++++++++++++++ code/modules/keybindings/keybind/mob.dm | 16 ---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/code/modules/keybindings/keybind/living.dm b/code/modules/keybindings/keybind/living.dm index f76c86691f..7f5ccb3b51 100644 --- a/code/modules/keybindings/keybind/living.dm +++ b/code/modules/keybindings/keybind/living.dm @@ -36,3 +36,25 @@ /datum/keybinding/living/toggle_resting/down(client/user) var/mob/living/L = user.mob L.lay_down() + +/datum/keybinding/living/cancel_action + hotkey_keys = list("Unbound") + name = "cancel_action" + full_name = "Cancel Action" + description = "Cancel the current action." + +/// Technically you shouldn't be doing any actions if you were sleeping either but... +/datum/keybinding/living/can_use(client/user) + . = ..() + var/mob/living/mob = user.mob + return . && (mob.stat == CONSCIOUS) + +/datum/keybinding/living/cancel_action/down(client/user) + var/mob/M = user.mob + if(length(M.do_afters)) + var/atom/target = M.do_afters[M.do_afters.len] + to_chat(M, "You stop interacting with \the [target].") + LAZYREMOVE(M.do_afters, target) + else + to_chat(M, "There's nothing that you can cancel right now.") + return TRUE diff --git a/code/modules/keybindings/keybind/mob.dm b/code/modules/keybindings/keybind/mob.dm index c9b44e7fc3..15911d831e 100644 --- a/code/modules/keybindings/keybind/mob.dm +++ b/code/modules/keybindings/keybind/mob.dm @@ -88,19 +88,3 @@ var/atom/A = user.mouseObject if(A) A.attempt_examinate(user.mob) - -/datum/keybinding/mob/cancel_action - hotkey_keys = list("Unbound") - name = "cancel_action" - full_name = "Cancel Action" - description = "Cancel the current action." - -/datum/keybinding/mob/cancel_action/down(client/user) - var/mob/M = user.mob - if(length(M.do_afters)) - var/atom/target = M.do_afters[M.do_afters.len] - to_chat(M, "You stop interacting with \the [target].") - LAZYREMOVE(M.do_afters, target) - else - to_chat(M, "There's nothing that you can cancel right now.") - return TRUE