This commit is contained in:
timothyteakettle
2020-11-17 01:41:19 +00:00
parent e8bd56a92d
commit 60077f028e
7 changed files with 44 additions and 15 deletions

View File

@@ -52,10 +52,7 @@ SUBSYSTEM_DEF(input)
for(var/i in 65 to 90)
classic_ctrl_override_keys += ascii2text(i)
// let's play the game of clientside bind overrides!
classic_ctrl_override_keys -= list("T", "O", "M", "L")
macroset_classic_input["Ctrl+T"] = "say"
macroset_classic_input["Ctrl+O"] = "ooc"
macroset_classic_input["Ctrl+L"] = "looc"
classic_ctrl_override_keys -= list("M")
// let's play the list iteration game x2
for(var/key in classic_ctrl_override_keys)
// make sure to double double quote to ensure things are treated as a key combo instead of addition/semicolon logic.
@@ -70,10 +67,7 @@ SUBSYSTEM_DEF(input)
// HAHA - SIKE. Because of BYOND weirdness (tl;dr not specifically binding this way results in potentially duplicate chatboxes when
// conflicts occur with something like say indicator vs say), we're going to snowflake this anyways
var/list/hard_binds = list(
"O" = "ooc",
"T" = "say",
"L" = "looc",
"M" = "me"
"L" = "looc"
)
var/list/hard_bind_anti_collision = list()
var/list/anti_collision_modifiers = list("Ctrl", "Alt", "Shift", "Ctrl+Alt", "Ctrl+Shift", "Alt+Shift", "Ctrl+Alt+Shift")
@@ -110,7 +104,6 @@ SUBSYSTEM_DEF(input)
for(var/i in 1 to clients.len)
var/client/user = clients[i]
user.set_macros()
user.update_movement_keys()
/datum/controller/subsystem/input/fire()
var/list/clients = GLOB.clients // Let's sing the list cache song

View File

@@ -478,7 +478,6 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
/client/proc/ensure_keys_set()
if(SSinput.initialized)
set_macros()
update_movement_keys(prefs)
//////////////
//DISCONNECT//
@@ -937,7 +936,16 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
y = clamp(y+change, min,max)
view_size.setDefault("[x]x[y]")
/client/proc/update_movement_keys(datum/preferences/direct_prefs)
/**
* Updates the keybinds for special keys
*
* Handles adding macros for the keys that need it
* And adding movement keys to the clients movement_keys list
* At the time of writing this, communication(OOC, Say, IC) require macros
* Arguments:
* * direct_prefs - the preference we're going to get keybinds from
*/
/client/proc/update_special_keybinds(datum/preferences/direct_prefs)
var/datum/preferences/D = prefs || direct_prefs
if(!D?.key_bindings)
return
@@ -953,6 +961,12 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
movement_keys[key] = WEST
if("South")
movement_keys[key] = SOUTH
if("Say")
winset(src, "default-[REF(key)]", "parent=default;name=[key];command=say")
if("OOC")
winset(src, "default-[REF(key)]", "parent=default;name=[key];command=ooc")
if("Me")
winset(src, "default-[REF(key)]", "parent=default;name=[key];command=me")
/client/proc/change_view(new_size)
if (isnull(new_size))

View File

@@ -284,7 +284,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
//we couldn't load character data so just randomize the character appearance + name
random_character() //let's create a random character then - rather than a fat, bald and naked man.
key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key) // give them default keybinds and update their movement keys
C?.update_movement_keys(src)
C?.set_macros()
real_name = pref_species.random_name(gender,1)
if(!loaded_preferences_successfully)
save_preferences()
@@ -2370,9 +2370,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
if(key_bindings[old_key])
key_bindings[old_key] -= kb_name
LAZYADD(key_bindings["Unbound"], kb_name)
if(!length(key_bindings[old_key]))
key_bindings -= old_key
user << browse(null, "window=capturekeypress")
user.client.set_macros()
save_preferences()
ShowChoices(user)
return
@@ -2407,7 +2409,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
key_bindings -= old_key
key_bindings[full_key] += list(kb_name)
key_bindings[full_key] = sortList(key_bindings[full_key])
user.client.update_movement_keys()
user.client.set_macros()
user << browse(null, "window=capturekeypress")
save_preferences()
@@ -2419,7 +2421,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
hotkeys = (choice == "Hotkey")
key_bindings = (hotkeys) ? deepCopyList(GLOB.hotkey_keybinding_list_by_key) : deepCopyList(GLOB.classic_keybinding_list_by_key)
modless_key_bindings = list()
user.client.update_movement_keys()
user.client.set_macros()
if("chat_on_map")
chat_on_map = !chat_on_map
@@ -2831,7 +2833,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
for(var/key in oldkeys)
if(!key_bindings[key])
key_bindings[key] = oldkeys[key]
parent.update_movement_keys()
parent.update_special_keybinds()
/datum/preferences/proc/is_loadout_slot_available(slot)
var/list/L

View File

@@ -9,6 +9,7 @@
#define CATEGORY_MOVEMENT "MOVEMENT"
#define CATEGORY_TARGETING "TARGETING"
#define CATEGORY_COMBAT "COMBAT"
#define CATEGORY_COMMUNICATION "COMMUNICATION"
#define WEIGHT_HIGHEST 0
#define WEIGHT_ADMIN 10

View File

@@ -0,0 +1,17 @@
/datum/keybinding/client/communication
category = CATEGORY_COMMUNICATION
/datum/keybinding/client/communication/say
hotkey_keys = list("T")
name = "Say"
full_name = "IC Say"
/datum/keybinding/client/communication/ooc
hotkey_keys = list("O")
name = "OOC"
full_name = "Out Of Character Say (OOC)"
/datum/keybinding/client/communication/me
hotkey_keys = list("M")
name = "Me"
full_name = "Custom Emote (/Me)"

View File

@@ -25,6 +25,7 @@
var/key = macroset[i]
var/command = macroset[key]
winset(src, "[name]-[REF(key)]", "parent=[name];name=[key];command=[command]")
update_special_keybinds()
/client/proc/set_macros(datum/preferences/prefs_override = prefs)
set waitfor = FALSE

View File

@@ -2298,6 +2298,7 @@
#include "code\modules\keybindings\keybind\carbon.dm"
#include "code\modules\keybindings\keybind\client.dm"
#include "code\modules\keybindings\keybind\combat.dm"
#include "code\modules\keybindings\keybind\communication.dm"
#include "code\modules\keybindings\keybind\emote.dm"
#include "code\modules\keybindings\keybind\human.dm"
#include "code\modules\keybindings\keybind\living.dm"