]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
make filled inventory slots blank (#27150)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sat, 20 Apr 2024 03:17:29 +0000 (23:17 -0400)
committerGitHub <noreply@github.com>
Sat, 20 Apr 2024 03:17:29 +0000 (13:17 +1000)
* blank filled slots

* Update InventoryTemplatePrototype.cs

18 files changed:
Content.Client/Inventory/ClientInventorySystem.cs
Content.Client/Inventory/StrippableBoundUserInterface.cs
Content.Client/UserInterface/Controls/SlotButton.cs
Content.Client/UserInterface/Controls/SlotControl.cs
Content.Client/UserInterface/Systems/Hands/HandsUIController.cs
Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs
Content.Shared/Inventory/InventoryTemplatePrototype.cs
Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml
Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml
Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml
Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml
Resources/Prototypes/InventoryTemplates/holoclown_inventory_template.yml
Resources/Prototypes/InventoryTemplates/human_inventory_template.yml
Resources/Prototypes/InventoryTemplates/kangaroo_inventory_template.yml
Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml
Resources/Textures/Interface/Ashen/template_small.png [new file with mode: 0644]
Resources/Textures/Interface/Minimalist/template_small.png [new file with mode: 0644]
Resources/Textures/Interface/Retro/template_small.png [new file with mode: 0644]

index 7b98513a92950a84dba19f064c74b4da0d0a7f19..1416545573a0320dfc1992ba72fde3b786c08243 100644 (file)
@@ -251,6 +251,7 @@ namespace Content.Client.Inventory
             public string SlotGroup => SlotDef.SlotGroup;
             public string SlotDisplayName => SlotDef.DisplayName;
             public string TextureName => "Slots/" + SlotDef.TextureName;
+            public string FullTextureName => SlotDef.FullTextureName;
 
             public SlotData(SlotDefinition slotDef, ContainerSlot? container = null, bool highlighted = false,
                 bool blocked = false)
index f8eb12df914021ec789b80eb6ba4f9f39b321e90..33f38688edf62fd410161897de35c160a320be80 100644 (file)
@@ -219,7 +219,7 @@ namespace Content.Client.Inventory
 
             if (entity == null)
             {
-                button.SpriteView.SetEntity(null);
+                button.SetEntity(null);
                 return;
             }
 
@@ -231,7 +231,7 @@ namespace Content.Client.Inventory
             else
                 return;
 
-            button.SpriteView.SetEntity(viewEnt);
+            button.SetEntity(viewEnt);
         }
     }
 }
index 4ec68616069510ada09ccfc155bf387eb257c34e..c33782371f5482e2a7c6157ea02a2eaf6a2a8776 100644 (file)
@@ -9,6 +9,7 @@ namespace Content.Client.UserInterface.Controls
         public SlotButton(SlotData slotData)
         {
             ButtonTexturePath = slotData.TextureName;
+            FullButtonTexturePath = slotData.FullTextureName;
             Blocked = slotData.Blocked;
             Highlight = slotData.Highlighted;
             StorageTexturePath = "Slots/back";
index 9b94f8a0c8cd47f8ce0663c2d647fe4b82fa86dc..a684bb05efd72994ce5b36de6c3914c24d15da30 100644 (file)
@@ -15,11 +15,12 @@ namespace Content.Client.UserInterface.Controls
         public TextureRect ButtonRect { get; }
         public TextureRect BlockedRect { get; }
         public TextureRect HighlightRect { get; }
-        public SpriteView SpriteView { get; }
         public SpriteView HoverSpriteView { get; }
         public TextureButton StorageButton { get; }
         public CooldownGraphic CooldownDisplay { get; }
 
+        private SpriteView SpriteView { get; }
+
         public EntityUid? Entity => SpriteView.Entity;
 
         private bool _slotNameSet;
@@ -68,7 +69,18 @@ namespace Content.Client.UserInterface.Controls
             set
             {
                 _buttonTexturePath = value;
-                ButtonRect.Texture = Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
+                UpdateButtonTexture();
+            }
+        }
+
+        private string? _fullButtonTexturePath;
+        public string? FullButtonTexturePath
+        {
+            get => _fullButtonTexturePath;
+            set
+            {
+                _fullButtonTexturePath = value;
+                UpdateButtonTexture();
             }
         }
 
@@ -197,6 +209,21 @@ namespace Content.Client.UserInterface.Controls
             HoverSpriteView.SetEntity(null);
         }
 
+        public void SetEntity(EntityUid? ent)
+        {
+            SpriteView.SetEntity(ent);
+            UpdateButtonTexture();
+        }
+
+        private void UpdateButtonTexture()
+        {
+            var fullTexture = Theme.ResolveTextureOrNull(_fullButtonTexturePath);
+            var texture = Entity.HasValue && fullTexture != null
+                ? fullTexture.Texture
+                : Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
+            ButtonRect.Texture = texture;
+        }
+
         private void OnButtonPressed(GUIBoundKeyEventArgs args)
         {
             Pressed?.Invoke(args, this);
@@ -229,8 +256,8 @@ namespace Content.Client.UserInterface.Controls
             base.OnThemeUpdated();
 
             StorageButton.TextureNormal = Theme.ResolveTextureOrNull(_storageTexturePath)?.Texture;
-            ButtonRect.Texture = Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
             HighlightRect.Texture = Theme.ResolveTextureOrNull(_highlightTexturePath)?.Texture;
+            UpdateButtonTexture();
         }
 
         EntityUid? IEntityControl.UiEntity => Entity;
