diff --git a/code/__DEFINES/clothing_defines.dm b/code/__DEFINES/clothing_defines.dm index ed5a97ea16c..d0380ede710 100644 --- a/code/__DEFINES/clothing_defines.dm +++ b/code/__DEFINES/clothing_defines.dm @@ -37,6 +37,10 @@ #define SLOT_HUD_COLLAR 23 #define SLOT_HUD_AMOUNT 23 +// Boolean defines for hands +#define HAND_BOOL_RIGHT 0 +#define HAND_BOOL_LEFT 1 + // accessory slots #define ACCESSORY_SLOT_DECOR 1 #define ACCESSORY_SLOT_UTILITY 2 diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index d10e0006fb3..b4897cd5df7 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -486,9 +486,9 @@ var/mob/M = usr switch(name) if("right hand", "r_hand") - M.activate_hand("r") + M.activate_hand(HAND_BOOL_RIGHT) if("left hand", "l_hand") - M.activate_hand("l") + M.activate_hand(HAND_BOOL_LEFT) return TRUE /atom/movable/screen/swap_hand diff --git a/code/datums/keybindings/mob_keybinds.dm b/code/datums/keybindings/mob_keybinds.dm index 55122bff793..60b340b4625 100644 --- a/code/datums/keybindings/mob_keybinds.dm +++ b/code/datums/keybindings/mob_keybinds.dm @@ -42,6 +42,22 @@ . = ..() C.mob.swap_hand() +/datum/keybinding/mob/hand_right + name = "Swap to/Activate Right Hand" + +/datum/keybinding/mob/hand_right/down(client/C) + . = ..() + if(!C.mob.activate_hand(HAND_BOOL_RIGHT)) + C.mob.mode() + +/datum/keybinding/mob/hand_left + name = "Swap to/Activate Left Hand" + +/datum/keybinding/mob/hand_left/down(client/C) + . = ..() + if(!C.mob.activate_hand(HAND_BOOL_LEFT)) + C.mob.mode() + // Intents /datum/keybinding/mob/prev_intent name = "Previous Intent" diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm index 18dcfc8b270..1807cdb3533 100644 --- a/code/modules/mob/living/carbon/carbon_procs.dm +++ b/code/modules/mob/living/carbon/carbon_procs.dm @@ -194,18 +194,11 @@ SEND_SIGNAL(src, COMSIG_CARBON_SWAP_HANDS) -/mob/living/carbon/activate_hand(selhand) //0 or "r" or "right" for right hand; 1 or "l" or "left" for left hand. - - if(istext(selhand)) - selhand = lowertext(selhand) - - if(selhand == "right" || selhand == "r") - selhand = 0 - if(selhand == "left" || selhand == "l") - selhand = 1 - +/mob/living/carbon/activate_hand(selhand) if(selhand != hand) swap_hand() + return TRUE + return FALSE /mob/living/carbon/proc/help_shake_act(mob/living/carbon/M) if(health < HEALTH_THRESHOLD_CRIT) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e5543649cfc..5bf5402ba26 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -918,7 +918,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ return /mob/proc/activate_hand(selhand) - return + return FALSE /mob/dead/observer/verb/respawn() set name = "Respawn as NPC" diff --git a/code/modules/mob/mob_vars.dm b/code/modules/mob/mob_vars.dm index bf265fd7330..9f71bc02cfe 100644 --- a/code/modules/mob/mob_vars.dm +++ b/code/modules/mob/mob_vars.dm @@ -44,7 +44,7 @@ var/memory = "" var/notransform = FALSE //Carbon /// True for left hand active, otherwise for right hand active - var/hand = null + var/hand = HAND_BOOL_RIGHT var/real_name = null var/flavor_text = "" var/med_record = ""