Server responses to clients using console commands ("granted permissions to client", error messages, etc) are displayed in the client's debug console instead of the chat box. Client command usage is included in server logs.

This commit is contained in:
Joonas Rikkonen
2017-12-20 19:18:32 +02:00
parent 91699b26a6
commit b3c3970209
5 changed files with 47 additions and 30 deletions
@@ -7,7 +7,7 @@ namespace Barotrauma.Networking
{
enum ChatMessageType
{
Default, Error, Dead, Server, Radio, Private, MessageBox
Default, Error, Dead, Server, Radio, Private, Console, MessageBox
}
partial class ChatMessage
@@ -25,7 +25,8 @@ namespace Barotrauma.Networking
new Color(63, 72, 204), //dead
new Color(157, 225, 160), //server
new Color(238, 208, 0), //radio
new Color(228, 199, 27) //private
new Color(228, 199, 27), //private
new Color(255, 255, 255) //console
};
public readonly string Text;
@@ -1634,6 +1634,12 @@ namespace Barotrauma.Networking
SendChatMessage(msg, recipient);
}
public void SendConsoleMessage(string txt, Client recipient)
{
ChatMessage msg = ChatMessage.Create("", txt, ChatMessageType.Console, null);
SendChatMessage(msg, recipient);
}
public void SendChatMessage(ChatMessage msg, Client recipient)
{
msg.NetStateID = recipient.ChatMsgQueue.Count > 0 ?
@@ -28,18 +28,20 @@ namespace Barotrauma.Networking
Attack,
Spawning,
ServerMessage,
ConsoleUsage,
Error
}
private readonly Color[] messageColor =
{
Color.LightBlue,
new Color(255, 142, 0),
new Color(238, 208, 0),
new Color(204, 74, 78),
new Color(163, 73, 164),
new Color(157, 225, 160),
Color.Red
Color.LightBlue, //Chat
new Color(255, 142, 0), //ItemInteraction
new Color(238, 208, 0), //Inventory
new Color(204, 74, 78), //Attack
new Color(163, 73, 164), //Spawning
new Color(157, 225, 160), //ServerMessage
new Color(0, 162, 232), //ConsoleUsage
Color.Red //Error
};
private readonly string[] messageTypeName =
@@ -50,6 +52,7 @@ namespace Barotrauma.Networking
"Attack & death",
"Spawning",
"Server message",
"Console usage",
"Error"
};