Fix inventory buttons going blank when switching mob.

This commit is contained in:
Pieter-Jan Briers
2020-04-25 00:58:23 +02:00
parent f95f640608
commit a535567317

View File

@@ -1,6 +1,4 @@
// Only unused on .NET Core due to KeyValuePair.Deconstruct using Content.Client.Utility;
// ReSharper disable once RedundantUsingDirective
using Content.Client.Utility;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
@@ -139,6 +137,21 @@ namespace Content.Client.GameObjects
base.PlayerAttached(); base.PlayerAttached();
_gameHud.InventoryQuickButtonContainer.AddChild(_quickButtonsContainer); _gameHud.InventoryQuickButtonContainer.AddChild(_quickButtonsContainer);
// Update all the buttons to make sure they check out.
foreach (var (slot, buttons) in _inventoryButtons)
{
foreach (var button in buttons)
{
ClearButton(button, slot);
}
if (Owner.TryGetSlot(slot, out var entity))
{
AddToSlot(slot, entity);
}
}
} }
public override void PlayerDetached() public override void PlayerDetached()