From 03a3a156bad4748134c84b0cc568e4702363826c Mon Sep 17 00:00:00 2001 From: Regalis Date: Fri, 15 Jul 2016 17:55:16 +0300 Subject: [PATCH] - fixed camera "twitching" when trying to move it above the upper limit of the level - fixed duplicate hulls/gaps being placed at docking ports when saving and loading - fixed linkedsubmarines moving when saving and reloading if the center of the wall vertices isn't he same as the center of the sub - moving docked submarines along with the main sub when syncing the position - characters are killed when the client controlling them disconnects (+ cause of death: disconnected) - fixed the description box in server lobby --- Subsurface/Content/InfoTexts.xml | 2 + Subsurface/Source/Camera.cs | 2 + Subsurface/Source/Characters/Attack.cs | 2 +- Subsurface/Source/GameSession/GameSession.cs | 1 + .../Source/Items/Components/DockingPort.cs | 68 ++++++++++++++++--- Subsurface/Source/Map/Levels/LevelRenderer.cs | 4 +- Subsurface/Source/Map/LinkedSubmarine.cs | 13 +++- Subsurface/Source/Map/Submarine.cs | 33 +++++---- Subsurface/Source/Map/SubmarineBody.cs | 58 +++++++++++----- Subsurface/Source/Networking/GameClient.cs | 4 +- Subsurface/Source/Networking/GameServer.cs | 2 + .../Source/Networking/RespawnManager.cs | 33 +++++---- Subsurface/Source/Screens/GameScreen.cs | 4 +- Subsurface/Source/Screens/NetLobbyScreen.cs | 12 +--- 14 files changed, 167 insertions(+), 71 deletions(-) diff --git a/Subsurface/Content/InfoTexts.xml b/Subsurface/Content/InfoTexts.xml index 62f842248..f75fc8a67 100644 --- a/Subsurface/Content/InfoTexts.xml +++ b/Subsurface/Content/InfoTexts.xml @@ -11,6 +11,7 @@ Suffocated Crushed by water pressure Burned to death + Disconnected You have succumbed to your injuries. You have bled out. @@ -18,5 +19,6 @@ You have suffocated. You have been crushed by water pressure. You have burned to death. + You have been disconnected from the server. \ No newline at end of file diff --git a/Subsurface/Source/Camera.cs b/Subsurface/Source/Camera.cs index 7a3ab5361..3e785b401 100644 --- a/Subsurface/Source/Camera.cs +++ b/Subsurface/Source/Camera.cs @@ -142,6 +142,8 @@ namespace Barotrauma { position.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f); interpolatedPosition.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f); + + worldView.Y = Math.Min((int)Level.Loaded.Size.Y, worldView.Y); } transform = Matrix.CreateTranslation( diff --git a/Subsurface/Source/Characters/Attack.cs b/Subsurface/Source/Characters/Attack.cs index bb49645ab..869daaca4 100644 --- a/Subsurface/Source/Characters/Attack.cs +++ b/Subsurface/Source/Characters/Attack.cs @@ -8,7 +8,7 @@ namespace Barotrauma { enum CauseOfDeath { - Damage, Bloodloss, Pressure, Suffocation, Drowning, Burn + Damage, Bloodloss, Pressure, Suffocation, Drowning, Burn, Disconnected } public enum DamageType { None, Blunt, Slash, Burn } diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs index 28c67bb6a..27794163d 100644 --- a/Subsurface/Source/GameSession/GameSession.cs +++ b/Subsurface/Source/GameSession/GameSession.cs @@ -126,6 +126,7 @@ namespace Barotrauma } if (reloadSub || Submarine.MainSub != submarine) submarine.Load(true); + Submarine.MainSub = submarine; //var secondSub = new Submarine(submarine.FilePath, submarine.MD5Hash.Hash); //secondSub.Load(false); diff --git a/Subsurface/Source/Items/Components/DockingPort.cs b/Subsurface/Source/Items/Components/DockingPort.cs index 1566823ac..be9f4522e 100644 --- a/Subsurface/Source/Items/Components/DockingPort.cs +++ b/Subsurface/Source/Items/Components/DockingPort.cs @@ -59,6 +59,12 @@ namespace Barotrauma.Items.Components set; } + public DockingPort DockingTarget + { + get { return dockingTarget; } + set { dockingTarget = value; } + } + public bool Docked { get @@ -135,7 +141,8 @@ namespace Barotrauma.Items.Components PlaySound(ActionType.OnUse, item.WorldPosition); - item.linkedTo.Add(target.item); + if (!item.linkedTo.Contains(target.item)) item.linkedTo.Add(target.item); + if (!target.item.linkedTo.Contains(item)) target.item.linkedTo.Add(item); if (!target.item.Submarine.DockedTo.Contains(item.Submarine)) target.item.Submarine.DockedTo.Add(item.Submarine); if (!item.Submarine.DockedTo.Contains(target.item.Submarine)) item.Submarine.DockedTo.Add(target.item.Submarine); @@ -184,7 +191,7 @@ namespace Barotrauma.Items.Components Vector2.UnitX * Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) : Vector2.UnitY * Math.Sign(dockingTarget.item.WorldPosition.Y - item.WorldPosition.Y)); offset *= DockedDistance * 0.5f; - + Vector2 pos1 = item.WorldPosition + offset; Vector2 pos2 = dockingTarget.item.WorldPosition - offset; @@ -302,6 +309,11 @@ namespace Barotrauma.Items.Components } } + item.linkedTo.Add(hulls[0]); + item.linkedTo.Add(hulls[1]); + + item.linkedTo.Add(gap); + foreach (Body body in bodies) { @@ -394,6 +406,22 @@ namespace Barotrauma.Items.Components } else { + if (!docked) + { + Dock(dockingTarget); + + //if (joint.BodyA.Mass < joint.BodyB.Mass) + //{ + // joint.BodyA.SetTransform(joint.BodyA.Position + (joint.WorldAnchorB - joint.WorldAnchorA), 0.0f); + //} + //else + //{ + // joint.BodyB.SetTransform(joint.BodyB.Position + (joint.WorldAnchorA - joint.WorldAnchorB), 0.0f); + //} + + + } + if (joint is DistanceJoint) { item.SendSignal(0, "0", "state_out"); @@ -405,7 +433,11 @@ namespace Barotrauma.Items.Components PlaySound(ActionType.OnSecondaryUse, item.WorldPosition); CreateJoint(true); - CreateHull(); + + if (!item.linkedTo.Any(e => e is Hull) && !dockingTarget.item.linkedTo.Any(e => e is Hull)) + { + CreateHull(); + } } dockingState = MathHelper.Lerp(dockingState, 0.5f, deltaTime * 10.0f); } @@ -459,7 +491,7 @@ namespace Barotrauma.Items.Components drawPos, new Rectangle( rect.X, rect.Y + rect.Height/2 + (int)(rect.Height / 2 * (1.0f - dockingState)), - rect.Width, (int)(rect.Height / 2 * dockingState)), Color.White); + rect.Width, (int)(rect.Height / 2 * dockingState)), Color.Red); } else @@ -482,11 +514,31 @@ namespace Barotrauma.Items.Components { if (!item.linkedTo.Any()) return; - Item linkedItem = item.linkedTo.First() as Item; - if (linkedItem == null) return; + foreach (MapEntity entity in item.linkedTo) + { - DockingPort port = linkedItem.GetComponent(); - if (port != null) Dock(port); + var hull = entity as Hull; + if (hull != null) + { + hull.Remove(); + continue; + } + + var gap = entity as Gap; + if (gap != null) + { + gap.Remove(); + continue; + } + + Item linkedItem = entity as Item; + if (linkedItem == null) continue; + + var dockingPort = linkedItem.GetComponent(); + if (dockingPort != null) dockingTarget = dockingPort; + } + + item.linkedTo.Clear(); } public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power = 0.0f) diff --git a/Subsurface/Source/Map/Levels/LevelRenderer.cs b/Subsurface/Source/Map/Levels/LevelRenderer.cs index 8f4a8a9b3..5d778c856 100644 --- a/Subsurface/Source/Map/Levels/LevelRenderer.cs +++ b/Subsurface/Source/Map/Levels/LevelRenderer.cs @@ -82,8 +82,8 @@ namespace Barotrauma { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap); - Vector2 backgroundPos = cam.Position; - //if (Level.Loaded != null) backgroundPos -= Level.Loaded.Position; + Vector2 backgroundPos = cam.WorldViewCenter; + backgroundPos.Y = -backgroundPos.Y; backgroundPos /= 20.0f; diff --git a/Subsurface/Source/Map/LinkedSubmarine.cs b/Subsurface/Source/Map/LinkedSubmarine.cs index 768ffec13..c5437ae16 100644 --- a/Subsurface/Source/Map/LinkedSubmarine.cs +++ b/Subsurface/Source/Map/LinkedSubmarine.cs @@ -79,7 +79,10 @@ namespace Barotrauma (int)sl.wallVertices.Max(v => v.X + position.X), (int)sl.wallVertices.Min(v => v.Y + position.Y)); - sl.rect = new Rectangle(sl.rect.X, sl.rect.Y, sl.rect.Width - sl.rect.X, sl.rect.Y - sl.rect.Height); + int width = sl.rect.Width - sl.rect.X; + int height = sl.rect.Y - sl.rect.Height; + + sl.rect = new Rectangle((int)position.X, (int)position.Y, 1, 1); return sl; } @@ -96,7 +99,7 @@ namespace Barotrauma Color color = (isHighlighted) ? Color.Orange : Color.Green; if (isSelected) color = Color.Red; - Vector2 pos = new Vector2(rect.X + rect.Width/2, rect.Y - rect.Height/2); + Vector2 pos = Position; for (int i = 0; i < wallVertices.Count; i++) { @@ -116,6 +119,9 @@ namespace Barotrauma GUI.DrawLine(spriteBatch, pos + Vector2.UnitY * 50.0f, pos - Vector2.UnitY * 50.0f, color, 0.0f, 5); GUI.DrawLine(spriteBatch, pos + Vector2.UnitX * 50.0f, pos - Vector2.UnitX * 50.0f, color, 0.0f, 5); + Rectangle drawRect = rect; + drawRect.Y = -rect.Y; + GUI.DrawRectangle(spriteBatch, drawRect, Color.Red, true); foreach (MapEntity e in linkedTo) { @@ -210,6 +216,7 @@ namespace Barotrauma GenerateWallVertices(doc.Root); saveElement = doc.Root; + saveElement.Name = "LinkedSubmarine"; filePath = pathBox.Text; @@ -354,7 +361,7 @@ namespace Barotrauma if (myPort != null) { - myPort.Dock(linkedPort); + myPort.DockingTarget = linkedPort; } } } diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs index b7cd1811d..8715664e2 100644 --- a/Subsurface/Source/Map/Submarine.cs +++ b/Subsurface/Source/Map/Submarine.cs @@ -819,24 +819,27 @@ namespace Barotrauma center.X -= center.X % GridSize.X; center.Y -= center.Y % GridSize.Y; - foreach (Item item in Item.ItemList) + if (center != Vector2.Zero) { - if (item.Submarine != this) continue; - - var wire = item.GetComponent(); - if (wire == null) continue; - - for (int i = 0; i < wire.Nodes.Count; i++) + foreach (Item item in Item.ItemList) { - wire.Nodes[i] -= center; - } - } + if (item.Submarine != this) continue; - for (int i = 0; i < MapEntity.mapEntityList.Count; i++) - { - if (MapEntity.mapEntityList[i].Submarine != this) continue; - - MapEntity.mapEntityList[i].Move(-center); + var wire = item.GetComponent(); + if (wire == null) continue; + + for (int i = 0; i < wire.Nodes.Count; i++) + { + wire.Nodes[i] -= center; + } + } + + for (int i = 0; i < MapEntity.mapEntityList.Count; i++) + { + if (MapEntity.mapEntityList[i].Submarine != this) continue; + + MapEntity.mapEntityList[i].Move(-center); + } } } diff --git a/Subsurface/Source/Map/SubmarineBody.cs b/Subsurface/Source/Map/SubmarineBody.cs index 2802e4fd0..633074961 100644 --- a/Subsurface/Source/Map/SubmarineBody.cs +++ b/Subsurface/Source/Map/SubmarineBody.cs @@ -127,6 +127,8 @@ namespace Barotrauma foreach (Hull hull in Hull.hullList) { + if (hull.Submarine != submarine) continue; + Rectangle rect = hull.Rect; FixtureFactory.AttachRectangle( ConvertUnits.ToSimUnits(rect.Width), @@ -190,30 +192,43 @@ namespace Barotrauma { float dist = Vector2.Distance((Vector2)targetPosition, Position); - if (dist > 1000.0f) //immediately snap the sub to the target position if more than 1000.0f units away + if (dist > 500.0f) //immediately snap the sub to the target position if more than 500.0f units away { Vector2 moveAmount = (Vector2)targetPosition - ConvertUnits.ToDisplayUnits(Body.Position); - ForceTranslate(moveAmount); + List dockedBodies = new List() { this }; + submarine.DockedTo.ForEach(d => dockedBodies.Add(d.SubBody)); - if ((Character.Controlled != null && Character.Controlled.Submarine == submarine) || - (Character.Controlled == null && Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == submarine)) + foreach (SubmarineBody dockedBody in dockedBodies) { - GameMain.GameScreen.Cam.UpdateTransform(false); + dockedBody.ForceTranslate(moveAmount); + + if ((Character.Controlled != null && Character.Controlled.Submarine == dockedBody.submarine) || + (Character.Controlled == null && Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == dockedBody.submarine)) + { + GameMain.GameScreen.Cam.UpdateTransform(false); + } + + dockedBody.submarine.SetPrevTransform(dockedBody.submarine.Position); + dockedBody.submarine.UpdateTransform(); + targetPosition = null; + + dockedBody.DisplaceCharacters(moveAmount); } - submarine.SetPrevTransform(submarine.Position); - submarine.UpdateTransform(); - targetPosition = null; - DisplaceCharacters(moveAmount); } - else if (dist > 50.0f) //lerp the position if (50 < dist < 1000) + else if (dist > 50.0f) //lerp the position if (50 < dist < 500) { Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position); moveAmount *= Math.Min(dist, 100.0f); ForceTranslate(moveAmount * deltaTime); + + foreach (Submarine sub in submarine.DockedTo) + { + sub.SubBody.ForceTranslate(moveAmount * deltaTime); + } } else { @@ -252,13 +267,17 @@ namespace Barotrauma private void ForceTranslate(Vector2 amount) { Body.SetTransform(Body.Position + ConvertUnits.ToSimUnits(amount), 0.0f); - if (Character.Controlled != null) Character.Controlled.CursorPosition += amount; - if ((Character.Controlled != null && Character.Controlled.Submarine == submarine) || - (Character.Controlled == null && Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == submarine)) + if (Character.Controlled != null) { - GameMain.GameScreen.Cam.Position += amount; - if (GameMain.GameScreen.Cam.TargetPos != Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += amount; + Character.Controlled.CursorPosition += amount; + + if (Character.Controlled.Submarine == submarine || + (Character.Controlled == null && Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == submarine)) + { + GameMain.GameScreen.Cam.Position += amount; + if (GameMain.GameScreen.Cam.TargetPos != Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += amount; + } } } @@ -317,10 +336,13 @@ namespace Barotrauma float neutralPercentage = 0.07f; - float buoyancy = Math.Max(neutralPercentage - waterPercentage, -neutralPercentage*2.0f); - buoyancy *= Body.Mass; + Body.IgnoreGravity = true; - return new Vector2(0.0f, buoyancy*10.0f); + float buoyancy = neutralPercentage - waterPercentage; + + if (buoyancy > 0.0f) buoyancy *= 2.0f; + + return new Vector2(0.0f, buoyancy * Body.Mass * 10.0f); } public void ApplyForce(Vector2 force) diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index bfc5100d6..7889ad367 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -806,7 +806,9 @@ namespace Barotrauma.Networking } } - if (respawnManager != null && respawnManager.CurrentState == RespawnManager.State.Waiting && + if (respawnManager != null && + respawnManager.CurrentState == RespawnManager.State.Waiting && + respawnManager.CountdownStarted && myCharacter != null && myCharacter.IsDead) { GUI.DrawString(spriteBatch, diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index 190e8ed04..52cb9ed5a 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -1175,8 +1175,10 @@ namespace Barotrauma.Networking if (gameStarted && client.Character != null) { client.Character.ClearInputs(); + client.Character.Kill(CauseOfDeath.Disconnected, true); } + if (string.IsNullOrWhiteSpace(msg)) msg = client.name + " has left the server"; if (string.IsNullOrWhiteSpace(targetmsg)) targetmsg = "You have left the server"; diff --git a/Subsurface/Source/Networking/RespawnManager.cs b/Subsurface/Source/Networking/RespawnManager.cs index 1b5a4d2f5..4cc78d598 100644 --- a/Subsurface/Source/Networking/RespawnManager.cs +++ b/Subsurface/Source/Networking/RespawnManager.cs @@ -118,7 +118,11 @@ namespace Barotrauma.Networking int characterToRespawnCount = GetClientsToRespawn().Count; if (server.Character != null && server.Character.IsDead) characterToRespawnCount++; - CountdownStarted = characterToRespawnCount >= MinCharactersToRespawn; + bool startCountdown = characterToRespawnCount >= MinCharactersToRespawn; + + if (startCountdown && !CountdownStarted) server.SendRespawnManagerMsg(); + + CountdownStarted = startCountdown; if (!CountdownStarted) return; @@ -170,17 +174,19 @@ namespace Barotrauma.Networking || (respawnShuttle.WorldPosition.Y + respawnShuttle.Borders.Y > Level.Loaded.StartPosition.Y - Level.ShaftHeight && Math.Abs(Level.Loaded.StartPosition.X - respawnShuttle.WorldPosition.X) < 1000.0f)) { - CoroutineManager.StartCoroutine( - ForceShuttleToPos(new Vector2(Level.Loaded.StartPosition.X, Level.Loaded.Size.Y + 1000.0f), 100.0f)); - - if (GameMain.GameSession != null && GameMain.GameSession.Map != null) - { - string msg = "The transportation shuttle has returned to " + GameMain.GameSession.Map.SelectedLocation; - server.SendChatMessage(ChatMessage.Create("", msg, ChatMessageType.Server, null), server.ConnectedClients); - } + CoroutineManager.StopCoroutines("forcepos"); + CoroutineManager.StartCoroutine( + ForceShuttleToPos(new Vector2(Level.Loaded.StartPosition.X, Level.Loaded.Size.Y + 1000.0f), 100.0f), "forcepos"); + //string msg = "The transportation shuttle has returned to "; + + //server.SendChatMessage(ChatMessage.Create("", msg, ChatMessageType.Server, null), server.ConnectedClients); + + state = State.Waiting; + respawnTimer = RespawnInterval; + server.SendRespawnManagerMsg(); } @@ -200,8 +206,9 @@ namespace Barotrauma.Networking server.SendChatMessage(ChatMessage.Create("", "Transportation shuttle dispatched", ChatMessageType.Server, null), server.ConnectedClients); server.SendRespawnManagerMsg(); - - CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f)); + + CoroutineManager.StopCoroutines("forcepos"); + CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f), "forcepos"); } private IEnumerable ForceShuttleToPos(Vector2 position, float speed) @@ -255,6 +262,7 @@ namespace Barotrauma.Networking if (i < clients.Count) { msg.Write((byte)clients[i].ID); + clients[i].Character = character; } else { @@ -297,7 +305,8 @@ namespace Barotrauma.Networking client.ReadCharacterData(inc, clientId == client.ID); } - CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f)); + CoroutineManager.StopCoroutines("forcepos"); + CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f), "forcepos"); break; case State.Waiting: CountdownStarted = true; diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 0b991f2a8..aa1f947b1 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -342,14 +342,14 @@ namespace Barotrauma private void DrawSubmarineIndicator(SpriteBatch spriteBatch, Submarine submarine) { - Vector2 subDiff = submarine.WorldPosition - cam.Position; + Vector2 subDiff = submarine.WorldPosition - cam.WorldViewCenter; if (Math.Abs(subDiff.X) > cam.WorldView.Width || Math.Abs(subDiff.Y) > cam.WorldView.Height) { Vector2 normalizedSubDiff = Vector2.Normalize(subDiff); Vector2 iconPos = - cam.WorldToScreen(cam.Position) + + cam.WorldToScreen(cam.WorldViewCenter) + new Vector2(normalizedSubDiff.X * GameMain.GraphicsWidth * 0.4f, -normalizedSubDiff.Y * GameMain.GraphicsHeight * 0.4f); GUI.SubmarineIcon.Draw(spriteBatch, iconPos, Color.LightBlue * 0.5f); diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index dd5f3f382..626bbff1d 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -38,7 +38,7 @@ namespace Barotrauma private GUITickBox autoRestartBox; public bool IsServer; - public string ServerName, ServerMessage; + public string ServerName; const float NetworkUpdateInterval = 1.0f; private float networkUpdateTimer; @@ -95,10 +95,6 @@ namespace Barotrauma { return ServerName; } - public string GetServerMessage() - { - return ServerMessage; - } public List JobPreferences { @@ -308,7 +304,6 @@ namespace Barotrauma serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame); serverMessage.Wrap = true; - serverMessage.TextGetter = GetServerMessage; serverMessage.OnTextChanged = UpdateServerMessage; } @@ -686,7 +681,6 @@ namespace Barotrauma public bool UpdateServerMessage(GUITextBox textBox, string text) { if (GameMain.Server == null) return false; - ServerMessage = text; valueChanged = true; return true; @@ -1107,7 +1101,7 @@ namespace Barotrauma } msg.Write(ServerName); - msg.Write(ServerMessage); + msg.Write(serverMessage.Text); msg.WriteRangedInteger(0, 2, (int)GameMain.Server.TraitorsEnabled); @@ -1147,7 +1141,7 @@ namespace Barotrauma md5Hash = msg.ReadString(); ServerName = msg.ReadString(); - ServerMessage = msg.ReadString(); + serverMessage.Text = msg.ReadString(); traitorsEnabled = (YesNoMaybe)msg.ReadRangedInteger(0, 2);