tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.CommandManager Class Reference

This serves as the central class from which ModCommand functions are supported and carried out. More...

+ Collaboration diagram for Terraria.ModLoader.CommandManager:

Static Public Member Functions

static List< Tuple< string, string > > GetHelp (CommandType type)
 
static bool Matches (CommandType commandType, CommandType callerType)
 

Detailed Description

This serves as the central class from which ModCommand functions are supported and carried out.

Definition at line 12 of file CommandManager.cs.

Member Function Documentation

◆ GetHelp()

static List< Tuple< string, string > > Terraria.ModLoader.CommandManager.GetHelp ( CommandType  type)
static

Definition at line 114 of file CommandManager.cs.

114 {
115 var list = new List<Tuple<string, string>>();
116 foreach (var entry in Commands) {
117 var cmdList = entry.Value.Where(mc => Matches(mc.Type, type)).ToList();
118 foreach (var mc in cmdList) {
119 string cmd = mc.Command;
120 if (cmdList.Count > 1)
121 cmd = mc.mod.Name + ":" + cmd;
122
123 list.Add(Tuple.Create(cmd, mc.Description));
124 }
125 }
126 return list;
127 }
static bool Matches(CommandType commandType, CommandType callerType)

References Terraria.ModLoader.ModCommand.Command, and Terraria.ModLoader.CommandManager.Matches().

+ Here is the call graph for this function:

◆ Matches()

static bool Terraria.ModLoader.CommandManager.Matches ( CommandType  commandType,
CommandType  callerType 
)
static

Definition at line 16 of file CommandManager.cs.

16 {
17 if ((commandType & CommandType.World) != 0)
18 if (Main.netMode == 2)
19 commandType |= CommandType.Server;
20 else if (Main.netMode == 0)
21 commandType |= CommandType.Chat;
22
23 return (callerType & commandType) != 0;
24 }
CommandType
A flag enum representing context where this command operates.
Definition: ModCommand.cs:10

Referenced by Terraria.ModLoader.CommandManager.GetHelp().

+ Here is the caller graph for this function: