Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Фикс отваливания кнопок общения при коннекте с русской раскладкой. #12763

Merged
merged 3 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions code/__HELPERS/wrappers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,28 @@

/proc/_step(ref, dir)
step(ref, dir)

// used in hotkeys so that we can call proc instead of winset(src, null, "command=say")
/mob/proc/say_wrapper()
set_typing_indicator(TRUE)
var/message = input("","say (text)") as text|null
if(message)
say_verb(message)
set_typing_indicator(FALSE)

/mob/proc/me_wrapper()
set_typing_indicator(TRUE)
var/message = input("","me (text)") as text|null
if(message)
me_verb(message)
set_typing_indicator(FALSE)

/client/proc/ooc_wrapper()
var/message = input("","ooc (text)") as text|null
if(message)
ooc(message)

/client/proc/looc_wrapper()
var/message = input("","looc (text)") as text|null
if(message)
looc(message)
14 changes: 13 additions & 1 deletion code/datums/keybinding/communication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,33 @@
name = "Say"
full_name = "IC Say"

/datum/keybinding/client/communication/say/down(client/user)
user.mob.say_wrapper()
return TRUE

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

/datum/keybinding/client/communication/ooc/down(client/user)
user.ooc_wrapper()
return TRUE

/datum/keybinding/client/communication/looc
hotkey_keys = list("L")
name = "LOOC"
full_name = "Local Out Of Character Say (LOOC)"

/datum/keybinding/client/communication/looc/down(client/user)
user.looc()
user.looc_wrapper()
return TRUE

/datum/keybinding/client/communication/me
hotkey_keys = list("F4", "M")
name = "Me"
full_name = "Custom Emote (/Me)"

/datum/keybinding/client/communication/me/down(client/user)
user.mob.me_wrapper()
return TRUE
23 changes: 7 additions & 16 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ var/global/list/blacklisted_builds = list(
if(!D?.key_bindings)
return
movement_keys = list()
var/list/communication_hotkeys = list()
var/list/testing_hotkeys = list()
for(var/key in D.key_bindings)
for(var/kb_name in D.key_bindings[key])
switch(kb_name)
Expand All @@ -782,23 +782,14 @@ var/global/list/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") // ".say" is wrapper over say, see in code\modules\mob\typing_indicator.dm
communication_hotkeys += key
if("OOC")
winset(src, "default-\ref[key]", "parent=default;name=[key];command=ooc")
communication_hotkeys += key
if("Me")
winset(src, "default-\ref[key]", "parent=default;name=[key];command=.me")
communication_hotkeys += key
if("LOOC")
winset(src, "default-\ref[key]", "parent=default;name=[key];command=looc")
communication_hotkeys += key
/*if("Say")
winset(src, "default-[key]", "parent=default;name=[key];command=.say")
testing_hotkeys += key*/

// winget() does not work for F1 and F2
for(var/key in communication_hotkeys)
if(!(key in list("F1","F2")) && !winget(src, "default-\ref[key]", "command"))
to_chat(src, "Вероятно Вы вошли в игру с русской раскладкой клавиатуры.\n<a href='?src=\ref[src];reset_macros=1'>Пожалуйста, переключитесь на английскую раскладку и кликните сюда, чтобы исправить хоткеи коммуникаций.</a>")
for(var/key in testing_hotkeys)
if(!(key in list("F1","F2")) && !winget(src, "default-[key]", "command"))
to_chat(src, "Вероятно Вы вошли в игру с русской раскладкой клавиатуры и у вас поломался [key] хоткий.\nПожалуйста, потыкайте кодеров чем-нибудь на предмет использования winset() для макросов на кнопках.")
break

#define MAXIMAZED (1<<0)
Expand Down
20 changes: 0 additions & 20 deletions code/modules/mob/typing_indicator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,3 @@
else
vis_contents -= typing_indicator
typing = FALSE

/mob/verb/say_wrapper()
set name = ".Say"
set hidden = TRUE

set_typing_indicator(TRUE)
var/message = input("","say (text)") as text|null
if(message)
say_verb(message)
set_typing_indicator(FALSE)

/mob/verb/emote_wrapper()
set name = ".Me"
set hidden = TRUE

set_typing_indicator(TRUE)
var/message = input("","me (text)") as text|null
if(message)
me_verb(message)
set_typing_indicator(FALSE)
Loading