]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix inventory GUI for non-inventory entities (#31306)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Thu, 22 Aug 2024 17:05:17 +0000 (03:05 +1000)
committerGitHub <noreply@github.com>
Thu, 22 Aug 2024 17:05:17 +0000 (13:05 -0400)
Default to invisible and only set visible if itemslots gets initialised.

Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs
Content.Client/UserInterface/Systems/Inventory/Widgets/InventoryGui.xaml

index 5d7a775104cb29ec178d428787a3fbf6d2ed7d4c..49a2fba89812dc316f90c46e19279d47a3ee72c7 100644 (file)
@@ -21,6 +21,7 @@ using Robust.Client.UserInterface.Controls;
 using Robust.Shared.Input;
 using Robust.Shared.Input.Binding;
 using Robust.Shared.Map;
+using Robust.Shared.Player;
 using Robust.Shared.Utility;
 using static Content.Client.Inventory.ClientInventorySystem;
 
@@ -399,6 +400,9 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
         foreach (var slotData in clientInv.SlotData.Values)
         {
             AddSlot(slotData);
+
+            if (_inventoryButton != null)
+                _inventoryButton.Visible = true;
         }
 
         UpdateInventoryHotbar(_playerInventory);
@@ -406,6 +410,9 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
 
     private void UnloadSlots()
     {
+        if (_inventoryButton != null)
+            _inventoryButton.Visible = false;
+
         _playerUid = null;
         _playerInventory = null;
         foreach (var slotGroup in _slotGroups.Values)
index 576d06d8161961fda7e738c2a385756c53e47493..d4fb68c38daa512e9cc0c41c618c40d7a23a9eaf 100644 (file)
@@ -9,9 +9,11 @@
     Orientation="Horizontal"
     HorizontalAlignment="Center">
     <Control HorizontalAlignment="Center">
+        <!-- Needs to default to invisible because if we attach to a non-slots entity this will never get unset -->
         <controls:SlotButton
             Name="InventoryButton"
             Access="Public"
+            Visible="False"
             VerticalAlignment="Bottom"
             HorizontalExpand="False"
             VerticalExpand="False"