(bf212a41f) v0.9.2.0 pre-release test version
This commit is contained in:
@@ -86,7 +86,8 @@ namespace Barotrauma
|
||||
int inputLines = Math.Max((int)Math.Ceiling(input.Length / (float)Console.WindowWidth), 1);
|
||||
Console.CursorLeft = 0;
|
||||
Console.Write(new string(' ', consoleWidth));
|
||||
Console.CursorTop -= inputLines; Console.CursorLeft = 0;
|
||||
Console.CursorTop = Math.Max(Console.CursorTop - inputLines, 0);
|
||||
Console.CursorLeft = 0;
|
||||
while (queuedMessages.Count > 0)
|
||||
{
|
||||
ColoredText msg = queuedMessages.Dequeue();
|
||||
@@ -121,9 +122,9 @@ namespace Barotrauma
|
||||
switch (key.Key)
|
||||
{
|
||||
case ConsoleKey.Enter:
|
||||
lock (DebugConsole.QueuedCommands)
|
||||
lock (QueuedCommands)
|
||||
{
|
||||
DebugConsole.QueuedCommands.Add(input);
|
||||
QueuedCommands.Add(input);
|
||||
}
|
||||
input = "";
|
||||
memoryIndex = -1;
|
||||
@@ -219,7 +220,15 @@ namespace Barotrauma
|
||||
|
||||
private static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
|
||||
{
|
||||
commands.First(c => c.names.Intersect(names.Split('|')).Count() > 0).OnClientRequestExecute = onClientRequestExecute;
|
||||
var matchingCommand = commands.Find(c => c.names.Intersect(names.Split('|')).Count() > 0);
|
||||
if (matchingCommand == null)
|
||||
{
|
||||
throw new Exception("AssignOnClientRequestExecute failed. Command matching the name(s) \"" + names + "\" not found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
matchingCommand.OnClientRequestExecute = onClientRequestExecute;
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitProjectSpecific()
|
||||
@@ -568,10 +577,8 @@ namespace Barotrauma
|
||||
NewMessage(client.Name + " has the following permissions:", Color.White);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
if (permission == ClientPermissions.None || !client.HasPermission(permission)) continue;
|
||||
System.Reflection.FieldInfo fi = typeof(ClientPermissions).GetField(permission.ToString());
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
NewMessage(" - " + attributes[0].Description, Color.White);
|
||||
if (permission == ClientPermissions.None || !client.HasPermission(permission)) { continue; }
|
||||
NewMessage(" - " + TextManager.Get("ClientPermission." + permission), Color.White);
|
||||
}
|
||||
if (client.HasPermission(ClientPermissions.ConsoleCommands))
|
||||
{
|
||||
@@ -590,12 +597,100 @@ namespace Barotrauma
|
||||
}
|
||||
});
|
||||
|
||||
/*AssignOnExecute("togglekarma", (string[] args) =>
|
||||
AssignOnExecute("togglekarma", (string[] args) =>
|
||||
{
|
||||
return;
|
||||
if (GameMain.Server == null) return;
|
||||
GameMain.Server.ServerSettings.KarmaEnabled = !GameMain.Server.ServerSettings.KarmaEnabled;
|
||||
});*/
|
||||
NewMessage(GameMain.Server.ServerSettings.KarmaEnabled ? "Karma system enabled." : "Karma system disabled.", Color.LightGreen);
|
||||
});
|
||||
|
||||
AssignOnExecute("resetkarma", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null || args.Length == 0) return;
|
||||
var client = GameMain.Server.ConnectedClients.Find(c => c.Name == args[0]);
|
||||
if (client == null)
|
||||
{
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
client.Karma = 100.0f;
|
||||
NewMessage("Set the karma of the client \"" + args[0] + "\" to 100.", Color.LightGreen);
|
||||
});
|
||||
AssignOnClientRequestExecute("resetkarma", (Client client, Vector2 cursorWorldPos, string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null || args.Length == 0) return;
|
||||
var targetClient = GameMain.Server.ConnectedClients.Find(c => c.Name == args[0]);
|
||||
if (targetClient == null)
|
||||
{
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
targetClient.Karma = 100.0f;
|
||||
GameMain.Server.SendDirectChatMessage("Set the karma of the client \"" + args[0] + "\" to 100.", client);
|
||||
NewMessage("Client \"" + client.Name + "\" set the karma of \"" + args[0] + "\" to 100.", Color.LightGreen);
|
||||
});
|
||||
|
||||
AssignOnExecute("setkarma", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null || args.Length < 2) return;
|
||||
var client = GameMain.Server.ConnectedClients.Find(c => c.Name == args[0]);
|
||||
if (client == null)
|
||||
{
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (!float.TryParse(args[1], out float karmaValue) || karmaValue < 0.0f || karmaValue > 100.0f)
|
||||
{
|
||||
ThrowError("\"" + args[1] + "\" is not a valid karma value. You need to enter a number between 0-100.");
|
||||
return;
|
||||
}
|
||||
client.Karma = karmaValue;
|
||||
NewMessage("Set the karma of the client \"" + args[0] + "\" to " + karmaValue + ".", Color.LightGreen);
|
||||
});
|
||||
AssignOnClientRequestExecute("setkarma", (Client client, Vector2 cursorWorldPos, string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null || args.Length < 2) return;
|
||||
var targetClient = GameMain.Server.ConnectedClients.Find(c => c.Name == args[0]);
|
||||
if (targetClient == null)
|
||||
{
|
||||
GameMain.Server.SendDirectChatMessage("Client \"" + args[0] + "\" not found.", client);
|
||||
return;
|
||||
}
|
||||
if (!float.TryParse(args[1], out float karmaValue) || karmaValue < 0.0f || karmaValue > 100.0f)
|
||||
{
|
||||
GameMain.Server.SendDirectChatMessage("\"" + args[1] + "\" is not a valid karma value. You need to enter a number between 0-100.", client);
|
||||
return;
|
||||
}
|
||||
targetClient.Karma = karmaValue;
|
||||
GameMain.Server.SendDirectChatMessage("Set the karma of the client \"" + args[0] + "\" to " + karmaValue + ".", client);
|
||||
NewMessage("Client \"" + client.Name + "\" set the karma of \"" + args[0] + "\" to " + karmaValue + ".", Color.LightGreen);
|
||||
});
|
||||
|
||||
AssignOnExecute("showkarma", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
NewMessage("***************", Color.Cyan);
|
||||
foreach (Client c in GameMain.Server.ConnectedClients)
|
||||
{
|
||||
NewMessage("- " + c.ID.ToString() + ": " + c.Name + (c.Character != null ? " playing " + c.Character.LogName : "") + ", " + c.Karma, Color.Cyan);
|
||||
}
|
||||
NewMessage("***************", Color.Cyan);
|
||||
});
|
||||
AssignOnClientRequestExecute("showkarma", (Client client, Vector2 cursorWorldPos, string[] args) =>
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("***************", client);
|
||||
foreach (Client c in GameMain.Server.ConnectedClients)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("- " + c.ID.ToString() + ": " + c.Name + (c.Character != null ? " playing " + c.Character.LogName : "") + ", " + c.Karma, client);
|
||||
}
|
||||
GameMain.Server.SendConsoleMessage("***************", client);
|
||||
});
|
||||
AssignOnExecute("togglekarmatestmode|karmatestmode", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server?.KarmaManager == null) return;
|
||||
GameMain.Server.KarmaManager.TestMode = !GameMain.Server.KarmaManager.TestMode;
|
||||
NewMessage(GameMain.Server.KarmaManager.TestMode ? "Karma test mode enabled." : "Karma test mode disabled.", Color.LightGreen);
|
||||
});
|
||||
|
||||
AssignOnExecute("banip", (string[] args) =>
|
||||
{
|
||||
@@ -989,6 +1084,16 @@ namespace Barotrauma
|
||||
};
|
||||
}));
|
||||
|
||||
|
||||
AssignOnExecute("respawnnow", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server?.RespawnManager == null) { return; }
|
||||
if (GameMain.Server.RespawnManager.CurrentState != RespawnManager.State.Transporting)
|
||||
{
|
||||
GameMain.Server.RespawnManager.ForceRespawn();
|
||||
}
|
||||
});
|
||||
|
||||
commands.Add(new Command("startgame|startround|start", "start/startgame/startround: Start a new round.", (string[] args) =>
|
||||
{
|
||||
if (Screen.Selected == GameMain.GameScreen) return;
|
||||
@@ -1523,7 +1628,11 @@ namespace Barotrauma
|
||||
"showperm",
|
||||
(Client senderClient, Vector2 cursorWorldPos, string[] args) =>
|
||||
{
|
||||
if (args.Length < 2) return;
|
||||
if (args.Length < 1)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("showperm [id]: Shows the current administrative permissions of the client with the specified client ID.", senderClient);
|
||||
return;
|
||||
}
|
||||
|
||||
int.TryParse(args[0], out int id);
|
||||
var client = GameMain.Server.ConnectedClients.Find(c => c.ID == id);
|
||||
@@ -1542,10 +1651,8 @@ namespace Barotrauma
|
||||
GameMain.Server.SendConsoleMessage(client.Name + " has the following permissions:", senderClient);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
if (permission == ClientPermissions.None || !client.HasPermission(permission)) continue;
|
||||
System.Reflection.FieldInfo fi = typeof(ClientPermissions).GetField(permission.ToString());
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
GameMain.Server.SendConsoleMessage(" - " + attributes[0].Description, senderClient);
|
||||
if (permission == ClientPermissions.None || !client.HasPermission(permission)) { continue; }
|
||||
GameMain.Server.SendConsoleMessage(" - " + TextManager.Get("ClientPermission." + permission), senderClient);
|
||||
}
|
||||
if (client.HasPermission(ClientPermissions.ConsoleCommands))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user