From 398ec91b314907ebe221fae83716275d50d8b0c2 Mon Sep 17 00:00:00 2001 From: thebleh <43266738+rdragan@users.noreply.github.com> Date: Fri, 5 Feb 2021 22:46:12 +0200 Subject: [PATCH] Adds discrete keybindings for Enabling/Disabling Combat Mode (#56648) --- code/__DEFINES/keybinding.dm | 2 ++ code/datums/keybinding/living.dm | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/code/__DEFINES/keybinding.dm b/code/__DEFINES/keybinding.dm index 03105c8b48b..65d1f87820f 100644 --- a/code/__DEFINES/keybinding.dm +++ b/code/__DEFINES/keybinding.dm @@ -43,6 +43,8 @@ #define COMSIG_KB_LIVING_LOOKDOWN_DOWN "keybinding_living_lookdown_down" #define COMSIG_KB_LIVING_REST_DOWN "keybinding_living_rest_down" #define COMSIG_KB_LIVING_TOGGLE_COMBAT_DOWN "keybinding_living_toggle_combat_down" +#define COMSIG_KB_LIVING_ENABLE_COMBAT_DOWN "keybinding_living_enable_combat_down" +#define COMSIG_KB_LIVING_DISABLE_COMBAT_DOWN "keybinding_living_disable_combat_down" //Mob #define COMSIG_KB_MOB_FACENORTH_DOWN "keybinding_mob_facenorth_down" diff --git a/code/datums/keybinding/living.dm b/code/datums/keybinding/living.dm index 9f56cdc9549..ae232efa8fe 100644 --- a/code/datums/keybinding/living.dm +++ b/code/datums/keybinding/living.dm @@ -89,3 +89,31 @@ return var/mob/living/user_mob = user.mob user_mob.set_combat_mode(!user_mob.combat_mode, FALSE) + +/datum/keybinding/living/enable_combat_mode + hotkey_keys = list("Unbound") + name = "enable_combat_mode" + full_name = "Enable Combat Mode" + description = "Enable combat mode." + keybind_signal = COMSIG_KB_LIVING_ENABLE_COMBAT_DOWN + +/datum/keybinding/living/enable_combat_mode/down(client/user) + . = ..() + if(.) + return + var/mob/living/user_mob = user.mob + user_mob.set_combat_mode(TRUE, silent = FALSE) + +/datum/keybinding/living/disable_combat_mode + hotkey_keys = list("Unbound") + name = "disable_combat_mode" + full_name = "Disable Combat Mode" + description = "Disable combat mode." + keybind_signal = COMSIG_KB_LIVING_DISABLE_COMBAT_DOWN + +/datum/keybinding/living/disable_combat_mode/down(client/user) + . = ..() + if(.) + return + var/mob/living/user_mob = user.mob + user_mob.set_combat_mode(FALSE, silent = FALSE)