From 29e979d60a9a63b7b97a10c0e5f8dca4bec7abbb Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 5 Apr 2019 16:13:27 +0300 Subject: [PATCH] (7840e7e91) Fixed characters selecting entities when dragging and dropping items into them when the Select input is bind to Mouse1. --- .../Source/Characters/CharacterNetworking.cs | 3 ++- .../Source/GameSession/CrewManager.cs | 17 +++++++---------- .../BarotraumaClient/Source/Items/Inventory.cs | 2 ++ .../Source/Characters/Character.cs | 3 +++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs index 8f9c23d0a..b23194981 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs @@ -68,7 +68,8 @@ namespace Barotrauma states = newInput, intAim = intAngle }; - if (focusedItem != null && (!newMem.states.HasFlag(InputNetFlags.Grab) && !newMem.states.HasFlag(InputNetFlags.Health))) + if (focusedItem != null && !CharacterInventory.DraggingItemToWorld && + (!newMem.states.HasFlag(InputNetFlags.Grab) && !newMem.states.HasFlag(InputNetFlags.Health))) { newMem.interact = focusedItem.ID; } diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 736783e38..132a7cfc6 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -60,12 +60,19 @@ namespace Barotrauma public CrewManager(XElement element, bool isSinglePlayer) : this(isSinglePlayer) + { + return characterListBox.Rect; + } + + partial void InitProjectSpecific() { guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent) { CanBeFocused = false }; + Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale)); + var characterInfo = new CharacterInfo(subElement); characterInfos.Add(characterInfo); foreach (XElement invElement in subElement.Elements()) @@ -125,16 +132,6 @@ namespace Barotrauma prevUIScale = GUI.Scale; } - - #endregion - - #region Character list management - - public Rectangle GetCharacterListArea() - { - return characterListBox.Rect; - } - partial void InitProjectSpecific() { guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs index 7944ddf9d..9f6de7fde 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -600,6 +600,8 @@ namespace Barotrauma { if (draggingItem != null && PlayerInput.LeftButtonReleased()) { + Character.Controlled.ClearInputs(); + if (CharacterHealth.OpenHealthWindow != null && CharacterHealth.OpenHealthWindow.OnItemDropped(draggingItem, false)) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 6518c994c..1f500d2ac 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1782,6 +1782,9 @@ namespace Barotrauma } else if (focusedItem != null) { +#if CLIENT + if (CharacterInventory.DraggingItemToWorld) { return; } +#endif bool canInteract = focusedItem.TryInteract(this); #if CLIENT if (Controlled == this)