(ad3954bd2) Moved item HUD closing logic to Character.ControlLocal and removed it from ItemInventory. The deselection in ItemInventory was not synced with the server, causing the item to be immediately reselected after the HUD has been closed (and the logic was redundant anyway because it's also handled in Character).
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user