Hooks called by Display Typing

Summary

Hooks

Lets plugins scale the distance from which the typing bubble of a player is visible.
Asks what kind of speech a player is typing, which decides the label, the color and the range of their typing bubble.
Asks for the label of the typing bubble of a player.
Asks whether other players may see that a player is typing.
Called on the server when a player starts typing in the chatbox, that is when the first report of a text arrives from their client.
Called on the server when a player is no longer typing: they have sent or cleared the text, closed the chatbox, left the server, or reported nothing for DisplayTyping.idle_timeout seconds.
Flux's ShouldHUDPaint hook, asked again here before the typing bubbles are drawn, so that whatever hides the HUD hides the bubbles as well.

Hooks

DisplayTypingAdjustFadeoffMultiplier(target, text)

client plugins/displaytyping/plugin/cl_plugin.lua:105

Lets plugins scale the distance from which the typing bubble of a player is visible. Called on the client right after the DisplayTypingTextType hook, under the same conditions.

Parameters

  • target Player the player who is typing
  • text String the text being typed, or its outline (see DisplayTyping:outline) if the viewer may not see the text itself

Returns

  • Number multiplier of the squared distance at which the bubble has faded out, so 4 doubles the range; 1 when nothing is returned

Called from

Call sites

DisplayTypingGetKind(target, text)

client plugins/displaytyping/plugin/cl_plugin.lua:67

Asks what kind of speech a player is typing, which decides the label, the color and the range of their typing bubble. Called on the client whenever the text of a typing player nearby changes, and for the local player on every change of their own text, to decide what is reported to the server. The text is the outline of what is typed (see DisplayTyping:outline) whenever the viewer may not see the text itself, so look at what it starts and ends with.

Parameters

  • target Player the player who is typing
  • text String the text being typed, or its outline

Returns

  • String/Map/Boolean ID of a kind registered with DisplayTyping:register_kind; or a kind definition with the same fields; or false to show no bubble for this text. When nothing is returned the DisplayTypingTextType and DisplayTypingAdjustFadeoffMultiplier hooks are asked instead

Called from

Call sites

DisplayTypingTextType(target, text)

client plugins/displaytyping/plugin/cl_plugin.lua:96

Asks for the label of the typing bubble of a player. Called on the client when the DisplayTypingGetKind hook has not decided the kind of speech: whenever the text of a typing player nearby changes, and for the local player on every change of their own text. A text that gets a label is treated as speech, so it may be shown as it is typed even if it is a command.

Parameters

  • target Player the player who is typing
  • text String the text being typed, or its outline (see DisplayTyping:outline) if the viewer may not see the text itself

Returns

  • String label to draw; the translated 'typing' label is used when nothing is returned

Called from

Call sites

PlayerCanDisplayTyping(actor)

server plugins/displaytyping/plugin/sv_plugin.lua:48

Asks whether other players may see that a player is typing. Called on the server for every typing player who is alive and visible, each time their typing is about to be sent to the players nearby, which is up to five times a second.

Parameters

  • actor Player the typing player

Returns

  • Boolean return false to hide the typing of the player from everyone

Called from

Call sites

PlayerStartedTyping(actor, text)

server plugins/displaytyping/plugin/sv_plugin.lua:137

Called on the server when a player starts typing in the chatbox, that is when the first report of a text arrives from their client. A client can make this happen up to ten times a second, so limit anything costly or audible a handler does.

Parameters

  • actor Player the player who has started typing
  • text String the text so far if the client reported it as text that others may see, otherwise its outline (see DisplayTyping:outline)

Called from

Call sites

PlayerStoppedTyping(actor)

server plugins/displaytyping/plugin/sv_plugin.lua:174

Called on the server when a player is no longer typing: they have sent or cleared the text, closed the chatbox, left the server, or reported nothing for DisplayTyping.idle_timeout seconds.

Parameters

  • actor Player the player who has stopped typing

Called from

Call sites

Flux's ShouldHUDPaint hook, asked again here before the typing bubbles are drawn, so that whatever hides the HUD hides the bubbles as well. Called on the client on every HUD paint once the local player has been initialized.

Returns

  • Boolean Return false to hide the HUD and the typing bubbles with it

Called from

Call sites

Defined in