1using Microsoft.Xna.Framework;
3using Terraria.Localization;
35 void Reply(
string text, Color color =
default(Color));
44 public Mod mod {
get;
internal set; }
46 public string Name {
get;
internal set; }
64 internal Color color = Color.Red;
78 internal class ChatCommandCaller : CommandCaller
81 public Player Player => Main.player[Main.myPlayer];
83 public void Reply(
string text, Color color =
default(Color)) {
84 if (color ==
default(Color))
86 foreach (var line
in text.Split(
'\n'))
87 Main.NewText(line, color.R, color.G, color.B);
91 internal class PlayerCommandCaller : CommandCaller
93 public PlayerCommandCaller(Player player) {
98 public Player Player {
get; }
100 public void Reply(
string text, Color color =
default(Color)) {
101 if (color ==
default(Color))
103 foreach (var line
in text.Split(
'\n'))
104 NetMessage.SendChatMessageToClient(NetworkText.FromLiteral(line), color, Player.whoAmI);
108 internal class ConsoleCommandCaller : CommandCaller
111 public Player Player =>
null;
113 public void Reply(
string text, Color color =
default(Color)) {
114 foreach (var line
in text.Split(
'\n'))
This class represents a chat or console command. Use the CommandType to specify the scope of the comm...
abstract string Command
The desired text to trigger this command.
string Name
Internal name of this command.
abstract CommandType Type
A flag enum representing context where this command operates.
abstract void Action(CommandCaller caller, string input, string[] args)
The code that is executed when the command is triggered.
virtual bool Autoload(ref string name)
Autoload this command, defaults to Mod.Properties.Autoload.
virtual string Usage
A short usage explanation for this command.
virtual string Description
A short description of this command.
Mod mod
The Mod this ModCommand belongs to.
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
UsageException(string msg)
UsageException(string msg, Color color)
void Reply(string text, Color color=default(Color))
Use this to repond to the Player that invoked this command. This method handles writing to the consol...
Player Player
The Player object corresponding to the Player that invoked this command. Use this when the Player is ...
CommandType
A flag enum representing context where this command operates.
@ Chat
Command can be used in Chat in SP and MP.
@ Server
Command is executed by server in MP.
@ Console
Command can be used in server console during MP.
@ World
Command can be used in Chat in SP and MP, but executes on the Server in MP. (singleplayer ?...
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...