diff --git a/Subsurface/Content/Items/Door/doors.xml b/Subsurface/Content/Items/Door/doors.xml index 3fafbebbf..7e1d1e859 100644 --- a/Subsurface/Content/Items/Door/doors.xml +++ b/Subsurface/Content/Items/Door/doors.xml @@ -6,13 +6,18 @@ - + + + + + + @@ -30,7 +35,7 @@ - + @@ -38,6 +43,11 @@ + + + + + diff --git a/Subsurface/Content/Items/Electricity/signalitems.xml b/Subsurface/Content/Items/Electricity/signalitems.xml index 8e64051b4..6f4f3ea07 100644 --- a/Subsurface/Content/Items/Electricity/signalitems.xml +++ b/Subsurface/Content/Items/Electricity/signalitems.xml @@ -4,7 +4,7 @@ (); + if (connectionPanel!=null) + { + foreach (Connection c in connectionPanel.connections) + { + foreach (Wire w in c.Wires) + { + if (w == null) continue; + + w.Item.Drop(picker); + w.Item.SetTransform(item.SimPosition, 0.0f); + } + } + } + ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker); //foreach (StatusEffect effect in item.Prefab.statusEffects) diff --git a/Subsurface/Source/Items/FixRequirement.cs b/Subsurface/Source/Items/FixRequirement.cs index e60892550..4c734809a 100644 --- a/Subsurface/Source/Items/FixRequirement.cs +++ b/Subsurface/Source/Items/FixRequirement.cs @@ -53,7 +53,7 @@ namespace Barotrauma GUIComponent component = reqFrame.children.Find(c => c.UserData as string == itemName); GUITextBlock text = component as GUITextBlock; - Item item = character.Inventory.items.FirstOrDefault(i => i !=null && i.Name == itemName); + Item item = character.Inventory.items.FirstOrDefault(i => i !=null && (i.Name == itemName || i.HasTag(itemName))); bool itemFound = (item != null); if (!itemFound) success = false; diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index e4004b4c4..993d84ee6 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -339,6 +339,8 @@ namespace Barotrauma rect.X = (int)(displayPos.X - rect.Width / 2.0f); rect.Y = (int)(displayPos.Y + rect.Height / 2.0f); + + FindHull(); } public override void Move(Vector2 amount) @@ -390,7 +392,7 @@ namespace Barotrauma public bool HasTag(string tag) { - return (tags.Contains(tag)); + return (tags.Contains(tag) || tags.Contains(tag.ToLower())); } @@ -863,7 +865,7 @@ namespace Barotrauma { picker.SelectedConstruction = (picker.SelectedConstruction == this) ? null : this; } - + if (!hasRequiredSkills && Character.Controlled==picker) { GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f); diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index 3b45763df..dd465b6f3 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -404,7 +404,8 @@ namespace Barotrauma.Networking string msg = inc.ReadString(); new GUIMessageBox("You have been kicked out from the server", msg); - + + Disconnect(); GameMain.MainMenuScreen.Select(); break; @@ -433,7 +434,6 @@ namespace Barotrauma.Networking private IEnumerable StartGame(NetIncomingMessage inc) { - if (this.Character != null) Character.Remove(); int seed = inc.ReadInt32(); diff --git a/Subsurface/Source/Networking/NetworkMember.cs b/Subsurface/Source/Networking/NetworkMember.cs index a283e3e40..bb9d01277 100644 --- a/Subsurface/Source/Networking/NetworkMember.cs +++ b/Subsurface/Source/Networking/NetworkMember.cs @@ -115,7 +115,7 @@ namespace Barotrauma.Networking crewFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style); crewFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 200, 300), Color.White * 0.7f, GUI.Style, crewFrame); + GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 300, 300), Color.White * 0.7f, GUI.Style, crewFrame); crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); crewList.OnSelected = SelectCharacter; diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index bf973a0a3..b50efa362 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -155,6 +155,12 @@ namespace Barotrauma { base.Select(); + if (GameMain.NetworkMember != null) + { + GameMain.NetworkMember.Disconnect(); + GameMain.NetworkMember = null; + } + Submarine.Unload(); SelectTab(null, 0); diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index 669459947..720b5184c 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -23,12 +23,12 @@ namespace Barotrauma private GUITextBox textBox, seedBox; - //private GUIScrollBar durationBar; - - private GUIFrame playerFrame; + private GUIFrame myPlayerFrame; private GUIFrame jobInfoFrame; + private GUIFrame playerFrame; + private float camAngle; public bool IsServer; @@ -125,11 +125,11 @@ namespace Barotrauma //player info panel ------------------------------------------------------------ - playerFrame = new GUIFrame( + myPlayerFrame = new GUIFrame( new Rectangle((int)(panelRect.Width * 0.7f + 20), 0, (int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.6f)), GUI.Style, menu); - playerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); + myPlayerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); //player list ------------------------------------------------------------------ @@ -139,6 +139,7 @@ namespace Barotrauma GUI.Style, menu); playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame); + playerList.OnSelected = SelectPlayer; //submarine list ------------------------------------------------------------------ @@ -203,16 +204,6 @@ namespace Barotrauma columnX += modeDescription.Rect.Width + 40; - //duration ------------------------------------------------------------------ - - //GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), - // "Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); - //durationText.TextGetter = DurationText; - - //durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20), - // GUI.Style, 0.1f, infoFrame); - //durationBar.BarSize = 0.1f; - //seed ------------------------------------------------------------------ new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), @@ -253,6 +244,7 @@ namespace Barotrauma GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; subList.Enabled = GameMain.Server != null; + playerList.Enabled = GameMain.Server != null; modeList.Enabled = GameMain.Server != null; seedBox.Enabled = GameMain.Server != null; serverMessage.Enabled = GameMain.Server != null; @@ -274,9 +266,9 @@ namespace Barotrauma if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1); if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1); - if (playerFrame.children.Find(c => c.UserData as string == "playyourself") == null) + if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null) { - var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame); + var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame); playYourself.Selected = GameMain.Server.CharacterInfo != null; playYourself.OnSelected = TogglePlayYourself; playYourself.UserData = "playyourself"; @@ -292,40 +284,40 @@ namespace Barotrauma private void UpdatePlayerFrame(CharacterInfo characterInfo) { - if (playerFrame.children.Count <= 1) + if (myPlayerFrame.children.Count <= 1) { - playerFrame.ClearChildren(); + myPlayerFrame.ClearChildren(); if (IsServer && GameMain.Server != null) { - var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame); + var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame); playYourself.Selected = GameMain.Server.CharacterInfo != null; playYourself.OnSelected = TogglePlayYourself; playYourself.UserData = "playyourself"; } - new GUITextBlock(new Rectangle(60, 30, 200, 30), "Name: ", GUI.Style, playerFrame); + new GUITextBlock(new Rectangle(60, 30, 200, 30), "Name: ", GUI.Style, myPlayerFrame); GUITextBox playerName = new GUITextBox(new Rectangle(60, 55, 0, 20), - Alignment.TopLeft, GUI.Style, playerFrame); + Alignment.TopLeft, GUI.Style, myPlayerFrame); playerName.Text = characterInfo.Name; playerName.OnEnter += ChangeCharacterName; - new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, playerFrame); + new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, myPlayerFrame); GUIButton maleButton = new GUIButton(new Rectangle(70, 100, 60, 20), "Male", - Alignment.TopLeft, GUI.Style, playerFrame); + Alignment.TopLeft, GUI.Style, myPlayerFrame); maleButton.UserData = Gender.Male; maleButton.OnClicked += SwitchGender; GUIButton femaleButton = new GUIButton(new Rectangle(140, 100, 60, 20), "Female", - Alignment.TopLeft, GUI.Style, playerFrame); + Alignment.TopLeft, GUI.Style, myPlayerFrame); femaleButton.UserData = Gender.Female; femaleButton.OnClicked += SwitchGender; - new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.Style, playerFrame); + new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.Style, myPlayerFrame); - jobList = new GUIListBox(new Rectangle(0, 180, 0, 0), GUI.Style, playerFrame); + jobList = new GUIListBox(new Rectangle(0, 180, 0, 0), GUI.Style, myPlayerFrame); jobList.Enabled = false; @@ -366,14 +358,14 @@ namespace Barotrauma } else { - playerFrame.ClearChildren(); + myPlayerFrame.ClearChildren(); if (IsServer && GameMain.Server != null) { GameMain.Server.CharacterInfo = null; GameMain.Server.Character = null; - var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame); + var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame); playYourself.OnSelected = TogglePlayYourself; } } @@ -430,11 +422,43 @@ namespace Barotrauma if (child != null) playerList.RemoveChild(child); } - //public void RemovePlayer(Client client) - //{ - // if (client == null) return; - // playerList.RemoveChild(playerList.GetChild(client)); - //} + private bool SelectPlayer(GUIComponent component, object obj) + { + playerFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), Color.Black * 0.3f); + + var playerFrameInner = new GUIFrame(new Rectangle(0,0,300,150), null, Alignment.Center, GUI.Style, playerFrame); + playerFrameInner.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); + + new GUITextBlock(new Rectangle(0,0,200,20), component.UserData.ToString(), + GUI.Style, Alignment.TopLeft, Alignment.TopLeft, + playerFrameInner, false, GUI.LargeFont); + + var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, GUI.Style, playerFrameInner); + kickButton.UserData = obj; + kickButton.OnClicked += KickPlayer; + kickButton.OnClicked += ClosePlayerFrame; + + var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, GUI.Style, playerFrameInner); + closeButton.OnClicked = ClosePlayerFrame; + + return true; + } + + private bool ClosePlayerFrame(GUIButton button, object userData) + { + playerFrame = null; + + return true; + } + + private bool KickPlayer(GUIButton button, object userData) + { + if (GameMain.Server == null || userData == null) return false; + + GameMain.Server.KickPlayer(userData.ToString()); + + return false; + } public void ClearPlayers() { @@ -465,6 +489,8 @@ namespace Barotrauma menu.Update((float)deltaTime); if (jobInfoFrame != null) jobInfoFrame.Update((float)deltaTime); + + if (playerFrame != null) playerFrame.Update((float)deltaTime); //durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f); } @@ -483,6 +509,8 @@ namespace Barotrauma //if (previewPlayer!=null) previewPlayer.Draw(spriteBatch); + if (playerFrame != null) playerFrame.Draw(spriteBatch); + GUI.Draw((float)deltaTime, spriteBatch, null); spriteBatch.End(); @@ -522,10 +550,10 @@ namespace Barotrauma private void UpdatePreviewPlayer(CharacterInfo characterInfo) { - GUIComponent existing = playerFrame.FindChild("playerhead"); - if (existing != null) playerFrame.RemoveChild(existing); + GUIComponent existing = myPlayerFrame.FindChild("playerhead"); + if (existing != null) myPlayerFrame.RemoveChild(existing); - GUIImage image = new GUIImage(new Rectangle(0, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, playerFrame); + GUIImage image = new GUIImage(new Rectangle(0, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, myPlayerFrame); image.UserData = "playerhead"; } diff --git a/Subsurface/Source/Utils/ToolBox.cs b/Subsurface/Source/Utils/ToolBox.cs index bf8abcf2c..fffb718f4 100644 --- a/Subsurface/Source/Utils/ToolBox.cs +++ b/Subsurface/Source/Utils/ToolBox.cs @@ -301,8 +301,15 @@ namespace Barotrauma { str = str.Substring(0, Math.Min(str.Length, 32)); + str = str.PadLeft(4, 'a'); + byte[] asciiBytes = Encoding.ASCII.GetBytes(str); + for (int i = 4; i < asciiBytes.Length; i++) + { + asciiBytes[i % 4] |= asciiBytes[i]; + } + return BitConverter.ToInt32(asciiBytes, 0); } diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 416391887..b611f99c7 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