diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 87d29a9e2..7fab0116d 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -224,6 +224,13 @@ namespace Barotrauma } } + if (SelectedConstruction != null && SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null && HUD.CloseHUD(ic.GuiFrame.Rect))) + { + //emulate a Select input to get the character to deselect the item server-side + keys[(int)InputType.Select].Hit = true; + SelectedConstruction = null; + } + DoInteractionUpdate(deltaTime, mouseSimPos); } diff --git a/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs index 8c126470f..8f2aa6359 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs @@ -10,12 +10,6 @@ namespace Barotrauma protected override void ControlInput(Camera cam) { - if (draggingItem == null && HUD.CloseHUD(BackgroundFrame)) - { - // TODO: fix so that works with the server side - Character.Controlled.SelectedConstruction = null; - return; - } base.ControlInput(cam); if (BackgroundFrame.Contains(PlayerInput.MousePosition)) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index abe389538..8993574a8 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1269,15 +1269,7 @@ namespace Barotrauma if (IsKeyDown(InputType.Aim) && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this); } } - -#if CLIENT - if (SelectedConstruction != null && SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null && HUD.CloseHUD(ic.GuiFrame.Rect))) - { - //emulate a Select input to get the character to deselect the item server-side - keys[(int)InputType.Select].Hit = true; - SelectedConstruction = null; - } -#endif + if (SelectedConstruction != null) { if (IsKeyDown(InputType.Use)) SelectedConstruction.Use(deltaTime, this); @@ -1291,7 +1283,6 @@ namespace Barotrauma DeselectCharacter(); } } - if (IsRemotePlayer && keys!=null) {