From a535567317f7b285fa5f9852e60774a8b9b6af5a Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 25 Apr 2020 00:58:23 +0200 Subject: [PATCH] Fix inventory buttons going blank when switching mob. --- .../HumanInventoryInterfaceController.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index cb9eb32451..f824ac1f6c 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -1,6 +1,4 @@ -// Only unused on .NET Core due to KeyValuePair.Deconstruct -// ReSharper disable once RedundantUsingDirective -using Content.Client.Utility; +using Content.Client.Utility; using JetBrains.Annotations; using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.UserInterface; @@ -139,6 +137,21 @@ namespace Content.Client.GameObjects base.PlayerAttached(); _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()