-
-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes custom bubbles/typing indicators after 3 years. Adds new animat…
…ed ones. (#11968) * at last, bubbles are fixed * traitify variable tgstation/tgstation#80122 * commandbar nice tgstation/tgstation#83081
- Loading branch information
1 parent
bf02393
commit d9b15bc
Showing
13 changed files
with
170 additions
and
40 deletions.
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
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
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,70 @@ | ||
#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 (!typing_indicators) //check pref | ||
// return | ||
if (length(href_list["verb"]) < 1 || !(LOWER_TEXT(href_list["verb"]) in IC_VERBS) || text2num(href_list["argument_length"]) < 1) | ||
if (commandbar_typing) | ||
commandbar_typing = FALSE | ||
stop_typing() | ||
|
||
if (commandbar_thinking) | ||
commandbar_thinking = FALSE | ||
stop_thinking() | ||
return | ||
|
||
if (!commandbar_thinking) | ||
commandbar_thinking = TRUE | ||
start_thinking() | ||
|
||
if (!commandbar_typing) | ||
commandbar_typing = TRUE | ||
start_typing() | ||
|
||
|
||
/** Sets the mob as "thinking" - with indicator and the TRAIT_THINKING_IN_CHARACTER trait */ | ||
/client/proc/start_thinking() | ||
//if(!typing_indicators) | ||
// return FALSE | ||
/// Special exemptions | ||
if(isabductor(mob)) | ||
return FALSE | ||
ADD_TRAIT(mob, TRAIT_THINKING_IN_CHARACTER, CURRENTLY_TYPING_TRAIT) | ||
mob.create_thinking_indicator() | ||
|
||
/** Removes typing/thinking indicators and flags the mob as not thinking */ | ||
/client/proc/stop_thinking() | ||
mob?.remove_all_indicators() | ||
|
||
/** | ||
* Handles the user typing. After a brief period of inactivity, | ||
* signals the client mob to revert to the "thinking" icon. | ||
*/ | ||
/client/proc/start_typing() | ||
var/mob/client_mob = mob | ||
client_mob.remove_thinking_indicator() | ||
if(!HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER)) | ||
return FALSE | ||
client_mob.create_typing_indicator() | ||
addtimer(CALLBACK(src, PROC_REF(stop_typing)), 5 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE) | ||
|
||
/** | ||
* Callback to remove the typing indicator after a brief period of inactivity. | ||
* If the user was typing IC, the thinking indicator is shown. | ||
*/ | ||
/client/proc/stop_typing() | ||
if(isnull(mob)) | ||
return FALSE | ||
var/mob/client_mob = mob | ||
client_mob.remove_typing_indicator() | ||
if(!HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER)) | ||
return FALSE | ||
client_mob.create_thinking_indicator() | ||
|
||
#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
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,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> |
Binary file not shown.
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