diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index 6f3314422..bb3a10da3 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -1409,7 +1409,7 @@ namespace Barotrauma.Networking UpdateVoteStatus(); - AddChatMessage(msg, ChatMessageType.Server); + SendChatMessage(msg, ChatMessageType.Server); UpdateCrewFrame(); @@ -1544,6 +1544,12 @@ namespace Barotrauma.Networking break; } + if (type == ChatMessageType.Server) + { + senderName = null; + senderCharacter = null; + } + //check which clients can receive the message and apply distance effects foreach (Client client in ConnectedClients) { @@ -1571,13 +1577,7 @@ namespace Barotrauma.Networking if (client != targetClient && client != senderClient) continue; break; } - - if (type == ChatMessageType.Server) - { - senderName = null; - senderCharacter = null; - } - + var chatMsg = ChatMessage.Create( senderName, modifiedMessage, diff --git a/Subsurface/Source/Networking/NetworkMember.cs b/Subsurface/Source/Networking/NetworkMember.cs index bfa7b1339..06bdf5136 100644 --- a/Subsurface/Source/Networking/NetworkMember.cs +++ b/Subsurface/Source/Networking/NetworkMember.cs @@ -248,7 +248,7 @@ namespace Barotrauma.Networking displayedText = message.SenderName + ": " + displayedText; } - GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), displayedText, + GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width, 0), displayedText, ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color, Alignment.Left, null, null, true); msg.Font = GUI.SmallFont; diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index 2a0f5877d..0f27c933c 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -1046,7 +1046,7 @@ namespace Barotrauma chatBox.RemoveChild(chatBox.children[1]); } - GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), + GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width, 0), message.TextWithSender, ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, message.Color, Alignment.Left, GUI.Style, null, true);