ports TGMCs click hack for non-hotkey players ports classic keybinds from TGMC (#47670)

About The Pull Request

Ports tgstation/TerraGov-Marine-Corps#2977, overrides click proc to return focus back to chat bar using winsets also ports tgstation/TerraGov-Marine-Corps#1904 which has two sets of defaults for hotkey and classic mode
fixes #47672 fixes #47659

much credit to @Rohesie and the TGMC team for a bunch of these improvements
Why It's Good For The Game

lets the non-hotkey players walk and talk again
Changelog

cl
add: Custom keybinds will now check what style (classic / hotkey) you prefer when resetting if you use classic mode make sure to reset your keybinds to default!
add: multiple keybind support
tweak: non-hotkey mode keeps focus on chat
fix: pressing 4 as cyborg now properly cycles
fix: AI location hotkeys now work again
/cl
This commit is contained in:
Couls
2019-11-14 09:22:33 +13:00
committed by oranges
parent 3d7d69d1a6
commit 26a61a489c
20 changed files with 277 additions and 339 deletions
+14 -6
View File
@@ -1,11 +1,19 @@
/datum/keybinding
var/key
var/name
var/full_name
var/description = ""
var/category = CATEGORY_MISC
var/weight = WEIGHT_LOWEST
var/list/hotkey_keys
var/list/classic_keys
var/name
var/full_name
var/description = ""
var/category = CATEGORY_MISC
var/weight = WEIGHT_LOWEST
var/keybind_signal
/datum/keybinding/New()
// Default keys to the master "hotkey_keys"
if(LAZYLEN(hotkey_keys) && !LAZYLEN(classic_keys))
classic_keys = hotkey_keys.Copy()
/datum/keybinding/proc/down(client/user)
return FALSE
+22 -22
View File
@@ -1,40 +1,40 @@
/datum/keybinding/admin
category = CATEGORY_ADMIN
weight = WEIGHT_ADMIN
category = CATEGORY_ADMIN
weight = WEIGHT_ADMIN
/datum/keybinding/admin/admin_say
key = "F3"
name = "admin_say"
full_name = "Admin say"
description = "Talk with other admins."
hotkey_keys = list("F3")
name = "admin_say"
full_name = "Admin say"
description = "Talk with other admins."
/datum/keybinding/admin/admin_say/down(client/user)
user.get_admin_say()
return TRUE
user.get_admin_say()
return TRUE
/datum/keybinding/admin/admin_ghost
key = "F5"
name = "admin_ghost"
full_name = "Aghost"
description = "Go ghost"
hotkey_keys = list("F5")
name = "admin_ghost"
full_name = "Aghost"
description = "Go ghost"
/datum/keybinding/admin/admin_ghost/down(client/user)
user.admin_ghost()
return TRUE
user.admin_ghost()
return TRUE
/datum/keybinding/admin/player_panel_new
key = "F6"
name = "player_panel_new"
full_name = "Player Panel New"
description = "Opens up the new player panel"
hotkey_keys = list("F6")
name = "player_panel_new"
full_name = "Player Panel New"
description = "Opens up the new player panel"
/datum/keybinding/admin/player_panel_new/down(client/user)
user.holder.player_panel_new()
return TRUE
/datum/keybinding/admin/toggle_buildmode_self
key = "F7"
hotkey_keys = list("F7")
name = "toggle_buildmode_self"
full_name = "Toggle Buildmode Self"
description = "Toggles buildmode"
@@ -44,7 +44,7 @@
return TRUE
/datum/keybinding/admin/stealthmode
key = "Ctrl-F8"
hotkey_keys = list("CtrlF8")
name = "stealth_mode"
full_name = "Stealth mode"
description = "Enters stealth mode"
@@ -54,7 +54,7 @@
return TRUE
/datum/keybinding/admin/invisimin
key = "F8"
hotkey_keys = list("F8")
name = "invisimin"
full_name = "Admin invisibility"
description = "Toggles ghost-like invisibility (Don't abuse this)"
@@ -64,7 +64,7 @@
return TRUE
/datum/keybinding/admin/deadsay
key = "F10"
hotkey_keys = list("F10")
name = "dsay"
full_name = "deadsay"
description = "Allows you to send a message to dead chat"
+11 -6
View File
@@ -4,8 +4,9 @@
/datum/keybinding/carbon/toggle_throw_mode
key = "R"
name = "toggle_throw_mode"
hotkey_keys = list("R")
classic_keys = list("Southwest") // END
name = "toggle_throw_mode"
full_name = "Toggle throw mode"
description = "Toggle throwing the current item or not."
category = CATEGORY_CARBON
@@ -19,19 +20,21 @@
/datum/keybinding/carbon/select_help_intent
key = "1"
hotkey_keys = list("1")
name = "select_help_intent"
full_name = "Select help intent"
description = ""
category = CATEGORY_CARBON
/datum/keybinding/carbon/select_help_intent/down(client/user)
if(iscyborg(user.mob))
return FALSE
user.mob?.a_intent_change(INTENT_HELP)
return TRUE
/datum/keybinding/carbon/select_disarm_intent
key = "2"
hotkey_keys = list("2")
name = "select_disarm_intent"
full_name = "Select disarm intent"
description = ""
@@ -43,7 +46,7 @@
/datum/keybinding/carbon/select_grab_intent
key = "3"
hotkey_keys = list("3")
name = "select_grab_intent"
full_name = "Select grab intent"
description = ""
@@ -55,12 +58,14 @@
/datum/keybinding/carbon/select_harm_intent
key = "4"
hotkey_keys = list("4")
name = "select_harm_intent"
full_name = "Select harm intent"
description = ""
category = CATEGORY_CARBON
/datum/keybinding/carbon/select_harm_intent/down(client/user)
if(iscyborg(user.mob))
return FALSE
user.mob?.a_intent_change(INTENT_HARM)
return TRUE
+20 -20
View File
@@ -1,35 +1,35 @@
/datum/keybinding/client
category = CATEGORY_CLIENT
weight = WEIGHT_HIGHEST
category = CATEGORY_CLIENT
weight = WEIGHT_HIGHEST
/datum/keybinding/client/admin_help
key = "F1"
name = "admin_help"
full_name = "Admin Help"
description = "Ask an admin for help."
hotkey_keys = list("F1")
name = "admin_help"
full_name = "Admin Help"
description = "Ask an admin for help."
/datum/keybinding/client/admin_help/down(client/user)
user.get_adminhelp()
return TRUE
user.get_adminhelp()
return TRUE
/datum/keybinding/client/screenshot
key = "F2"
name = "screenshot"
full_name = "Screenshot"
description = "Take a screenshot."
hotkey_keys = list("F2")
name = "screenshot"
full_name = "Screenshot"
description = "Take a screenshot."
/datum/keybinding/client/screenshot/down(client/user)
winset(user, null, "command=.screenshot [!user.keys_held["shift"] ? "auto" : ""]")
return TRUE
winset(user, null, "command=.screenshot [!user.keys_held["shift"] ? "auto" : ""]")
return TRUE
/datum/keybinding/client/minimal_hud
key = "F12"
name = "minimal_hud"
full_name = "Minimal HUD"
description = "Hide most HUD features"
hotkey_keys = list("F12")
name = "minimal_hud"
full_name = "Minimal HUD"
description = "Hide most HUD features"
/datum/keybinding/client/minimal_hud/down(client/user)
user.mob.button_pressed_F12()
return TRUE
user.mob.button_pressed_F12()
return TRUE
+17 -17
View File
@@ -1,37 +1,37 @@
/datum/keybinding/human
category = CATEGORY_HUMAN
weight = WEIGHT_MOB
category = CATEGORY_HUMAN
weight = WEIGHT_MOB
/datum/keybinding/human/quick_equip
key = "E"
hotkey_keys = list("E")
name = "quick_equip"
full_name = "Quick Equip"
description = "Quickly puts an item in the best slot available"
/datum/keybinding/human/quick_equip/down(client/user)
var/mob/living/carbon/human/H = user.mob
H.quick_equip()
return TRUE
var/mob/living/carbon/human/H = user.mob
H.quick_equip()
return TRUE
/datum/keybinding/human/quick_equipbelt
key = "Shift-E"
name = "quick_equipbelt"
full_name = "Quick equip belt"
description = "Put held thing in belt or take out most recent thing from belt"
hotkey_keys = list("ShiftE")
name = "quick_equipbelt"
full_name = "Quick equip belt"
description = "Put held thing in belt or take out most recent thing from belt"
/datum/keybinding/human/quick_equipbelt/down(client/user)
var/mob/living/carbon/human/H = user.mob
H.smart_equipbelt()
return TRUE
var/mob/living/carbon/human/H = user.mob
H.smart_equipbelt()
return TRUE
/datum/keybinding/human/bag_equip
key = "Shift-B"
hotkey_keys = list("ShiftB")
name = "bag_equip"
full_name = "Bag equip"
description = "Put held thing in backpack or take out most recent thing from backpack"
/datum/keybinding/human/bag_equip/down(client/user)
var/mob/living/carbon/human/H = user.mob
H.smart_equipbag()
return TRUE
var/mob/living/carbon/human/H = user.mob
H.smart_equipbag()
return TRUE
+9 -9
View File
@@ -1,15 +1,15 @@
/datum/keybinding/living
category = CATEGORY_HUMAN
weight = WEIGHT_MOB
category = CATEGORY_HUMAN
weight = WEIGHT_MOB
/datum/keybinding/living/resist
key = "B"
name = "resist"
full_name = "Resist"
description = "Break free of your current state. Handcuffed? on fire? Resist!"
hotkey_keys = list("B")
name = "resist"
full_name = "Resist"
description = "Break free of your current state. Handcuffed? on fire? Resist!"
/datum/keybinding/living/resist/down(client/user)
var/mob/living/L = user.mob
L.resist()
return TRUE
var/mob/living/L = user.mob
L.resist()
return TRUE
+26 -19
View File
@@ -4,7 +4,8 @@
/datum/keybinding/mob/face_north
key = "Ctrl-W"
hotkey_keys = list("CtrlW", "CtrlNorth")
classic_keys = list("CtrlNorth")
name = "face_north"
full_name = "Face North"
description = ""
@@ -16,7 +17,8 @@
/datum/keybinding/mob/face_east
key = "Ctrl-D"
hotkey_keys = list("CtrlD", "CtrlEast")
classic_keys = list("CtrlEast")
name = "face_east"
full_name = "Face East"
description = ""
@@ -28,7 +30,8 @@
/datum/keybinding/mob/face_south
key = "Ctrl-S"
hotkey_keys = list("CtrlS", "CtrlSouth")
classic_keys = list("CtrlSouth")
name = "face_south"
full_name = "Face South"
description = ""
@@ -39,7 +42,8 @@
return TRUE
/datum/keybinding/mob/face_west
key = "Ctrl-A"
hotkey_keys = list("CtrlA", "CtrlWest")
classic_keys = list("CtrlWest")
name = "face_west"
full_name = "Face West"
description = ""
@@ -50,7 +54,8 @@
return TRUE
/datum/keybinding/mob/stop_pulling
key = "H"
hotkey_keys = list("H", "Delete")
classic_keys = list("Delete")
name = "stop_pulling"
full_name = "Stop pulling"
description = ""
@@ -64,7 +69,7 @@
return TRUE
/datum/keybinding/mob/cycle_intent_right
key = "Home"
hotkey_keys = list("Northwest") // HOME
name = "cycle_intent_right"
full_name = "cycle intent right"
description = ""
@@ -75,7 +80,7 @@
return TRUE
/datum/keybinding/mob/cycle_intent_left
key = "Insert"
hotkey_keys = list("Insert")
name = "cycle_intent_left"
full_name = "cycle intent left"
description = ""
@@ -86,7 +91,8 @@
return TRUE
/datum/keybinding/mob/swap_hands
key = "X"
hotkey_keys = list("X")
classic_keys = list("Northeast") // PAGEUP
name = "swap_hands"
full_name = "Swap hands"
description = ""
@@ -97,7 +103,8 @@
return TRUE
/datum/keybinding/mob/activate_inhand
key = "Z"
hotkey_keys = list("Z")
classic_keys = list("Southeast") // PAGEDOWN
name = "activate_inhand"
full_name = "Activate in-hand"
description = "Uses whatever item you have inhand"
@@ -108,7 +115,7 @@
return TRUE
/datum/keybinding/mob/drop_item
key = "Q"
hotkey_keys = list("Q")
name = "drop_item"
full_name = "Drop Item"
description = ""
@@ -125,7 +132,7 @@
return TRUE
/datum/keybinding/mob/toggle_move_intent
key = "Alt"
hotkey_keys = list("Alt")
name = "toggle_move_intent"
full_name = "Hold to toggle move intent"
description = "Held down to cycle to the other move intent, release to cycle back"
@@ -141,7 +148,7 @@
return TRUE
/datum/keybinding/mob/toggle_move_intent_alternative
key = "Unbound"
hotkey_keys = list("Unbound")
name = "toggle_move_intent_alt"
full_name = "press to cycle move intent"
description = "Pressing this cycle to the opposite move intent, does not cycle back"
@@ -152,7 +159,7 @@
return TRUE
/datum/keybinding/mob/target_head_cycle
key = "Numpad8"
hotkey_keys = list("Numpad8")
name = "target_head_cycle"
full_name = "Target: Cycle head"
description = ""
@@ -162,7 +169,7 @@
return TRUE
/datum/keybinding/mob/target_r_arm
key = "Numpad4"
hotkey_keys = list("Numpad4")
name = "target_r_arm"
full_name = "Target: right arm"
description = ""
@@ -172,7 +179,7 @@
return TRUE
/datum/keybinding/mob/target_body_chest
key = "Numpad5"
hotkey_keys = list("Numpad5")
name = "target_body_chest"
full_name = "Target: Body"
description = ""
@@ -182,7 +189,7 @@
return TRUE
/datum/keybinding/mob/target_left_arm
key = "Numpad6"
hotkey_keys = list("Numpad6")
name = "target_left_arm"
full_name = "Target: left arm"
description = ""
@@ -192,7 +199,7 @@
return TRUE
/datum/keybinding/mob/target_right_leg
key = "Numpad1"
hotkey_keys = list("Numpad1")
name = "target_right_leg"
full_name = "Target: Right leg"
description = ""
@@ -202,7 +209,7 @@
return TRUE
/datum/keybinding/mob/target_body_groin
key = "Numpad2"
hotkey_keys = list("Numpad2")
name = "target_body_groin"
full_name = "Target: Groin"
description = ""
@@ -212,7 +219,7 @@
return TRUE
/datum/keybinding/mob/target_left_leg
key = "Numpad3"
hotkey_keys = list("Numpad3")
name = "target_left_leg"
full_name = "Target: left leg"
description = ""
+8 -4
View File
@@ -3,25 +3,29 @@
weight = WEIGHT_HIGHEST
/datum/keybinding/movement/north
key = "W"
hotkey_keys = list("W", "North")
classic_keys = list("North")
name = "North"
full_name = "Move North"
description = "Moves your character north"
/datum/keybinding/movement/south
key = "S"
hotkey_keys = list("S", "South")
classic_keys = list("South")
name = "South"
full_name = "Move South"
description = "Moves your character south"
/datum/keybinding/movement/west
key = "A"
hotkey_keys = list("A", "West")
classic_keys = list("West")
name = "West"
full_name = "Move West"
description = "Moves your character left"
/datum/keybinding/movement/east
key = "D"
hotkey_keys = list("D", "East")
classic_keys = list("East")
name = "East"
full_name = "Move East"
description = "Moves your character east"
+5 -5
View File
@@ -4,7 +4,7 @@
/datum/keybinding/robot/moduleone
key = "1"
hotkey_keys = list("1")
name = "module_one"
full_name = "Toggle module 1"
description = "Equips or unequips the first module"
@@ -17,7 +17,7 @@
return TRUE
/datum/keybinding/robot/moduletwo
key = "2"
hotkey_keys = list("2")
name = "module_two"
full_name = "Toggle module 2"
description = "Equips or unequips the second module"
@@ -30,7 +30,7 @@
return TRUE
/datum/keybinding/robot/modulethree
key = "3"
hotkey_keys = list("3")
name = "module_three"
full_name = "Toggle module 3"
description = "Equips or unequips the third module"
@@ -43,7 +43,7 @@
return TRUE
/datum/keybinding/robot/intent_cycle
key = "4"
hotkey_keys = list("4")
name = "cycle_intent"
full_name = "Cycle intent left"
description = "Cycles the intent left"
@@ -56,7 +56,7 @@
return TRUE
/datum/keybinding/robot/unequip_module
key = "Q"
hotkey_keys = list("Q")
name = "unequip_module"
full_name = "Unequip module"
description = "Unequips the active module"