From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 20 Apr 2024 03:17:29 +0000 (-0400) Subject: make filled inventory slots blank (#27150) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=e5a5196b1f5cba8e0f05c374b2b7c58eea6f7361;p=space-station-14.git make filled inventory slots blank (#27150) * blank filled slots * Update InventoryTemplatePrototype.cs --- diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index 7b98513a92..1416545573 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -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) diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index f8eb12df91..33f38688ed 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -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); } } } diff --git a/Content.Client/UserInterface/Controls/SlotButton.cs b/Content.Client/UserInterface/Controls/SlotButton.cs index 4ec6861606..c33782371f 100644 --- a/Content.Client/UserInterface/Controls/SlotButton.cs +++ b/Content.Client/UserInterface/Controls/SlotButton.cs @@ -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"; diff --git a/Content.Client/UserInterface/Controls/SlotControl.cs b/Content.Client/UserInterface/Controls/SlotControl.cs index 9b94f8a0c8..a684bb05ef 100644 --- a/Content.Client/UserInterface/Controls/SlotControl.cs +++ b/Content.Client/UserInterface/Controls/SlotControl.cs @@ -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; diff --git a/Content.Client/UserInterface/Systems/Hands/HandsUIController.cs b/Content.Client/UserInterface/Systems/Hands/HandsUIController.cs index 1bcdd89af6..bb550b0433 100644 --- a/Content.Client/UserInterface/Systems/Hands/HandsUIController.cs +++ b/Content.Client/UserInterface/Systems/Hands/HandsUIController.cs @@ -120,12 +120,12 @@ public sealed class HandsUIController : UIController, IOnStateEntered + /// The texture displayed in a slot when it has an item inside of it. + /// + [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"; diff --git a/Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml index 6252ad8e99..84806a051a 100644 --- a/Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml @@ -11,6 +11,7 @@ displayName: ID - name: id slotTexture: id + fullTextureName: template_small slotFlags: IDCARD slotGroup: SecondHotbar stripTime: 6 diff --git a/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml index daf0161b7c..c0da3567c2 100644 --- a/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml @@ -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 @@ -104,6 +109,7 @@ displayName: Suit - name: pocket1 slotTexture: pocket + fullTextureName: template_small slotFlags: POCKET slotGroup: MainHotbar stripTime: 3 @@ -114,6 +120,7 @@ stripHidden: true - name: pocket2 slotTexture: pocket + fullTextureName: template_small slotFlags: POCKET slotGroup: MainHotbar stripTime: 3 diff --git a/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml index 41fa7dc375..a672e403b3 100644 --- a/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml @@ -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 diff --git a/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml index 4bbd18b136..5d909264fe 100644 --- a/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml @@ -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 @@ -102,6 +106,7 @@ displayName: Belt - name: back slotTexture: back + fullTextureName: template_small slotFlags: BACK slotGroup: SecondHotbar stripTime: 6 diff --git a/Resources/Prototypes/InventoryTemplates/holoclown_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/holoclown_inventory_template.yml index 57dce506ea..7be9c75015 100644 --- a/Resources/Prototypes/InventoryTemplates/holoclown_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/holoclown_inventory_template.yml @@ -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 diff --git a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml index 574ecca35f..2070f646b7 100644 --- a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml @@ -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 @@ -100,6 +103,7 @@ displayName: ID - name: belt slotTexture: belt + fullTextureName: template_small slotFlags: BELT slotGroup: SecondHotbar stripTime: 6 @@ -108,6 +112,7 @@ displayName: Belt - name: back slotTexture: back + fullTextureName: template_small slotFlags: BACK slotGroup: SecondHotbar stripTime: 6 diff --git a/Resources/Prototypes/InventoryTemplates/kangaroo_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/kangaroo_inventory_template.yml index fb7dee1ec2..5f81cdebc6 100644 --- a/Resources/Prototypes/InventoryTemplates/kangaroo_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/kangaroo_inventory_template.yml @@ -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 diff --git a/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml index 5af23dabac..bdd5100084 100644 --- a/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml @@ -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 index 0000000000..f3a4379f76 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 index 0000000000..eb0ee037fd 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 index 0000000000..7244b37f5c Binary files /dev/null and b/Resources/Textures/Interface/Retro/template_small.png differ