-
-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ports 'Command bar typing indicators (client side html version)' (#3080)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request Directly ports tgstation/tgstation#83081, allowing typing indicators to trigger off of the command bar. <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game Typing indicators are there for a reason! It's helpful to know if another player is cooking a message for thirty seconds or just staring at you. However, a good chunk of our players exclusively use the command bar to send messages, leaving us in the dark! This helps level the playing field. <!-- Please add a short description of why you think these changes would benefit the game. If you can't justify it in words, it might not be worth adding. --> ## Changelog :cl: add: typing indicators now trigger off of the command bar /:cl: <!-- Both :cl:'s are required for the changelog to work! You can put your name to the right of the first :cl: if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
- Loading branch information
1 parent
8c61894
commit ec5f8d6
Showing
6 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#define IC_VERBS list("say", "me", "whisper") | ||
|
||
/client/var/commandbar_thinking = FALSE | ||
/client/var/commandbar_typing = FALSE | ||
|
||
/client/proc/initialize_commandbar_spy() | ||
src << output('html/typing_indicator.html', "commandbar_spy") | ||
|
||
/client/proc/handle_commandbar_typing(href_list) | ||
if (length(href_list["verb"]) < 1 || !(lowertext(href_list["verb"]) in IC_VERBS) || text2num(href_list["argument_length"]) < 1) | ||
if (commandbar_typing) | ||
commandbar_typing = FALSE | ||
stop_typing() | ||
return | ||
|
||
if (!commandbar_typing) | ||
commandbar_typing = TRUE | ||
start_typing() | ||
|
||
/client/proc/start_typing() | ||
mob.set_typing_indicator(TRUE) | ||
|
||
/client/proc/stop_typing() | ||
if(isnull(mob)) | ||
return FALSE | ||
mob.set_typing_indicator(FALSE) | ||
|
||
#undef IC_VERBS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
</head> | ||
<body> | ||
<script> | ||
lastseentypedtext = ""; | ||
function getoutput() { | ||
setTimeout(getoutput, 1000); | ||
window.location = "byond://winget?callback=checkoutput&id=:Input&property=text"; | ||
} | ||
function checkoutput(props) { | ||
if (typeof props !== 'object') | ||
return; | ||
|
||
if (typeof props.text !== 'string' && !(props.text instanceof String)) | ||
return; | ||
|
||
var text = props.text; | ||
|
||
if (text == lastseentypedtext) | ||
return; | ||
|
||
lastseentypedtext = text; | ||
|
||
var words = text.split(" "); | ||
var verb = words[0]; | ||
var argument = ""; | ||
var argument_length = -1; | ||
|
||
if (words.length >= 2) { | ||
words.splice(0, 1) | ||
argument = words.join(" "); | ||
argument_length = argument.length; | ||
} | ||
|
||
if (argument_length > 0 && argument[0] == "\"") | ||
argument_length -= 1; | ||
|
||
window.location = "byond://?commandbar_typing=1&verb="+encodeURIComponent(verb)+"&argument_length="+argument_length; | ||
} | ||
setTimeout(getoutput, 2000); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters