DebugConsole refactoring : available console commands are stored in a list of "Command" objects which contain the name, help text and the action that's invoked when the command is entered. Commands can also now be autocompleted in the client project by pressing tab (TODO: implement in the server project). + Now it should be easier to implement giving clients the permission to use specific console commands.
This commit is contained in:
@@ -42,17 +42,13 @@ namespace Barotrauma
|
|||||||
//listBox.Color = Color.Black * 0.7f;
|
//listBox.Color = Color.Black * 0.7f;
|
||||||
|
|
||||||
textBox = new GUITextBox(new Rectangle(0, 0, 0, 20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, "", frame);
|
textBox = new GUITextBox(new Rectangle(0, 0, 0, 20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, "", frame);
|
||||||
//textBox.Color = Color.Black * 0.7f;
|
textBox.OnTextChanged += (textBox, text) =>
|
||||||
|
{
|
||||||
//messages already added before initialization -> add them to the listbox
|
ResetAutoComplete();
|
||||||
List<ColoredText> unInitializedMessages = new List<ColoredText>(Messages);
|
return true;
|
||||||
Messages.Clear();
|
};
|
||||||
|
|
||||||
foreach (ColoredText msg in unInitializedMessages)
|
|
||||||
{
|
|
||||||
NewMessage(msg.Text, msg.Color);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NewMessage("Press F3 to open/close the debug console", Color.Cyan);
|
NewMessage("Press F3 to open/close the debug console", Color.Cyan);
|
||||||
NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan);
|
NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan);
|
||||||
|
|
||||||
@@ -105,6 +101,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
SelectMessage(1);
|
SelectMessage(1);
|
||||||
}
|
}
|
||||||
|
else if (PlayerInput.KeyHit(Keys.Tab))
|
||||||
|
{
|
||||||
|
textBox.Text = AutoComplete(textBox.Text);
|
||||||
|
}
|
||||||
|
|
||||||
if (PlayerInput.KeyHit(Keys.Enter))
|
if (PlayerInput.KeyHit(Keys.Enter))
|
||||||
{
|
{
|
||||||
@@ -195,390 +195,285 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ExecProjSpecific(string[] commands)
|
private static void InitProjectSpecific()
|
||||||
{
|
{
|
||||||
switch (commands[0].ToLowerInvariant())
|
commands.Add(new Command("startclient", "", (string[] args) =>
|
||||||
{
|
{
|
||||||
case "help":
|
if (args.Length == 0) return;
|
||||||
NewMessage("menu: go to main menu", Color.Cyan);
|
|
||||||
NewMessage("game: enter the \"game screen\"", Color.Cyan);
|
if (GameMain.Client == null)
|
||||||
NewMessage("edit: switch to submarine editor", Color.Cyan);
|
{
|
||||||
NewMessage("edit [submarine name]: load a submarine and switch to submarine editor", Color.Cyan);
|
GameMain.NetworkMember = new GameClient("Name");
|
||||||
NewMessage("load [submarine name]: load a submarine", Color.Cyan);
|
GameMain.Client.ConnectToServer(args[0]);
|
||||||
NewMessage("save [submarine name]: save the current submarine using the specified name", Color.Cyan);
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("mainmenuscreen|mainmenu|menu", "mainmenu/menu: Go to the main menu.", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.GameSession = null;
|
||||||
|
|
||||||
NewMessage("spawn [creaturename] [near/inside/outside]: spawn a creature at a random spawnpoint (use the second parameter to only select spawnpoints near/inside/outside the submarine)", Color.Cyan);
|
List<Character> characters = new List<Character>(Character.CharacterList);
|
||||||
NewMessage("spawnitem [itemname] [cursor/inventory]: spawn an item at the position of the cursor, in the inventory of the controlled character or at a random spawnpoint if the last parameter is omitted", Color.Cyan);
|
foreach (Character c in characters)
|
||||||
|
{
|
||||||
|
c.Remove();
|
||||||
|
}
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
GameMain.MainMenuScreen.Select();
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("lights: disable lighting", Color.Cyan);
|
commands.Add(new Command("gamescreen|game", "gamescreen/game: Go to the \"in-game\" view.", (string[] args) =>
|
||||||
NewMessage("los: disable the line of sight effect", Color.Cyan);
|
{
|
||||||
NewMessage("freecam: detach the camera from the controlled character", Color.Cyan);
|
|
||||||
NewMessage("control [character name]: start controlling the specified character", Color.Cyan);
|
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
}));
|
||||||
|
|
||||||
NewMessage("water: allows adding water into rooms or removing it by holding the left/right mouse buttons", Color.Cyan);
|
commands.Add(new Command("editsubscreen|editsub|subeditor", "editsub/subeditor: Switch to the submarine editor.", (string[] args) =>
|
||||||
NewMessage("fire: allows putting up fires by left clicking", Color.Cyan);
|
{
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
Submarine.Load(string.Join(" ", args), true);
|
||||||
|
}
|
||||||
|
GameMain.EditMapScreen.Select();
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("editcharacter", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.EditCharacterScreen.Select();
|
||||||
|
|
||||||
NewMessage("teleport: teleport the controlled character to the position of the cursor", Color.Cyan);
|
}));
|
||||||
NewMessage("teleport [character name]: teleport the specified character to the position of the cursor", Color.Cyan);
|
|
||||||
NewMessage("heal: restore the controlled character to full health", Color.Cyan);
|
|
||||||
NewMessage("heal [character name]: restore the specified character to full health", Color.Cyan);
|
|
||||||
NewMessage("revive: bring the controlled character back from the dead", Color.Cyan);
|
|
||||||
NewMessage("revive [character name]: bring the specified character back from the dead", Color.Cyan);
|
|
||||||
NewMessage("killmonsters: immediately kills all AI-controlled enemies in the level", Color.Cyan);
|
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("control|controlcharacter", "control [character name]: Start controlling the specified character.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length < 1) return;
|
||||||
|
|
||||||
NewMessage("fixwalls: fixes all the walls", Color.Cyan);
|
var character = FindMatchingCharacter(args, true);
|
||||||
NewMessage("fixitems: fixes every item/device in the sub", Color.Cyan);
|
|
||||||
NewMessage("oxygen: replenishes the oxygen in every room to 100%", Color.Cyan);
|
|
||||||
NewMessage("power [amount]: immediately sets the temperature of the reactor to the specified value", Color.Cyan);
|
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
if (character != null)
|
||||||
|
{
|
||||||
|
Character.Controlled = character;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("kick [name]: kick a player out from the server", Color.Cyan);
|
commands.Add(new Command("shake", "", (string[] args) =>
|
||||||
NewMessage("ban [name]: kick and ban the player from the server", Color.Cyan);
|
{
|
||||||
NewMessage("banip [IP address]: ban the IP address from the server", Color.Cyan);
|
GameMain.GameScreen.Cam.Shake = 10.0f;
|
||||||
NewMessage("debugdraw: toggles the \"debug draw mode\"", Color.Cyan);
|
}));
|
||||||
NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan);
|
|
||||||
|
|
||||||
break;
|
commands.Add(new Command("los", "los: Toggle the line of sight effect on/off.", (string[] args) =>
|
||||||
case "startclient":
|
{
|
||||||
if (commands.Length == 1) return true;
|
GameMain.LightManager.LosEnabled = !GameMain.LightManager.LosEnabled;
|
||||||
if (GameMain.Client == null)
|
NewMessage("Line of sight effect " + (GameMain.LightManager.LosEnabled ? "enabled" : "disabled"), Color.White);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("lighting|lights", "Toggle lighting on/off.", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.LightManager.LightingEnabled = !GameMain.LightManager.LightingEnabled;
|
||||||
|
NewMessage("Lighting " + (GameMain.LightManager.LightingEnabled ? "enabled" : "disabled"), Color.White);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("tutorial", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
TutorialMode.StartTutorial(Tutorials.TutorialType.TutorialTypes[0]);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("lobby|lobbyscreen", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.LobbyScreen.Select();
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("save|savesub", "save [submarine name]: Save the currently loaded submarine using the specified name.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length < 1) return;
|
||||||
|
|
||||||
|
if (GameMain.EditMapScreen.CharacterMode)
|
||||||
|
{
|
||||||
|
GameMain.EditMapScreen.ToggleCharacterMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
string fileName = string.Join(" ", args);
|
||||||
|
if (fileName.Contains("../"))
|
||||||
|
{
|
||||||
|
ThrowError("Illegal symbols in filename (../)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Submarine.SaveCurrent(System.IO.Path.Combine(Submarine.SavePath, fileName + ".sub")))
|
||||||
|
{
|
||||||
|
NewMessage("Sub saved", Color.Green);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("load|loadsub", "load [submarine name]: Load a submarine.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length == 0) return;
|
||||||
|
Submarine.Load(string.Join(" ", args), true);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("cleansub", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
for (int i = MapEntity.mapEntityList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
MapEntity me = MapEntity.mapEntityList[i];
|
||||||
|
|
||||||
|
if (me.SimPosition.Length() > 2000.0f)
|
||||||
{
|
{
|
||||||
GameMain.NetworkMember = new GameClient("Name");
|
NewMessage("Removed " + me.Name + " (simposition " + me.SimPosition + ")", Color.Orange);
|
||||||
GameMain.Client.ConnectToServer(commands[1]);
|
MapEntity.mapEntityList.RemoveAt(i);
|
||||||
}
|
}
|
||||||
break;
|
else if (me.MoveWithLevel)
|
||||||
case "mainmenuscreen":
|
|
||||||
case "mainmenu":
|
|
||||||
case "menu":
|
|
||||||
GameMain.GameSession = null;
|
|
||||||
|
|
||||||
List<Character> characters = new List<Character>(Character.CharacterList);
|
|
||||||
foreach (Character c in characters)
|
|
||||||
{
|
{
|
||||||
c.Remove();
|
NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange);
|
||||||
|
MapEntity.mapEntityList.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
else if (me is Item)
|
||||||
GameMain.MainMenuScreen.Select();
|
|
||||||
break;
|
|
||||||
case "gamescreen":
|
|
||||||
case "game":
|
|
||||||
GameMain.GameScreen.Select();
|
|
||||||
break;
|
|
||||||
case "editmapscreen":
|
|
||||||
case "editmap":
|
|
||||||
case "edit":
|
|
||||||
if (commands.Length > 1)
|
|
||||||
{
|
{
|
||||||
Submarine.Load(string.Join(" ", commands.Skip(1)), true);
|
Item item = me as Item;
|
||||||
}
|
var wire = item.GetComponent<Wire>();
|
||||||
GameMain.EditMapScreen.Select();
|
if (wire == null) continue;
|
||||||
break;
|
|
||||||
case "editcharacter":
|
|
||||||
case "editchar":
|
|
||||||
GameMain.EditCharacterScreen.Select();
|
|
||||||
break;
|
|
||||||
case "controlcharacter":
|
|
||||||
case "control":
|
|
||||||
{
|
|
||||||
if (commands.Length < 2) break;
|
|
||||||
|
|
||||||
var character = FindMatchingCharacter(commands, true);
|
if (wire.GetNodes().Count > 0 && !wire.Connections.Any(c => c != null))
|
||||||
|
|
||||||
if (character != null)
|
|
||||||
{
|
{
|
||||||
Character.Controlled = character;
|
wire.Item.Drop(null);
|
||||||
|
NewMessage("Dropped wire (ID: " + wire.Item.ID + ") - attached on wall but no connections found", Color.Orange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case "setclientcharacter":
|
}));
|
||||||
{
|
|
||||||
if (GameMain.Server == null) break;
|
|
||||||
|
|
||||||
int separatorIndex = Array.IndexOf(commands, ";");
|
commands.Add(new Command("messagebox", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
new GUIMessageBox("", string.Join(" ", args));
|
||||||
|
}));
|
||||||
|
|
||||||
if (separatorIndex == -1 || commands.Length < 4)
|
commands.Add(new Command("debugdraw", "debugdraw: Toggle the debug drawing mode on/off.", (string[] args) =>
|
||||||
{
|
{
|
||||||
ThrowError("Invalid parameters. The command should be formatted as \"setclientcharacter [client] ; [character]\"");
|
GameMain.DebugDraw = !GameMain.DebugDraw;
|
||||||
break;
|
NewMessage("Debug draw mode " + (GameMain.DebugDraw ? "enabled" : "disabled"), Color.White);
|
||||||
}
|
|
||||||
|
|
||||||
string[] commandsLeft = commands.Take(separatorIndex).ToArray();
|
}));
|
||||||
string[] commandsRight = commands.Skip(separatorIndex).ToArray();
|
|
||||||
|
|
||||||
string clientName = String.Join(" ", commandsLeft.Skip(1));
|
commands.Add(new Command("togglehud|hud", "togglehud/hud: Toggle the character HUD (inventories, icons, buttons, etc) on/off.", (string[] args) =>
|
||||||
|
{
|
||||||
|
GUI.DisableHUD = !GUI.DisableHUD;
|
||||||
|
GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible;
|
||||||
|
NewMessage(GUI.DisableHUD ? "Disabled HUD" : "Enabled HUD", Color.White);
|
||||||
|
}));
|
||||||
|
|
||||||
var client = GameMain.Server.ConnectedClients.Find(c => c.name == clientName);
|
commands.Add(new Command("followsub", "followsub: Toggle whether the ", (string[] args) =>
|
||||||
if (client == null)
|
{
|
||||||
{
|
Camera.FollowSub = !Camera.FollowSub;
|
||||||
ThrowError("Client \"" + clientName + "\" not found.");
|
NewMessage(Camera.FollowSub ? "Set the camera to follow the closest submarine" : "Disabled submarine following.", Color.White);
|
||||||
}
|
}));
|
||||||
|
|
||||||
var character = FindMatchingCharacter(commandsRight, false);
|
commands.Add(new Command("toggleaitargets|aitargets", "toggleaitargets/aitargets: Toggle the visibility of AI targets (= targets that enemies can detect and attack/escape from).", (string[] args) =>
|
||||||
GameMain.Server.SetClientCharacter(client, character);
|
{
|
||||||
}
|
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
||||||
break;
|
NewMessage(AITarget.ShowAITargets ? "Enabled AI target drawing" : "Disabled AI target drawing", Color.White);
|
||||||
case "test":
|
}));
|
||||||
Submarine.Load("aegir mark ii", true);
|
|
||||||
GameMain.DebugDraw = true;
|
|
||||||
GameMain.LightManager.LosEnabled = false;
|
|
||||||
GameMain.EditMapScreen.Select();
|
|
||||||
break;
|
|
||||||
case "shake":
|
|
||||||
GameMain.GameScreen.Cam.Shake = 10.0f;
|
|
||||||
break;
|
|
||||||
case "losenabled":
|
|
||||||
case "los":
|
|
||||||
case "drawlos":
|
|
||||||
GameMain.LightManager.LosEnabled = !GameMain.LightManager.LosEnabled;
|
|
||||||
break;
|
|
||||||
case "lighting":
|
|
||||||
case "lightingenabled":
|
|
||||||
case "light":
|
|
||||||
case "lights":
|
|
||||||
GameMain.LightManager.LightingEnabled = !GameMain.LightManager.LightingEnabled;
|
|
||||||
break;
|
|
||||||
case "tutorial":
|
|
||||||
TutorialMode.StartTutorial(Tutorials.TutorialType.TutorialTypes[0]);
|
|
||||||
break;
|
|
||||||
case "editortutorial":
|
|
||||||
GameMain.EditMapScreen.Select();
|
|
||||||
GameMain.EditMapScreen.StartTutorial();
|
|
||||||
break;
|
|
||||||
case "lobbyscreen":
|
|
||||||
case "lobby":
|
|
||||||
GameMain.LobbyScreen.Select();
|
|
||||||
break;
|
|
||||||
case "savemap":
|
|
||||||
case "savesub":
|
|
||||||
case "save":
|
|
||||||
if (commands.Length < 2) break;
|
|
||||||
|
|
||||||
if (GameMain.EditMapScreen.CharacterMode)
|
|
||||||
{
|
|
||||||
GameMain.EditMapScreen.ToggleCharacterMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
string fileName = string.Join(" ", commands.Skip(1));
|
|
||||||
if (fileName.Contains("../"))
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Illegal symbols in filename (../)");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Submarine.SaveCurrent(System.IO.Path.Combine(Submarine.SavePath, fileName + ".sub")))
|
|
||||||
{
|
|
||||||
NewMessage("Sub saved", Color.Green);
|
|
||||||
//Submarine.Loaded.First().CheckForErrors();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "loadmap":
|
|
||||||
case "loadsub":
|
|
||||||
case "load":
|
|
||||||
if (commands.Length < 2) break;
|
|
||||||
|
|
||||||
Submarine.Load(string.Join(" ", commands.Skip(1)), true);
|
|
||||||
break;
|
|
||||||
case "cleansub":
|
|
||||||
for (int i = MapEntity.mapEntityList.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
MapEntity me = MapEntity.mapEntityList[i];
|
|
||||||
|
|
||||||
if (me.SimPosition.Length() > 2000.0f)
|
|
||||||
{
|
|
||||||
DebugConsole.NewMessage("Removed " + me.Name + " (simposition " + me.SimPosition + ")", Color.Orange);
|
|
||||||
MapEntity.mapEntityList.RemoveAt(i);
|
|
||||||
}
|
|
||||||
else if (me.MoveWithLevel)
|
|
||||||
{
|
|
||||||
DebugConsole.NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange);
|
|
||||||
MapEntity.mapEntityList.RemoveAt(i);
|
|
||||||
}
|
|
||||||
else if (me is Item)
|
|
||||||
{
|
|
||||||
Item item = me as Item;
|
|
||||||
var wire = item.GetComponent<Wire>();
|
|
||||||
if (wire == null) continue;
|
|
||||||
|
|
||||||
if (wire.GetNodes().Count > 0 && !wire.Connections.Any(c => c != null))
|
|
||||||
{
|
|
||||||
wire.Item.Drop(null);
|
|
||||||
DebugConsole.NewMessage("Dropped wire (ID: " + wire.Item.ID + ") - attached on wall but no connections found", Color.Orange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "messagebox":
|
|
||||||
if (commands.Length < 3) break;
|
|
||||||
new GUIMessageBox(commands[1], commands[2]);
|
|
||||||
break;
|
|
||||||
case "debugdraw":
|
|
||||||
GameMain.DebugDraw = !GameMain.DebugDraw;
|
|
||||||
break;
|
|
||||||
case "disablehud":
|
|
||||||
case "hud":
|
|
||||||
GUI.DisableHUD = !GUI.DisableHUD;
|
|
||||||
GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible;
|
|
||||||
break;
|
|
||||||
case "followsub":
|
|
||||||
Camera.FollowSub = !Camera.FollowSub;
|
|
||||||
break;
|
|
||||||
case "drawaitargets":
|
|
||||||
case "showaitargets":
|
|
||||||
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
|
||||||
break;
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
case "spamevents":
|
commands.Add(new Command("spamchatmessages", "", (string[] args) =>
|
||||||
foreach (Item item in Item.ItemList)
|
{
|
||||||
|
int msgCount = 1000;
|
||||||
|
if (args.Length > 0) int.TryParse(args[0], out msgCount);
|
||||||
|
int msgLength = 50;
|
||||||
|
if (args.Length > 1) int.TryParse(args[1], out msgLength);
|
||||||
|
|
||||||
|
for (int i = 0; i < msgCount; i++)
|
||||||
|
{
|
||||||
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i<item.components.Count; i++)
|
GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default);
|
||||||
{
|
|
||||||
if (item.components[i] is IServerSerializable)
|
|
||||||
{
|
|
||||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.ComponentState, i });
|
|
||||||
}
|
|
||||||
var itemContainer = item.GetComponent<ItemContainer>();
|
|
||||||
if (itemContainer != null)
|
|
||||||
{
|
|
||||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.InventoryState });
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Status });
|
|
||||||
|
|
||||||
item.NeedsPositionUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
foreach (Character c in Character.CharacterList)
|
|
||||||
{
|
{
|
||||||
GameMain.Server.CreateEntityEvent(c, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach (Structure wall in Structure.WallList)
|
}));
|
||||||
{
|
|
||||||
GameMain.Server.CreateEntityEvent(wall);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "spamchatmessages":
|
|
||||||
int msgCount = 1000;
|
|
||||||
if (commands.Length > 1) int.TryParse(commands[1], out msgCount);
|
|
||||||
int msgLength = 50;
|
|
||||||
if (commands.Length > 2) int.TryParse(commands[2], out msgLength);
|
|
||||||
|
|
||||||
for (int i = 0; i < msgCount; i++)
|
|
||||||
{
|
|
||||||
if (GameMain.Server != null)
|
|
||||||
{
|
|
||||||
GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case "cleanbuild":
|
commands.Add(new Command("cleanbuild", "", (string[] args) =>
|
||||||
GameMain.Config.MusicVolume = 0.5f;
|
{
|
||||||
GameMain.Config.SoundVolume = 0.5f;
|
GameMain.Config.MusicVolume = 0.5f;
|
||||||
DebugConsole.NewMessage("Music and sound volume set to 0.5", Color.Green);
|
GameMain.Config.SoundVolume = 0.5f;
|
||||||
|
NewMessage("Music and sound volume set to 0.5", Color.Green);
|
||||||
|
|
||||||
GameMain.Config.GraphicsWidth = 0;
|
GameMain.Config.GraphicsWidth = 0;
|
||||||
GameMain.Config.GraphicsHeight = 0;
|
GameMain.Config.GraphicsHeight = 0;
|
||||||
GameMain.Config.WindowMode = WindowMode.Fullscreen;
|
GameMain.Config.WindowMode = WindowMode.Fullscreen;
|
||||||
DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green);
|
NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green);
|
||||||
DebugConsole.NewMessage("Fullscreen enabled", Color.Green);
|
NewMessage("Fullscreen enabled", Color.Green);
|
||||||
|
|
||||||
GameSettings.VerboseLogging = false;
|
GameSettings.VerboseLogging = false;
|
||||||
|
|
||||||
if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster")
|
if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster")
|
||||||
|
{
|
||||||
|
ThrowError("MasterServerUrl \"" + GameMain.Config.MasterServerUrl + "\"!");
|
||||||
|
}
|
||||||
|
|
||||||
|
GameMain.Config.Save("config.xml");
|
||||||
|
|
||||||
|
var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder);
|
||||||
|
|
||||||
|
foreach (string saveFile in saveFiles)
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(saveFile);
|
||||||
|
NewMessage("Deleted " + saveFile, Color.Green);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.IO.Directory.Exists(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp")))
|
||||||
|
{
|
||||||
|
System.IO.Directory.Delete(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"), true);
|
||||||
|
NewMessage("Deleted temp save folder", Color.Green);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.IO.Directory.Exists(ServerLog.SavePath))
|
||||||
|
{
|
||||||
|
var logFiles = System.IO.Directory.GetFiles(ServerLog.SavePath);
|
||||||
|
|
||||||
|
foreach (string logFile in logFiles)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("MasterServerUrl \"" + GameMain.Config.MasterServerUrl + "\"!");
|
System.IO.File.Delete(logFile);
|
||||||
|
NewMessage("Deleted " + logFile, Color.Green);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GameMain.Config.Save("config.xml");
|
if (System.IO.File.Exists("filelist.xml"))
|
||||||
|
{
|
||||||
var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder);
|
System.IO.File.Delete("filelist.xml");
|
||||||
|
NewMessage("Deleted filelist", Color.Green);
|
||||||
foreach (string saveFile in saveFiles)
|
}
|
||||||
{
|
|
||||||
System.IO.File.Delete(saveFile);
|
|
||||||
DebugConsole.NewMessage("Deleted " + saveFile, Color.Green);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.IO.Directory.Exists(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp")))
|
|
||||||
{
|
|
||||||
System.IO.Directory.Delete(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"), true);
|
|
||||||
DebugConsole.NewMessage("Deleted temp save folder", Color.Green);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.IO.Directory.Exists(ServerLog.SavePath))
|
|
||||||
{
|
|
||||||
var logFiles = System.IO.Directory.GetFiles(ServerLog.SavePath);
|
|
||||||
|
|
||||||
foreach (string logFile in logFiles)
|
|
||||||
{
|
|
||||||
System.IO.File.Delete(logFile);
|
|
||||||
DebugConsole.NewMessage("Deleted " + logFile, Color.Green);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.IO.File.Exists("filelist.xml"))
|
|
||||||
{
|
|
||||||
System.IO.File.Delete("filelist.xml");
|
|
||||||
DebugConsole.NewMessage("Deleted filelist", Color.Green);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (System.IO.File.Exists("Submarines/TutorialSub.sub"))
|
if (System.IO.File.Exists("Submarines/TutorialSub.sub"))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete("Submarines/TutorialSub.sub");
|
System.IO.File.Delete("Submarines/TutorialSub.sub");
|
||||||
|
|
||||||
DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green);
|
NewMessage("Deleted TutorialSub from the submarine folder", Color.Green);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.IO.File.Exists(GameServer.SettingsFile))
|
if (System.IO.File.Exists(GameServer.SettingsFile))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete(GameServer.SettingsFile);
|
System.IO.File.Delete(GameServer.SettingsFile);
|
||||||
DebugConsole.NewMessage("Deleted server settings", Color.Green);
|
NewMessage("Deleted server settings", Color.Green);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.IO.File.Exists(GameServer.ClientPermissionsFile))
|
if (System.IO.File.Exists(GameServer.ClientPermissionsFile))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete(GameServer.ClientPermissionsFile);
|
System.IO.File.Delete(GameServer.ClientPermissionsFile);
|
||||||
DebugConsole.NewMessage("Deleted client permission file", Color.Green);
|
NewMessage("Deleted client permission file", Color.Green);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if (System.IO.File.Exists("crashreport.txt"))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete("crashreport.txt");
|
||||||
|
NewMessage("Deleted crashreport.txt", Color.Green);
|
||||||
|
}
|
||||||
|
|
||||||
if (System.IO.File.Exists("crashreport.txt"))
|
if (!System.IO.File.Exists("Content/Map/TutorialSub.sub"))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete("crashreport.txt");
|
ThrowError("TutorialSub.sub not found!");
|
||||||
DebugConsole.NewMessage("Deleted crashreport.txt", Color.Green);
|
}
|
||||||
}
|
}));
|
||||||
|
|
||||||
if (!System.IO.File.Exists("Content/Map/TutorialSub.sub"))
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("TutorialSub.sub not found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false; //command not found
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true; //command found
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,18 +304,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
case '\b': //backspace
|
case '\b': //backspace
|
||||||
if (Text.Length > 0) Text = Text.Substring(0, Text.Length - 1);
|
if (Text.Length > 0) Text = Text.Substring(0, Text.Length - 1);
|
||||||
|
if (OnTextChanged != null) OnTextChanged(this, Text);
|
||||||
break;
|
break;
|
||||||
//case '\r': //return
|
|
||||||
// if (OnEnterPressed != null)
|
|
||||||
// OnEnterPressed(this);
|
|
||||||
// break;
|
|
||||||
//case '\t': //tab
|
|
||||||
// if (OnTabPressed != null)
|
|
||||||
// OnTabPressed(this);
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OnTextChanged != null) OnTextChanged(this, Text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReceiveSpecialInput(Keys key)
|
public void ReceiveSpecialInput(Keys key)
|
||||||
|
|||||||
@@ -22,169 +22,148 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ExecProjSpecific(string[] commands)
|
private static void InitProjectSpecific()
|
||||||
{
|
{
|
||||||
switch (commands[0].ToLower())
|
commands.Add(new Command("restart|reset", "restart/reset: Close and restart the server.", (string[] args) =>
|
||||||
{
|
{
|
||||||
case "help":
|
NewMessage("*****************", Color.Lime);
|
||||||
|
NewMessage("RESTARTING SERVER", Color.Lime);
|
||||||
|
NewMessage("*****************", Color.Lime);
|
||||||
|
GameMain.Instance.CloseServer();
|
||||||
|
GameMain.Instance.StartServer();
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("start: start a new round", Color.Cyan);
|
commands.Add(new Command("exit|quit|close", "exit/quit/close: Exit the application.", (string[] args) =>
|
||||||
NewMessage("end: end the current round", Color.Cyan);
|
{
|
||||||
NewMessage("restart: restart the server", Color.Cyan);
|
GameMain.ShouldRun = false;
|
||||||
NewMessage("quit: exit the game", Color.Cyan);
|
}));
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("say", "say [message]: Send a chat message that displays \"HOST\" as the sender.", (string[] args) =>
|
||||||
|
{
|
||||||
|
string text = string.Join(" ", args);
|
||||||
|
text = "HOST: " + text;
|
||||||
|
GameMain.Server.SendChatMessage(text, ChatMessageType.Server);
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("say [chat message]: send a chat message", Color.Cyan);
|
commands.Add(new Command("msg", "msg [message]: Send a chat message with no sender specified.", (string[] args) =>
|
||||||
NewMessage("clientlist: list the names and IPs of the connected clients", Color.Cyan);
|
{
|
||||||
NewMessage("kick [name]: kick a player out from the server", Color.Cyan);
|
string text = string.Join(" ", args);
|
||||||
NewMessage("ban [name]: kick and ban the player from the server", Color.Cyan);
|
GameMain.Server.SendChatMessage(text, ChatMessageType.Server);
|
||||||
NewMessage("banip [IP address]: ban the IP address from the server", Color.Cyan);
|
}));
|
||||||
NewMessage("debugdraw: toggles the \"debug draw mode\"", Color.Cyan);
|
|
||||||
NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan);
|
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("servername", "servername [name]: Change the name of the server.", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.Server.Name = string.Join(" ", args);
|
||||||
|
GameMain.NetLobbyScreen.ChangeServerName(string.Join(" ", args));
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("servername [name]: change the name of the server", Color.Cyan);
|
commands.Add(new Command("servermsg", "servermsg [message]: Change the message displayed in the server lobby.", (string[] args) =>
|
||||||
NewMessage("servermsg [message]: change the message in the server lobby", Color.Cyan);
|
{
|
||||||
NewMessage("seed [seed]: changes the level seed for the next round", Color.Cyan);
|
GameMain.NetLobbyScreen.ChangeServerMessage(string.Join(" ", args));
|
||||||
NewMessage("gamemode [name]: select the specified game mode for the next round", Color.Cyan);
|
}));
|
||||||
NewMessage("gamemode [index]: select the specified game mode (0 = sandbox, 1 = mission, etc)", Color.Cyan);
|
|
||||||
NewMessage("submarine [name]: select the specified game mode for the next round", Color.Cyan);
|
|
||||||
NewMessage("shuttle [name]: select the specified submarine as the respawn shuttle for the next round", Color.Cyan);
|
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("seed|levelseed", "seed/levelseed: Changes the level seed for the next round.", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.NetLobbyScreen.LevelSeed = string.Join(" ", args);
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("spawn [creaturename] [near/inside/outside]: spawn a creature at a random spawnpoint (use the second parameter to only select spawnpoints near/inside/outside the submarine)", Color.Cyan);
|
commands.Add(new Command("gamemode", "gamemode [name]/[index]: Select the game mode for the next round. The parameter can either be the name or the index number of the game mode (0 = sandbox, 1 = mission, etc).", (string[] args) =>
|
||||||
|
{
|
||||||
NewMessage(" ", Color.Cyan);
|
int index = -1;
|
||||||
|
if (int.TryParse(string.Join(" ", args), out index))
|
||||||
NewMessage("heal [character name]: restore the specified character to full health", Color.Cyan);
|
{
|
||||||
NewMessage("revive [character name]: bring the specified character back from the dead", Color.Cyan);
|
GameMain.NetLobbyScreen.SelectedModeIndex = index;
|
||||||
NewMessage("killmonsters: immediately kills all AI-controlled enemies in the level", Color.Cyan);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameMain.NetLobbyScreen.SelectedModeName = string.Join(" ", args);
|
||||||
|
}
|
||||||
|
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage(" ", Color.Cyan);
|
commands.Add(new Command("mission", "mission [name]/[index]: Select the mission type for the next round. The parameter can either be the name or the index number of the mission type (0 = first mission type, 1 = second mission type, etc).", (string[] args) =>
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
if (int.TryParse(string.Join(" ", args), out index))
|
||||||
|
{
|
||||||
|
GameMain.NetLobbyScreen.MissionTypeIndex = index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", args);
|
||||||
|
}
|
||||||
|
NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
||||||
|
}));
|
||||||
|
|
||||||
NewMessage("fixwalls: fixes all the walls", Color.Cyan);
|
commands.Add(new Command("sub|submarine", "submarine [name]: Select the submarine for the next round.", (string[] args) =>
|
||||||
NewMessage("fixitems: fixes every item/device in the sub", Color.Cyan);
|
{
|
||||||
NewMessage("oxygen: replenishes the oxygen in every room to 100%", Color.Cyan);
|
Submarine sub = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", args).ToLower());
|
||||||
NewMessage("power [amount]: immediately sets the temperature of the reactor to the specified value", Color.Cyan);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "restart":
|
|
||||||
case "reset":
|
|
||||||
NewMessage("*****************", Color.Lime);
|
|
||||||
NewMessage("RESTARTING SERVER", Color.Lime);
|
|
||||||
NewMessage("*****************", Color.Lime);
|
|
||||||
GameMain.Instance.CloseServer();
|
|
||||||
GameMain.Instance.StartServer();
|
|
||||||
break;
|
|
||||||
case "exit":
|
|
||||||
case "close":
|
|
||||||
case "quit":
|
|
||||||
GameMain.ShouldRun = false;
|
|
||||||
break;
|
|
||||||
case "say":
|
|
||||||
case "msg":
|
|
||||||
string text = string.Join(" ", commands.Skip(1));
|
|
||||||
if (commands[0].ToLower() == "say") text = "HOST: " + text;
|
|
||||||
GameMain.Server.SendChatMessage(text, ChatMessageType.Server);
|
|
||||||
break;
|
|
||||||
case "servername":
|
|
||||||
GameMain.Server.Name = string.Join(" ", commands.Skip(1));
|
|
||||||
GameMain.NetLobbyScreen.ChangeServerName(string.Join(" ", commands.Skip(1)));
|
|
||||||
break;
|
|
||||||
case "servermsg":
|
|
||||||
GameMain.NetLobbyScreen.ChangeServerMessage(string.Join(" ", commands.Skip(1)));
|
|
||||||
break;
|
|
||||||
case "seed":
|
|
||||||
GameMain.NetLobbyScreen.LevelSeed = string.Join(" ", commands.Skip(1));
|
|
||||||
break;
|
|
||||||
case "gamemode":
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
if (int.TryParse(string.Join(" ", commands.Skip(1)), out index))
|
|
||||||
{
|
|
||||||
GameMain.NetLobbyScreen.SelectedModeIndex = index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GameMain.NetLobbyScreen.SelectedModeName = string.Join(" ", commands.Skip(1));
|
|
||||||
}
|
|
||||||
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "mission":
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
if (int.TryParse(string.Join(" ", commands.Skip(1)), out index))
|
|
||||||
{
|
|
||||||
GameMain.NetLobbyScreen.MissionTypeIndex = index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", commands.Skip(1));
|
|
||||||
}
|
|
||||||
NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "sub":
|
|
||||||
case "submarine":
|
|
||||||
{
|
|
||||||
Submarine sub = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower());
|
|
||||||
|
|
||||||
if (sub != null)
|
if (sub != null)
|
||||||
{
|
{
|
||||||
GameMain.NetLobbyScreen.SelectedSub = sub;
|
GameMain.NetLobbyScreen.SelectedSub = sub;
|
||||||
}
|
}
|
||||||
sub = GameMain.NetLobbyScreen.SelectedSub;
|
sub = GameMain.NetLobbyScreen.SelectedSub;
|
||||||
NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
||||||
}
|
}));
|
||||||
break;
|
|
||||||
case "shuttle":
|
|
||||||
{
|
|
||||||
Submarine shuttle = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower());
|
|
||||||
|
|
||||||
if (shuttle != null)
|
commands.Add(new Command("shuttle", "shuttle [name]: Select the specified submarine as the respawn shuttle for the next round.", (string[] args) =>
|
||||||
{
|
{
|
||||||
GameMain.NetLobbyScreen.SelectedShuttle = shuttle;
|
Submarine shuttle = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", args).ToLower());
|
||||||
}
|
|
||||||
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
if (shuttle != null)
|
||||||
NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
{
|
||||||
}
|
GameMain.NetLobbyScreen.SelectedShuttle = shuttle;
|
||||||
break;
|
}
|
||||||
case "startgame":
|
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||||
case "startround":
|
NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
||||||
case "start":
|
}));
|
||||||
if (Screen.Selected == GameMain.GameScreen) break;
|
|
||||||
if (!GameMain.Server.StartGame()) NewMessage("Failed to start a new round", Color.Yellow);
|
commands.Add(new Command("startgame|startround|start", "start/startgame/startround: Start a new round.", (string[] args) =>
|
||||||
break;
|
{
|
||||||
case "endgame":
|
if (Screen.Selected == GameMain.GameScreen) return;
|
||||||
case "endround":
|
if (!GameMain.Server.StartGame()) NewMessage("Failed to start a new round", Color.Yellow);
|
||||||
case "end":
|
}));
|
||||||
if (Screen.Selected == GameMain.NetLobbyScreen) break;
|
|
||||||
GameMain.Server.EndGame();
|
commands.Add(new Command("endgame|endround|end", "end/endgame/endround: End the current round.", (string[] args) =>
|
||||||
break;
|
{
|
||||||
case "entitydata":
|
if (Screen.Selected == GameMain.NetLobbyScreen) return;
|
||||||
Entity ent = Entity.FindEntityByID(Convert.ToUInt16(commands[1]));
|
GameMain.Server.EndGame();
|
||||||
if (ent != null)
|
}));
|
||||||
{
|
|
||||||
NewMessage(ent.ToString(), Color.Lime);
|
commands.Add(new Command("entitydata", "", (string[] args) =>
|
||||||
}
|
{
|
||||||
break;
|
if (args.Length == 0) return;
|
||||||
|
Entity ent = Entity.FindEntityByID(Convert.ToUInt16(args[0]));
|
||||||
|
if (ent != null)
|
||||||
|
{
|
||||||
|
NewMessage(ent.ToString(), Color.Lime);
|
||||||
|
}
|
||||||
|
}));
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
case "eventdata":
|
commands.Add(new Command("eventdata", "", (string[] args) =>
|
||||||
ServerEntityEvent ev = GameMain.Server.EntityEventManager.Events[Convert.ToUInt16(commands[1])];
|
{
|
||||||
if (ev != null)
|
if (args.Length == 0) return;
|
||||||
{
|
ServerEntityEvent ev = GameMain.Server.EntityEventManager.Events[Convert.ToUInt16(args[0])];
|
||||||
NewMessage(ev.StackTrace, Color.Lime);
|
if (ev != null)
|
||||||
}
|
{
|
||||||
break;
|
NewMessage(ev.StackTrace, Color.Lime);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("spamchatmessages", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
int msgCount = 1000;
|
||||||
|
if (args.Length > 0) int.TryParse(args[0], out msgCount);
|
||||||
|
int msgLength = 50;
|
||||||
|
if (args.Length > 1) int.TryParse(args[1], out msgLength);
|
||||||
|
|
||||||
|
for (int i = 0; i < msgCount; i++)
|
||||||
|
{
|
||||||
|
GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default);
|
||||||
|
}
|
||||||
|
}));
|
||||||
#endif
|
#endif
|
||||||
default:
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true; //command found
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user