Skip to content

Commit

Permalink
Server side tgsay commands to fix tgsay opening when input is expecte…
Browse files Browse the repository at this point in the history
…d for a window
  • Loading branch information
Drulikar committed May 19, 2024
1 parent 935de53 commit e4a085f
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 14 deletions.
67 changes: 67 additions & 0 deletions code/datums/keybinding/communication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,63 @@
full_name = "IC Say"
keybind_signal = COMSIG_KB_CLIENT_SAY_DOWN

/datum/keybinding/client/communication/say/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
winset(user, null, "command=[user.tgui_say_create_open_command(SAY_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/ooc
hotkey_keys = list("O")
classic_keys = list("F2")
name = OOC_CHANNEL
full_name = "Out Of Character Say (OOC)"
keybind_signal = COMSIG_KB_CLIENT_OOC_DOWN

/datum/keybinding/client/communication/ooc/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
winset(user, null, "command=[user.tgui_say_create_open_command(OOC_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/looc
hotkey_keys = list("L")
classic_keys = list("Unbound")
name = LOOC_CHANNEL
full_name = "Local Out Of Character Say (OOC)"
keybind_signal = COMSIG_KB_CLIENT_LOOC_DOWN

/datum/keybinding/client/communication/looc/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
winset(user, null, "command=[user.tgui_say_create_open_command(LOOC_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/me
hotkey_keys = list("M")
classic_keys = list("F4")
name = ME_CHANNEL
full_name = "Custom Emote (/Me)"
keybind_signal = COMSIG_KB_CLIENT_ME_DOWN

/datum/keybinding/client/communication/me/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
winset(user, null, "command=[user.tgui_say_create_open_command(ME_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/whisper
hotkey_keys = list("Unbound")
classic_keys = list("Unbound")
Expand All @@ -42,6 +78,15 @@
full_name = "IC Comms (;)"
keybind_signal = COMSIG_KG_CLIENT_RADIO_DOWN

/datum/keybinding/client/communication/radiochannels/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
winset(user, null, "command=[user.tgui_say_create_open_command(COMMS_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/asay
hotkey_keys = list("F3")
classic_keys = list("F5")
Expand All @@ -50,10 +95,32 @@
description = "Talk with other admins."
keybind_signal = COMSIG_KB_ADMIN_ASAY_DOWN

/datum/keybinding/client/communication/asay/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
if(!user.admin_holder?.check_for_rights(R_MOD))
return
winset(user, null, "command=[user.tgui_say_create_open_command(ADMIN_CHANNEL)]")
return TRUE

/datum/keybinding/client/communication/mentor_say
hotkey_keys = list("Unbound")
classic_keys = list("Unbound")
name = MENTOR_CHANNEL
full_name = "Mentor Say"
description = "Talk with other mentors."
keybind_signal = COMSIG_KB_ADMIN_MENTORSAY_DOWN

/datum/keybinding/client/communication/mentor_say/down(client/user)
. = ..()
if(.)
return
if(!user.prefs.tgui_say)
return
if(!user.admin_holder?.check_for_rights(R_MENTOR))
return
winset(user, null, "command=[user.tgui_say_create_open_command(MENTOR_CHANNEL)]")
return TRUE
21 changes: 7 additions & 14 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -683,48 +683,41 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
movement_keys[key] = SOUTH
if(SAY_CHANNEL)
if(prefs.tgui_say)
var/say = tgui_say_create_open_command(SAY_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[say]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=\"say\\n.typing\"")
if(COMMS_CHANNEL)
if(prefs.tgui_say)
var/radio = tgui_say_create_open_command(COMMS_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[radio]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=\"say\\n.typing\"")
if(ME_CHANNEL)
if(prefs.tgui_say)
var/me = tgui_say_create_open_command(ME_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[me]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=\"me\\n.typing\"")
if(OOC_CHANNEL)
if(prefs.tgui_say)
var/ooc = tgui_say_create_open_command(OOC_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[ooc]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=ooc")
if(LOOC_CHANNEL)
if(prefs.tgui_say)
var/looc = tgui_say_create_open_command(LOOC_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[looc]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=looc")
if(ADMIN_CHANNEL)
if(admin_holder?.check_for_rights(R_MOD))
if(prefs.tgui_say)
var/asay = tgui_say_create_open_command(ADMIN_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[asay]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=asay")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
if(MENTOR_CHANNEL)
if(admin_holder?.check_for_rights(R_MENTOR))
if(prefs.tgui_say)
var/mentor = tgui_say_create_open_command(MENTOR_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[mentor]")
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=")
else
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=mentorsay")
else
Expand Down

0 comments on commit e4a085f

Please sign in to comment.