Module cmd

Source
Expand description

This module handles client-side chat commands and command processing.

It provides functionality for:

  • Defining client-side chat commands
  • Processing and executing commands (both client and server commands)
  • Command argument parsing and validation
  • Tab completion for command arguments
  • Entity targeting via special syntax (e.g., @target, @self)

The command system allows players to interact with the game through text commands prefixed with a slash (e.g., /help, /wiki).

Structsยง

ClientChatCommandIter
An iterator over the variants of ClientChatCommand
ClientEntityTargetIter ๐Ÿ”’
An iterator over the variants of ClientEntityTarget

Enumsยง

ChatCommandKind
Represents either a client-side or server-side command.
ClientChatCommand
Represents all available client-side chat commands.
ClientEntityTarget ๐Ÿ”’
Special entity targets that can be referenced in commands using @ syntax.

Traitsยง

TabComplete ๐Ÿ”’
Trait for types that can provide tab completion suggestions.

Functionsยง

complete
Main tab completion function for chat input.
complete_command ๐Ÿ”’
Returns a list of ClientChatCommand and ServerChatCommand names that start with the given partial input.
complete_player ๐Ÿ”’
Returns a list of player names that start with the given partial input.
complete_site ๐Ÿ”’
Returns a list of site names that start with the given partial input.
handle_clear ๐Ÿ”’
Handles ClientChatCommand::Unmute
handle_experimental_shader ๐Ÿ”’
Handles ClientChatCommand::ExperimentalShader
handle_help ๐Ÿ”’
Handles ClientChatCommand::Help
handle_mute ๐Ÿ”’
Handles ClientChatCommand::Mute
handle_unmute ๐Ÿ”’
Handles ClientChatCommand::Unmute
handle_waypoint ๐Ÿ”’
Handles ClientChatCommand::Waypoint
handle_wiki ๐Ÿ”’
Handles ClientChatCommand::Wiki
invalid_command_message ๐Ÿ”’
Generates a helpful error message when an invalid command is entered.
nth_word ๐Ÿ”’
Gets the byte index of the nth word in a string.
preproccess_command ๐Ÿ”’
Preprocesses command arguments before execution.
run_client_command ๐Ÿ”’
Executes a client-side command.
run_command
Runs a command by either sending it to the server or processing it locally.

Type Aliasesยง

CommandResult ๐Ÿ”’
Represents the feedback shown to the user of a command, if any. Server commands give their feedback as an event, so in those cases this will always be Ok(None). An Err variant will be be displayed with the error icon and text color.