Added some convenient console commands
This commit is contained in:
@@ -91,16 +91,14 @@ namespace Barotrauma
|
||||
|
||||
switch (commands[0].ToLowerInvariant())
|
||||
{
|
||||
case "entitylist":
|
||||
System.IO.StreamWriter sw = new System.IO.StreamWriter("ENTLIST "+Rand.Int(20000).ToString()+".TXT");
|
||||
|
||||
List<Entity> entList = Entity.GetEntityList();
|
||||
foreach (Entity ent in entList)
|
||||
case "clientlist":
|
||||
if (GameMain.Server == null) break;
|
||||
DebugConsole.NewMessage("***************", Color.Cyan);
|
||||
foreach (Client c in GameMain.Server.ConnectedClients)
|
||||
{
|
||||
sw.WriteLine(ent.ID.ToString()+" "+ent.ToString());
|
||||
DebugConsole.NewMessage("- " + c.ID.ToString() + ": " + c.name + ", " + c.Connection.RemoteEndPoint.Address.ToString(),Color.Cyan);
|
||||
}
|
||||
|
||||
sw.Close();
|
||||
DebugConsole.NewMessage("***************", Color.Cyan);
|
||||
break;
|
||||
case "help":
|
||||
NewMessage("menu: go to main menu", Color.Cyan);
|
||||
@@ -308,6 +306,23 @@ namespace Barotrauma
|
||||
if (GameMain.NetworkMember == null || commands.Length < 2) break;
|
||||
GameMain.NetworkMember.KickPlayer(string.Join(" ", commands.Skip(1)), false);
|
||||
|
||||
break;
|
||||
case "kickid":
|
||||
if (GameMain.Server == null || commands.Length < 2) break;
|
||||
{
|
||||
int id = 0;
|
||||
int.TryParse(commands[1], out id);
|
||||
GameMain.Server.KickPlayer(id, false);
|
||||
}
|
||||
break;
|
||||
case "banid":
|
||||
if (GameMain.Server == null || commands.Length < 2) break;
|
||||
{
|
||||
int id = 0;
|
||||
int.TryParse(commands[1], out id);
|
||||
GameMain.Server.KickPlayer(id, true);
|
||||
}
|
||||
|
||||
break;
|
||||
case "ban":
|
||||
if (GameMain.NetworkMember == null || commands.Length < 2) break;
|
||||
|
||||
@@ -1249,7 +1249,7 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
AddChatMessage("Press TAB to chat. Use \"r;\" to talk through the radio.", ChatMessageType.Server);
|
||||
|
||||
|
||||
GameMain.NetLobbyScreen.StartButtonEnabled = true;
|
||||
|
||||
gameStarted = true;
|
||||
@@ -1411,6 +1411,13 @@ namespace Barotrauma.Networking
|
||||
KickClient(client, ban, range);
|
||||
}
|
||||
|
||||
public void KickPlayer(int id,bool ban,bool range=false)
|
||||
{
|
||||
Client client = connectedClients.Find(c => c.ID == id);
|
||||
|
||||
KickClient(client, ban, range);
|
||||
}
|
||||
|
||||
public void KickClient(NetConnection conn, bool ban = false, bool range = false)
|
||||
{
|
||||
Client client = connectedClients.Find(c => c.Connection == conn);
|
||||
|
||||
@@ -14,6 +14,11 @@ namespace Barotrauma
|
||||
get { return selected; }
|
||||
}
|
||||
|
||||
public static void SelectNull()
|
||||
{
|
||||
selected = null;
|
||||
}
|
||||
|
||||
public virtual void Deselect()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user