diff --git a/Subsurface/Content/Jobs.xml b/Subsurface/Content/Jobs.xml index 4a9ab622f..35fbd9766 100644 --- a/Subsurface/Content/Jobs.xml +++ b/Subsurface/Content/Jobs.xml @@ -16,7 +16,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/Subsurface/Source/Characters/AI/EnemyAIController.cs b/Subsurface/Source/Characters/AI/EnemyAIController.cs index 5eddfdb03..c6fbb5dd9 100644 --- a/Subsurface/Source/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Source/Characters/AI/EnemyAIController.cs @@ -109,9 +109,9 @@ namespace Barotrauma if (Character.AnimController is HumanoidAnimController) { - if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater) + if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater) { - Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left; + Character.AnimController.TargetDir = Character.AnimController.movement.X > 0.0f ? Direction.Right : Direction.Left; } } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs index ff548770d..b71c34a33 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs @@ -52,7 +52,7 @@ namespace Barotrauma return; } - if (container.Item.Inventory == character.Inventory) + if (container.Item.ParentInventory == character.Inventory) { var containedItems = container.Inventory.Items; //if there's already something in the mask (empty oxygen tank?), drop it diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs index e841ebea6..c7db395eb 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs @@ -106,7 +106,7 @@ namespace Barotrauma if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue; if (IgnoreContainedItems && Item.ItemList[currSearchIndex].Container != null) continue; - if (Item.ItemList[currSearchIndex].Inventory is CharacterInventory) continue; + if (Item.ItemList[currSearchIndex].ParentInventory is CharacterInventory) continue; targetItem = Item.ItemList[currSearchIndex]; diff --git a/Subsurface/Source/Events/ArtifactEvent.cs b/Subsurface/Source/Events/ArtifactEvent.cs index b441c6ea6..1f0521abf 100644 --- a/Subsurface/Source/Events/ArtifactEvent.cs +++ b/Subsurface/Source/Events/ArtifactEvent.cs @@ -49,7 +49,7 @@ namespace Barotrauma case 1: //item.body.LinearVelocity = Vector2.Zero; - if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false; + if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false; if (item.CurrentHull == null) return; state = 2; diff --git a/Subsurface/Source/Events/Quests/SalvageQuest.cs b/Subsurface/Source/Events/Quests/SalvageQuest.cs index c96ba3185..2a590af5f 100644 --- a/Subsurface/Source/Events/Quests/SalvageQuest.cs +++ b/Subsurface/Source/Events/Quests/SalvageQuest.cs @@ -52,7 +52,7 @@ namespace Barotrauma { case 0: //item.body.LinearVelocity = Vector2.Zero; - if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false; + if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false; if (item.CurrentHull == null) return; ShowMessage(state); diff --git a/Subsurface/Source/GUI/GUITextBox.cs b/Subsurface/Source/GUI/GUITextBox.cs index 47d29dc84..e957ce5c9 100644 --- a/Subsurface/Source/GUI/GUITextBox.cs +++ b/Subsurface/Source/GUI/GUITextBox.cs @@ -183,18 +183,21 @@ namespace Barotrauma if (flashTimer > 0.0f) flashTimer -= deltaTime; if (!Enabled) return; - + if (CaretEnabled) { caretTimer += deltaTime; - caretVisible = ((caretTimer*1000.0f) % 1000) < 500; + caretVisible = ((caretTimer * 1000.0f) % 1000) < 500; } if (rect.Contains(PlayerInput.MousePosition)) { + state = ComponentState.Hover; if (PlayerInput.LeftButtonClicked()) { + if (MouseOn != null && MouseOn != this && MouseOn!=textBlock && !MouseOn.IsParentOf(this)) return; + Select(); if (OnSelected != null) OnSelected(this, Keys.None); } diff --git a/Subsurface/Source/GUI/GUITickBox.cs b/Subsurface/Source/GUI/GUITickBox.cs index 65117c9a6..207b29999 100644 --- a/Subsurface/Source/GUI/GUITickBox.cs +++ b/Subsurface/Source/GUI/GUITickBox.cs @@ -61,6 +61,8 @@ namespace Barotrauma { if (!Visible || !Enabled) return; + if (MouseOn != null && MouseOn != this && !MouseOn.IsParentOf(this)) return; + if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this; if (box.Rect.Contains(PlayerInput.MousePosition)) diff --git a/Subsurface/Source/Items/CharacterInventory.cs b/Subsurface/Source/Items/CharacterInventory.cs index 18511e97a..e5e20815c 100644 --- a/Subsurface/Source/Items/CharacterInventory.cs +++ b/Subsurface/Source/Items/CharacterInventory.cs @@ -168,8 +168,8 @@ namespace Barotrauma System.Diagnostics.Debug.Assert(false); return false; } - Inventory otherInventory = Items[index].Inventory; - if (otherInventory != null && createNetworkEvent) + Inventory otherInventory = Items[index].ParentInventory; + if (otherInventory != null && otherInventory.Owner!=null && createNetworkEvent) { new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true); } @@ -219,7 +219,7 @@ namespace Barotrauma string toolTip = ""; Rectangle highlightedSlot = Rectangle.Empty; - if (doubleClickedItem!=null && doubleClickedItem.Inventory!=this) + if (doubleClickedItem!=null && doubleClickedItem.ParentInventory!=this) { TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true); } diff --git a/Subsurface/Source/Items/Components/Holdable/Holdable.cs b/Subsurface/Source/Items/Components/Holdable/Holdable.cs index 966b6fc5b..d76b560b5 100644 --- a/Subsurface/Source/Items/Components/Holdable/Holdable.cs +++ b/Subsurface/Source/Items/Components/Holdable/Holdable.cs @@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components [HasDefaultValue(false, true)] public bool Attached { - get { return attached && item.Inventory == null; } + get { return attached && item.ParentInventory == null; } set { attached = value; } } @@ -278,7 +278,7 @@ namespace Barotrauma.Items.Components } else { - if (item.Inventory != null) + if (item.ParentInventory != null) { if (body != null) { diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index e5f74a5d3..e3dd3010a 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -125,11 +125,11 @@ namespace Barotrauma if (removeItem) { item.Drop(null, false); - if (item.Inventory != null) item.Inventory.RemoveItem(item); + if (item.ParentInventory != null) item.ParentInventory.RemoveItem(item); } Items[i] = item; - item.Inventory = this; + item.ParentInventory = this; if (item.body != null) { item.body.Enabled = false; @@ -154,7 +154,7 @@ namespace Barotrauma { if (Items[n] != item) continue; Items[n] = null; - item.Inventory = null; + item.ParentInventory = null; } } diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 84bc1d6c6..e945e4a25 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -63,20 +63,20 @@ namespace Barotrauma private bool inWater; - private Inventory inventory; + private Inventory parentInventory; //the inventory in which the item is contained in - public Inventory Inventory + public Inventory ParentInventory { get { - return inventory; + return parentInventory; } set { - inventory = value; + parentInventory = value; - if (inventory != null) Container = inventory.Owner as Item; + if (parentInventory != null) Container = parentInventory.Owner as Item; } } diff --git a/Subsurface/Source/Map/FireSource.cs b/Subsurface/Source/Map/FireSource.cs index 2eeda1e94..0e66c5f2f 100644 --- a/Subsurface/Source/Map/FireSource.cs +++ b/Subsurface/Source/Map/FireSource.cs @@ -250,7 +250,7 @@ namespace Barotrauma foreach (Item item in Item.ItemList) { if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue; - if (item.Inventory != null) return; + if (item.ParentInventory != null) return; float range = (float)Math.Sqrt(size.X) * 10.0f; if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue; diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index f9b67df76..36dba58e9 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -262,7 +262,7 @@ namespace Barotrauma.Networking (myCharacter == null || myCharacter.IsDead); //restart if all characters are dead or submarine is at the end of the level - if ((AutoRestart && isCrewDead) + if ((autoRestart && isCrewDead) || (endRoundAtLevelEnd && Submarine.Loaded!=null && Submarine.Loaded.AtEndPosition)) { @@ -716,7 +716,7 @@ namespace Barotrauma.Networking yield return new WaitForSeconds(3.0f); //save all the current events to a list and clear them - var existingEvents = NetworkEvent.Events; + var existingEvents = new List(NetworkEvent.Events); NetworkEvent.Events.Clear(); foreach (Hull hull in Hull.hullList) @@ -740,7 +740,7 @@ namespace Barotrauma.Networking item.NewComponentEvent(item.components[i], false, true); } - if (item.body == null || item.body.Enabled == false) continue; + if (item.body == null || !item.body.Enabled || item.ParentInventory!=null) continue; new NetworkEvent(NetworkEventType.DropItem, item.ID, false); } @@ -758,7 +758,7 @@ namespace Barotrauma.Networking yield return new WaitForSeconds(0.1f); //save "normal" events again - existingEvents = NetworkEvent.Events; + existingEvents = new List(NetworkEvent.Events); } yield return CoroutineStatus.Success; diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index a760808d4..c0beadcad 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -134,10 +134,10 @@ namespace Barotrauma //new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont); - new GUITextBlock(new Rectangle(0, 0, 0, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); + new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]); - new GUITextBlock(new Rectangle(0, 50, 0, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); + new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]); portBox.Text = NetConfig.DefaultPort.ToString(); portBox.ToolTip = "Server port"; @@ -155,7 +155,7 @@ namespace Barotrauma plusPlayersBox.UserData = 1; plusPlayersBox.OnClicked = ChangeMaxPlayers; - new GUITextBlock(new Rectangle(0, 150, 0, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); + new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]); passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]); isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]); diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index 347631c86..c88ea34af 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -668,11 +668,20 @@ namespace Barotrauma //GameMain.GameScreen.Cam.TargetPos = pos; //GameMain.GameScreen.Cam.MoveCamera((float)deltaTime); + if (jobInfoFrame != null) + { + jobInfoFrame.Update((float)deltaTime); + } + else if (playerFrame != null) + { + playerFrame.Update((float)deltaTime); + } + else + { + menu.Update((float)deltaTime); - if (jobInfoFrame != null) jobInfoFrame.Update((float)deltaTime); - - if (playerFrame != null) playerFrame.Update((float)deltaTime); + } if (autoRestartTimer != 0.0f && autoRestartBox.Selected) { diff --git a/Subsurface/Source/Screens/Screen.cs b/Subsurface/Source/Screens/Screen.cs index b45e81416..efe49daef 100644 --- a/Subsurface/Source/Screens/Screen.cs +++ b/Subsurface/Source/Screens/Screen.cs @@ -20,7 +20,11 @@ namespace Barotrauma public virtual void Select() { - if (selected != null && selected!=this) selected.Deselect(); + if (selected != null && selected != this) + { + selected.Deselect(); + GUIComponent.KeyboardDispatcher.Subscriber = null; + } selected = this; } diff --git a/Subsurface/Source/Sprite.cs b/Subsurface/Source/Sprite.cs index 99038a9c9..da6222bf9 100644 --- a/Subsurface/Source/Sprite.cs +++ b/Subsurface/Source/Sprite.cs @@ -197,9 +197,9 @@ namespace Barotrauma public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) { - //for (int x = -1; x < 3; x += 2) + //for (int x = -1; x <= 1; x += 2) //{ - // for (int y = -1; y < 3; y += 2) + // for (int y = -1; y <= 1; y += 2) // { // spriteBatch.Draw(texture, pos + offset + new Vector2(x, y) * 1.0f, sourceRect, Color.Black, rotation + rotate, origin, scale, spriteEffect, (depth == null ? this.depth : (float)depth) + 0.0001f); diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index a02f5188f..c85670725 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