index 1bcdd89af627f46f1d4742c52f36d30b32743ab3..bb550b043382d2640db4228ef3dc6003534906f6 100644 (file)
@@ -120,12 +120,12 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
 
             if (_entities.TryGetComponent(hand.HeldEntity, out VirtualItemComponent? virt))
             {
-                handButton.SpriteView.SetEntity(virt.BlockingEntity);
+                handButton.SetEntity(virt.BlockingEntity);
                 handButton.Blocked = true;
             }
             else
             {
-                handButton.SpriteView.SetEntity(hand.HeldEntity);
+                handButton.SetEntity(hand.HeldEntity);
                 handButton.Blocked = false;
             }
         }
@@ -171,12 +171,12 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
 
         if (_entities.TryGetComponent(entity, out VirtualItemComponent? virt))
         {
-            hand.SpriteView.SetEntity(virt.BlockingEntity);
+            hand.SetEntity(virt.BlockingEntity);
             hand.Blocked = true;
         }
         else
         {
-            hand.SpriteView.SetEntity(entity);
+            hand.SetEntity(entity);
             hand.Blocked = false;
         }
 
@@ -190,7 +190,7 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
         if (hand == null)
             return;
 
-        hand.SpriteView.SetEntity(null);
+        hand.SetEntity(null);
         if (_playerHandsComponent?.ActiveHand?.Name == name)
             HandsGui?.UpdatePanelEntity(null);
     }
index ad007be5fb056e830c7140f46b7b21caf91f6901..fb74779917080370bf61abbd8d7630703d00fd63 100644 (file)
@@ -417,7 +417,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
 
         if (_strippingWindow?.InventoryButtons.GetButton(update.Name) is { } inventoryButton)
         {
-            inventoryButton.SpriteView.SetEntity(entity);
+            inventoryButton.SetEntity(entity);
             inventoryButton.StorageButton.Visible = showStorage;
         }
 
@@ -426,12 +426,12 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
 
         if (_entities.TryGetComponent(entity, out VirtualItemComponent? virtb))
         {
-            button.SpriteView.SetEntity(virtb.BlockingEntity);
+            button.SetEntity(virtb.BlockingEntity);
             button.Blocked = true;
         }
         else
         {
-            button.SpriteView.SetEntity(entity);
+            button.SetEntity(entity);
             button.Blocked = false;
             button.StorageButton.Visible = showStorage;
         }
