(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:
Joonas Rikkonen
2019-03-29 17:23:33 +02:00
parent ce359f5309
commit af1f8be4fa
3 changed files with 8 additions and 16 deletions

View File

@@ -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);
}

View File

@@ -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))
{

View File

@@ -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)
{