index 585f80d4ce96594b5dfb1eaf145614f22046529e..3a605523bf8ccb48342ef014505701cc083cb63c 100644 (file)
@@ -17,6 +17,10 @@ public sealed partial class SlotDefinition
 {
     [DataField("name", required: true)] public string Name { get; private set; } = string.Empty;
     [DataField("slotTexture")] public string TextureName { get; private set; } = "pocket";
+    /// <summary>
+    /// The texture displayed in a slot when it has an item inside of it.
+    /// </summary>
+    [DataField] public string FullTextureName { get; private set; } = "SlotBackground";
     [DataField("slotFlags")] public SlotFlags SlotFlags { get; private set; } = SlotFlags.PREVENTEQUIP;
     [DataField("showInWindow")] public bool ShowInWindow { get; private set; } = true;
     [DataField("slotGroup")] public string SlotGroup { get; private set; } = "Default";
index 6252ad8e993f9497b3ae9196bb378608f02ba469..84806a051a73291e5de6e959a53305070380e774 100644 (file)
@@ -11,6 +11,7 @@
       displayName: ID
     - name: id
       slotTexture: id
+      fullTextureName: template_small
       slotFlags: IDCARD
       slotGroup: SecondHotbar
       stripTime: 6
index daf0161b7cb19610579862dca4a0172dd8ddb4d7..c0da3567c21b87b8eb67beb35a1ee7ac8abdf2ac 100644 (file)
@@ -55,6 +55,7 @@
       displayName: Head
     - name: id
       slotTexture: id
+      fullTextureName: template_small
       slotFlags: IDCARD
       slotGroup: SecondHotbar
       stripTime: 6
@@ -64,6 +65,7 @@
       displayName: ID
     - name: belt
       slotTexture: belt
+      fullTextureName: template_small
       slotFlags: BELT
       slotGroup: SecondHotbar
       stripTime: 6
@@ -72,6 +74,7 @@
       displayName: Belt
     - name: back
       slotTexture: back
+      fullTextureName: template_small
       slotFlags: BACK
       slotGroup: SecondHotbar
       stripTime: 6
@@ -81,6 +84,7 @@
 
     - name: pocket4
       slotTexture: web
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -89,6 +93,7 @@
       displayName: Pocket 4
     - name: pocket3
       slotTexture: web
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
       displayName: Suit
     - name: pocket1
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
       stripHidden: true
     - name: pocket2
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
index 41fa7dc375f87b425c1346afdb618bf6f0f0c214..a672e403b3a17d98733d1022f8dcbf1b3db40f32 100644 (file)
@@ -55,6 +55,7 @@
       displayName: Head
     - name: pocket1
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -65,6 +66,7 @@
       stripHidden: true
     - name: pocket2
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -84,6 +86,7 @@
       displayName: Suit Storage
     - name: belt
       slotTexture: belt
+      fullTextureName: template_small
       slotFlags: BELT
       slotGroup: SecondHotbar
       stripTime: 6
index 4bbd18b13645d2d0964b723e5b8da2ec728f56c1..5d909264fe4df5857017c22d0326c5b8189357a7 100644 (file)
@@ -56,6 +56,7 @@
       displayName: Head
     - name: pocket1
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -66,6 +67,7 @@
       stripHidden: true
     - name: pocket2
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -85,6 +87,7 @@
       displayName: Suit Storage
     - name: id
       slotTexture: id
+      fullTextureName: template_small
       slotFlags: IDCARD
       slotGroup: SecondHotbar
       stripTime: 6
@@ -94,6 +97,7 @@
       displayName: ID
     - name: belt
       slotTexture: belt
+      fullTextureName: template_small
       slotFlags: BELT
       slotGroup: SecondHotbar
       stripTime: 6
       displayName: Belt
     - name: back
       slotTexture: back
+      fullTextureName: template_small
       slotFlags: BACK
       slotGroup: SecondHotbar
       stripTime: 6
index 57dce506eaf89544f0d0277ddccacbd892e21794..7be9c75015bb348efc7544b047dba0a0fa69b26c 100644 (file)
@@ -3,6 +3,7 @@
   slots:
     - name: pocket1
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -12,6 +13,7 @@
       stripHidden: true
     - name: pocket2
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
index 574ecca35f492226271de33262bc9c2ad5762eb6..2070f646b794c49c13ad4746f5e23e7ce59b0dcc 100644 (file)
@@ -62,6 +62,7 @@
       displayName: Head
     - name: pocket1
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -72,6 +73,7 @@
       stripHidden: true
     - name: pocket2
       slotTexture: pocket
+      fullTextureName: template_small
       slotFlags: POCKET
       slotGroup: MainHotbar
       stripTime: 3
@@ -91,6 +93,7 @@
       displayName: Suit Storage
     - name: id
       slotTexture: id
+      fullTextureName: template_small
       slotFlags: IDCARD
       slotGroup: SecondHotbar
       stripTime: 6
       displayName: ID
     - name: belt
       slotTexture: belt
+      fullTextureName: template_small
       slotFlags: BELT
       slotGroup: SecondHotbar
       stripTime: 6
       displayName: Belt
     - name: back
       slotTexture: back
+      fullTextureName: template_small
       slotFlags: BACK
       slotGroup: SecondHotbar
       stripTime: 6
index fb7dee1ec2b711b664aab5b9a970e31b0421e21f..5f81cdebc6c06be893f7c7a54b3994d5bbafde76 100644 (file)
@@ -35,6 +35,7 @@
 
   - name: belt
     slotTexture: belt
+    fullTextureName: template_small
     slotFlags: BELT
     slotGroup: SecondHotbar
     stripTime: 6
@@ -47,6 +48,7 @@
 
   - name: pocket1
     slotTexture: pocket
+    fullTextureName: template_small
     slotFlags: POCKET
     slotGroup: MainHotbar
     stripTime: 3
@@ -60,6 +62,7 @@
   slots:
   - name: pocket1
     slotTexture: pocket
+    fullTextureName: template_small
     slotFlags: POCKET
     slotGroup: MainHotbar
     stripTime: 3
index 5af23dabac2ccea2b2e471f8bbc8bb5ef4c86436..bdd51000844fd96c5df2360615f0e92c01d11c58 100644 (file)
@@ -29,6 +29,7 @@
     displayName: Jumpsuit
   - name: id
     slotTexture: id
+    fullTextureName: template_small
     slotFlags: IDCARD
     slotGroup: SecondHotbar
     stripTime: 6
diff --git a/Resources/Textures/Interface/Ashen/template_small.png b/Resources/Textures/Interface/Ashen/template_small.png
new file mode 100644 (file)
index 0000000..f3a4379
Binary files /dev/null and b/Resources/Textures/Interface/Ashen/template_small.png differ
diff --git a/Resources/Textures/Interface/Minimalist/template_small.png b/Resources/Textures/Interface/Minimalist/template_small.png
new file mode 100644 (file)
index 0000000..eb0ee03
Binary files /dev/null and b/Resources/Textures/Interface/Minimalist/template_small.png differ
diff --git a/Resources/Textures/Interface/Retro/template_small.png b/Resources/Textures/Interface/Retro/template_small.png
new file mode 100644 (file)
index 0000000..7244b37
Binary files /dev/null and b/Resources/Textures/Interface/Retro/template_small.png differ