diff --git a/Content.Client/Entry/IgnoredComponents.cs b/Content.Client/Entry/IgnoredComponents.cs index 6694b7c108..25ed24744d 100644 --- a/Content.Client/Entry/IgnoredComponents.cs +++ b/Content.Client/Entry/IgnoredComponents.cs @@ -177,7 +177,6 @@ namespace Content.Client.Entry "Firelock", "AtmosPlaque", "Spillable", - "StorageCounter", "SpaceVillainArcade", "Flammable", "Smoking", diff --git a/Content.Client/Storage/ClientStorageComponent.cs b/Content.Client/Storage/ClientStorageComponent.cs index a264f77e00..72df6c226f 100644 --- a/Content.Client/Storage/ClientStorageComponent.cs +++ b/Content.Client/Storage/ClientStorageComponent.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; using System.Linq; using Content.Client.Animations; -using Content.Client.Items.Components; using Content.Client.Hands; +using Content.Client.Items.Components; using Content.Client.UserInterface.Controls; using Content.Shared.DragDrop; +using Content.Shared.Stacks; using Content.Shared.Storage; +using Content.Shared.Storage.Components; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; @@ -33,7 +35,6 @@ namespace Content.Client.Storage private int StorageSizeUsed; private int StorageCapacityMax; private StorageWindow? _window; - private SharedBagState _bagState; public override IReadOnlyList StoredEntities => _storedEntities; @@ -83,15 +84,12 @@ namespace Content.Client.Storage //Updates what we are storing for the UI case StorageHeldItemsMessage msg: HandleStorageMessage(msg); - ChangeStorageVisualization(_bagState); break; //Opens the UI case OpenStorageUIMessage _: - ChangeStorageVisualization(SharedBagState.Open); ToggleUI(); break; case CloseStorageUIMessage _: - ChangeStorageVisualization(SharedBagState.Close); CloseUI(); break; case AnimateInsertingEntitiesMessage msg: @@ -138,22 +136,36 @@ namespace Content.Client.Storage if (_window == null) return; if (_window.IsOpen) + { _window.Close(); + ChangeStorageVisualization(SharedBagState.Close); + } else + { _window.OpenCentered(); + ChangeStorageVisualization(SharedBagState.Open); + } } private void CloseUI() { - _window?.Close(); + if (_window == null) return; + + _window.Close(); + ChangeStorageVisualization(SharedBagState.Close); + } private void ChangeStorageVisualization(SharedBagState state) { - _bagState = state; + if (Owner.TryGetComponent(out var appearanceComponent)) { appearanceComponent.SetData(SharedBagOpenVisuals.BagState, state); + if (Owner.HasComponent()) + { + appearanceComponent.SetData(StackVisuals.Hide, state == SharedBagState.Close); + } } } diff --git a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs index 38dabbee29..363c6cf061 100644 --- a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs +++ b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs @@ -1,6 +1,7 @@  using Content.Shared.Stacks; using Content.Shared.Storage; +using Content.Shared.Storage.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; @@ -57,7 +58,7 @@ namespace Content.Client.Storage.Visualizers spriteComponent.LayerSetVisible(OpenIcon, false); break; } - component.SetData(StackVisuals.Hide, bagState == SharedBagState.Close); + } } } diff --git a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs index e3efd2712a..d1d3c88714 100644 --- a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs +++ b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Content.Shared.Storage.ItemCounter; +using Content.Shared.Storage.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; @@ -36,7 +36,7 @@ namespace Content.Client.Storage.Visualizers InitLayers(spriteComponent, component); } EnableLayers(spriteComponent, component); - + } } diff --git a/Content.Server/Storage/Components/StorageCounterComponent.cs b/Content.Server/Storage/Components/StorageCounterComponent.cs deleted file mode 100644 index 113b466751..0000000000 --- a/Content.Server/Storage/Components/StorageCounterComponent.cs +++ /dev/null @@ -1,82 +0,0 @@ - -using System; -using System.Collections.Generic; -using Content.Shared.Stacks; -using Content.Shared.Tag; -using Robust.Server.GameObjects; -using Robust.Shared.Containers; -using Robust.Shared.GameObjects; -using Robust.Shared.Log; -using Robust.Shared.Serialization; -using Robust.Shared.Serialization.Manager.Attributes; - -namespace Content.Server.Storage.Components -{ - /// - /// Storage that spawns and counts a single item. - /// Usually used for things like matchboxes, cigarette packs, - /// cigar cases etc. - /// - /// - /// - type: StorageCounter - /// amount: 6 # Note: this field can be omitted - /// countTag: Cigarette # Note: field doesn't point to entity Id, but its tag - /// - [Obsolete("Should be deprecated in favor of SharedItemCounterSystem")] - [RegisterComponent] - public class StorageCounterComponent : Component, ISerializationHooks - { - // TODO Convert to EntityWhitelist - [DataField("countTag")] - private string? _countTag; - - [DataField("amount")] - private int? _maxAmount; - - /// - /// Single item storage component usually have an attached StackedVisualizer. - /// - [ComponentDependency] private readonly AppearanceComponent? _appearanceComponent = default; - - public override string Name => "StorageCounter"; - - void ISerializationHooks.AfterDeserialization() - { - if (_countTag == null) - { - Logger.Warning("StorageCounterComponent without a `countTag` is useless"); - } - } - - public void ContainerUpdateAppearance(IContainer container) - { - if(_appearanceComponent is null) - return; - - var actual = Count(container.ContainedEntities); - _appearanceComponent.SetData(StackVisuals.Actual, actual); - - if (_maxAmount != null) - { - _appearanceComponent.SetData(StackVisuals.MaxCount, _maxAmount); - } - } - - private int Count(IReadOnlyList containerContainedEntities) - { - var count = 0; - if (_countTag != null) - { - foreach (var entity in containerContainedEntities) - { - if (entity.HasTag(_countTag)) - { - count++; - } - } - } - - return count; - } - } -} diff --git a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs index cdd53e335c..74b355b5e7 100644 --- a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs +++ b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs @@ -1,41 +1,29 @@ -using System.Collections.Generic; -using Content.Server.Storage.Components; -using Content.Shared.Storage.ItemCounter; +using Content.Server.Storage.Components; +using Content.Shared.Storage.Components; +using Content.Shared.Storage.EntitySystems; using JetBrains.Annotations; using Robust.Shared.Containers; -using Robust.Shared.GameObjects; namespace Content.Server.Storage.EntitySystems { [UsedImplicitly] public class ItemCounterSystem : SharedItemCounterSystem { - protected override bool TryGetContainer(ContainerModifiedMessage msg, - ItemCounterComponent itemCounter, - out IReadOnlyList showLayers) + protected override int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter) { - if (msg.Container.Owner.TryGetComponent(out ServerStorageComponent? component)) + if (!msg.Container.Owner.TryGetComponent(out ServerStorageComponent? component) + || component.StoredEntities == null) { - var containedLayers = component.StoredEntities ?? new List(); - var list = new List(); - foreach (var mapLayerData in itemCounter.MapLayers.Values) - { - foreach (var entity in containedLayers) - { - if (mapLayerData.Whitelist.IsValid(entity)) - { - list.Add(mapLayerData.Layer); - break; - } - } - } - - showLayers = list; - return true; + return null; } - showLayers = new List(); - return false; + var count = 0; + foreach (var entity in component.StoredEntities) + { + if (itemCounter.Count.IsValid(entity)) count++; + } + + return count; } } -} +} \ No newline at end of file diff --git a/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs b/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs new file mode 100644 index 0000000000..889122e196 --- /dev/null +++ b/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using Content.Server.Storage.Components; +using Content.Shared.Storage.Components; +using Content.Shared.Storage.EntitySystems; +using JetBrains.Annotations; +using Robust.Shared.Analyzers; +using Robust.Shared.Containers; +using Robust.Shared.GameObjects; + +namespace Content.Server.Storage.EntitySystems +{ + [UsedImplicitly] + public class ItemMapperSystem : SharedItemMapperSystem + { + protected override bool TryGetLayers(ContainerModifiedMessage msg, + ItemMapperComponent itemMapper, + out IReadOnlyList showLayers) + { + if (msg.Container.Owner.TryGetComponent(out ServerStorageComponent? component)) + { + var containedLayers = component.StoredEntities ?? new List(); + var list = new List(); + foreach (var mapLayerData in itemMapper.MapLayers.Values) + { + foreach (var entity in containedLayers) + { + if (mapLayerData.Whitelist.IsValid(entity)) + { + list.Add(mapLayerData.Layer); + break; + } + } + } + + showLayers = list; + return true; + } + + showLayers = new List(); + return false; + } + } +} \ No newline at end of file diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index d80a8e32a9..bafc86ae47 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -39,11 +39,6 @@ namespace Content.Server.Storage.EntitySystems { storageComp.HandleEntityMaybeRemoved(message); } - - if (oldParentEntity.TryGetComponent(out var newStorageComp)) - { - newStorageComp.ContainerUpdateAppearance(message.Container); - } } private static void HandleEntityInsertedIntoContainer(EntInsertedIntoContainerMessage message) @@ -54,11 +49,6 @@ namespace Content.Server.Storage.EntitySystems { storageComp.HandleEntityMaybeInserted(message); } - - if (oldParentEntity.TryGetComponent(out var newStorageComp)) - { - newStorageComp.ContainerUpdateAppearance(message.Container); - } } private void CheckSubscribedEntities(ServerStorageComponent storageComp) diff --git a/Content.Shared/Storage/Components/ItemCounterComponent.cs b/Content.Shared/Storage/Components/ItemCounterComponent.cs new file mode 100644 index 0000000000..bc355c5b84 --- /dev/null +++ b/Content.Shared/Storage/Components/ItemCounterComponent.cs @@ -0,0 +1,33 @@ +using Content.Shared.Storage.EntitySystems; +using Content.Shared.Whitelist; +using Robust.Shared.Analyzers; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Shared.Storage.Components +{ + + /// + /// Storage that spawns and counts a single item. + /// Usually used for things like matchboxes, cigarette packs, + /// cigar cases etc. + /// + /// + /// - type: ItemCounter + /// amount: 6 # Note: this field can be omitted. + /// count: + /// tags: [Cigarette] + /// + [RegisterComponent] + [Friend(typeof(SharedItemCounterSystem))] + public class ItemCounterComponent : Component + { + public override string Name => "ItemCounter"; + + [DataField("count", required: true)] + public EntityWhitelist Count { get; set; } = default!; + + [DataField("amount")] + public int? MaxAmount { get; set; } + } +} diff --git a/Content.Shared/Storage/ItemCounter/ItemCounterComponent.cs b/Content.Shared/Storage/Components/ItemMapperComponent.cs similarity index 63% rename from Content.Shared/Storage/ItemCounter/ItemCounterComponent.cs rename to Content.Shared/Storage/Components/ItemMapperComponent.cs index c06dc53987..d682801dce 100644 --- a/Content.Shared/Storage/ItemCounter/ItemCounterComponent.cs +++ b/Content.Shared/Storage/Components/ItemMapperComponent.cs @@ -1,14 +1,17 @@ using System.Collections.Generic; +using Content.Shared.Storage.EntitySystems; +using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Shared.Storage.ItemCounter +namespace Content.Shared.Storage.Components { [RegisterComponent] - public class ItemCounterComponent : Component, ISerializationHooks + [Friend(typeof(SharedItemMapperSystem))] + public class ItemMapperComponent : Component, ISerializationHooks { - public override string Name => "ItemCounter"; + public override string Name => "ItemMapper"; [DataField("mapLayers")] public readonly Dictionary MapLayers = new(); @@ -21,4 +24,4 @@ namespace Content.Shared.Storage.ItemCounter } } -} \ No newline at end of file +} diff --git a/Content.Shared/Storage/SharedBagOpenVisuals.cs b/Content.Shared/Storage/Components/SharedBagOpenVisuals.cs similarity index 86% rename from Content.Shared/Storage/SharedBagOpenVisuals.cs rename to Content.Shared/Storage/Components/SharedBagOpenVisuals.cs index be4a8013d4..fd8111402a 100644 --- a/Content.Shared/Storage/SharedBagOpenVisuals.cs +++ b/Content.Shared/Storage/Components/SharedBagOpenVisuals.cs @@ -1,7 +1,7 @@ using System; using Robust.Shared.Serialization; -namespace Content.Shared.Storage +namespace Content.Shared.Storage.Components { [Serializable, NetSerializable] public enum SharedBagOpenVisuals : byte diff --git a/Content.Shared/Storage/ItemCounter/SharedMapLayerData.cs b/Content.Shared/Storage/Components/SharedMapLayerData.cs similarity index 95% rename from Content.Shared/Storage/ItemCounter/SharedMapLayerData.cs rename to Content.Shared/Storage/Components/SharedMapLayerData.cs index 4bc7867ddf..9b1fad5148 100644 --- a/Content.Shared/Storage/ItemCounter/SharedMapLayerData.cs +++ b/Content.Shared/Storage/Components/SharedMapLayerData.cs @@ -4,7 +4,7 @@ using Content.Shared.Whitelist; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Shared.Storage.ItemCounter +namespace Content.Shared.Storage.Components { [Serializable, NetSerializable] public enum StorageMapVisuals : sbyte @@ -43,4 +43,4 @@ namespace Content.Shared.Storage.ItemCounter QueuedEntities = other.QueuedEntities; } } -} \ No newline at end of file +} diff --git a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs new file mode 100644 index 0000000000..66dec9829c --- /dev/null +++ b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs @@ -0,0 +1,51 @@ +using Content.Shared.Stacks; +using Content.Shared.Storage.Components; +using JetBrains.Annotations; +using Robust.Shared.Containers; +using Robust.Shared.GameObjects; + +namespace Content.Shared.Storage.EntitySystems +{ + [UsedImplicitly] + public abstract class SharedItemCounterSystem : EntitySystem + { + /// + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(CounterEntityInserted); + SubscribeLocalEvent(CounterEntityRemoved); + } + + private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter, + EntInsertedIntoContainerMessage args) + { + if (!itemCounter.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent)) return; + + var count = GetCount(args, itemCounter); + if (count == null) + return; + + appearanceComponent.SetData(StackVisuals.Actual, count); + if (itemCounter.MaxAmount != null) + appearanceComponent.SetData(StackVisuals.MaxCount, itemCounter.MaxAmount); + + } + + private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, + EntRemovedFromContainerMessage args) + { + if (!itemCounter.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent)) return; + + var count = GetCount(args, itemCounter); + if (count == null) + return; + + appearanceComponent.SetData(StackVisuals.Actual, count); + if (itemCounter.MaxAmount != null) + appearanceComponent.SetData(StackVisuals.MaxCount, itemCounter.MaxAmount); + } + + protected abstract int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter); + } +} \ No newline at end of file diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs new file mode 100644 index 0000000000..5e257906d4 --- /dev/null +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using Content.Shared.Storage.Components; +using JetBrains.Annotations; +using Robust.Shared.Containers; +using Robust.Shared.GameObjects; + +namespace Content.Shared.Storage.EntitySystems +{ + [UsedImplicitly] + public abstract class SharedItemMapperSystem : EntitySystem + { + /// + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(InitLayers); + SubscribeLocalEvent(MapperEntityInserted); + SubscribeLocalEvent(MapperEntityRemoved); + } + + private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args) + { + if (component.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent)) + { + var list = new List(component.MapLayers.Keys); + appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list)); + } + } + + private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper, + EntRemovedFromContainerMessage args) + { + if (itemMapper.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent) + && TryGetLayers(args, itemMapper, out var containedLayers)) + { + appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); + } + } + + private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper, + EntInsertedIntoContainerMessage args) + { + if (itemMapper.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent) + && TryGetLayers(args, itemMapper, out var containedLayers)) + { + appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); + } + } + + protected abstract bool TryGetLayers(ContainerModifiedMessage msg, + ItemMapperComponent itemMapper, + out IReadOnlyList containedLayers); + } +} \ No newline at end of file diff --git a/Content.Shared/Storage/ItemCounter/SharedItemCounterSystem.cs b/Content.Shared/Storage/ItemCounter/SharedItemCounterSystem.cs deleted file mode 100644 index cde603bec9..0000000000 --- a/Content.Shared/Storage/ItemCounter/SharedItemCounterSystem.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Collections.Generic; -using JetBrains.Annotations; -using Robust.Shared.Containers; -using Robust.Shared.GameObjects; - -namespace Content.Shared.Storage.ItemCounter -{ - [UsedImplicitly] - public abstract class SharedItemCounterSystem : EntitySystem - { - /// - public override void Initialize() - { - base.Initialize(); - SubscribeLocalEvent(InitLayers); - SubscribeLocalEvent(HandleEntityInsert); - SubscribeLocalEvent(HandleEntityRemoved); - } - - private void InitLayers(EntityUid uid, ItemCounterComponent component, ComponentInit args) - { - if (component.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent)) - { - var list = new List(component.MapLayers.Keys); - appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list)); - } - } - - private void HandleEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, - EntRemovedFromContainerMessage args) - { - if (itemCounter.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent) - && TryGetContainer(args, itemCounter, out var containedLayers)) - { - appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); - } - } - - private void HandleEntityInsert(EntityUid uid, ItemCounterComponent itemCounter, - EntInsertedIntoContainerMessage args) - { - if (itemCounter.Owner.TryGetComponent(out SharedAppearanceComponent? appearanceComponent) - && TryGetContainer(args, itemCounter, out var containedLayers)) - { - appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); - } - } - - protected abstract bool TryGetContainer(ContainerModifiedMessage msg, - ItemCounterComponent itemCounter, - out IReadOnlyList containedLayers); - } -} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml index 46c6baa8f7..471f391e9c 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml @@ -32,7 +32,7 @@ - Welder - Radio - PowerCell - - type: ItemCounter + - type: ItemMapper mapLayers: cutters_red: whitelist: @@ -99,7 +99,7 @@ - Radio - Handcuff - PowerCell - - type: ItemCounter + - type: ItemMapper mapLayers: drill: whitelist: @@ -161,7 +161,7 @@ - Handcuff - RangedMagazine - Ammo - - type: ItemCounter + - type: ItemMapper mapLayers: flashbang: whitelist: @@ -196,7 +196,7 @@ - Soap - Flashlight - CigPack - - type: ItemCounter + - type: ItemMapper mapLayers: bottle: whitelist: @@ -241,7 +241,7 @@ - Hypospray - SurgeryTool - Radio - - type: ItemCounter + - type: ItemMapper mapLayers: bottle: whitelist: @@ -300,7 +300,7 @@ components: - Seed - Smoking - - type: ItemCounter + - type: ItemMapper mapLayers: hatchet: whitelist: @@ -352,7 +352,7 @@ - FlashOnTrigger - Flash - Handcuff - - type: ItemCounter + - type: ItemMapper mapLayers: flashbang: whitelist: @@ -396,7 +396,7 @@ - type: StorageFill contents: - id: CaptainSabre - - type: ItemCounter + - type: ItemMapper mapLayers: sheath-bag: whitelist: diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/box.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/box.yml index 3904455874..cc8187d2aa 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/box.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/box.yml @@ -26,25 +26,26 @@ HeldPrefix: box - type: StorageFill contents: - - id: FoodDonutPink - amount: 3 - - id: FoodDonutPlain - amount: 3 - - type: StorageCounter - countTag: Donut + - id: FoodDonutPink + amount: 3 + - id: FoodDonutPlain + amount: 3 + - type: ItemCounter + count: + tags: [Donut] - type: Appearance visuals: - - type: BagOpenCloseVisualizer - openIcon: box-open - - type: StackVisualizer - composite: true - stackLayers: - - box1 - - pink-box2 - - box3 - - pink-box4 - - box5 - - pink-box6 + - type: BagOpenCloseVisualizer + openIcon: box-open + - type: StackVisualizer + composite: true + stackLayers: + - box1 + - pink-box2 + - box3 + - pink-box4 + - box5 + - pink-box6 # Egg @@ -68,29 +69,30 @@ size: 12 - type: StorageFill contents: - - id: FoodEgg - amount: 12 - - type: StorageCounter - countTag: Egg + - id: FoodEgg + amount: 12 + - type: ItemCounter + count: + tags: [Egg] - type: Appearance visuals: - - type: BagOpenCloseVisualizer - openIcon: box-open - - type: StackVisualizer - composite: true - stackLayers: - - box1 - - box2 - - box3 - - box4 - - box5 - - box6 - - box7 - - box8 - - box9 - - box10 - - box11 - - box12 + - type: BagOpenCloseVisualizer + openIcon: box-open + - type: StackVisualizer + composite: true + stackLayers: + - box1 + - box2 + - box3 + - box4 + - box5 + - box6 + - box7 + - box8 + - box9 + - box10 + - box11 + - box12 # Someday... # - type: DamageOnLand # amount: 5 @@ -123,8 +125,8 @@ components: - type: StorageFill contents: - - id: Eggshells - amount: 12 + - id: Eggshells + amount: 12 - type: Destructible thresholds: - trigger: @@ -164,16 +166,16 @@ # stackType: PizzaBox - type: Appearance visuals: - - type: StorageVisualizer - state_open: box-open - state_closed: box - # - type: StackVisualizer - # stackLayers: - # - box - # - box1 - # - box2 - # - box3 - # - box4 + - type: StorageVisualizer + state_open: box-open + state_closed: box + # - type: StackVisualizer + # stackLayers: + # - box + # - box1 + # - box2 + # - box3 + # - box4 - type: entity name: pizza box @@ -236,23 +238,24 @@ HeldPrefix: box - type: StorageFill contents: - - id: FoodBakedNugget - amount: 6 - - type: StorageCounter - countTag: Nugget + - id: FoodBakedNugget + amount: 6 + - type: ItemCounter + count: + tags: [Nugget] - type: Appearance visuals: - - type: BagOpenCloseVisualizer - openIcon: box-open - - type: StackVisualizer - composite: true - stackLayers: - - box1 - - box2 - - box3 - - box4 - - box5 - - box6 + - type: BagOpenCloseVisualizer + openIcon: box-open + - type: StackVisualizer + composite: true + stackLayers: + - box1 + - box2 + - box3 + - box4 + - box5 + - box6 # Donkpocket @@ -277,8 +280,8 @@ color: red - type: StorageFill contents: - - id: FoodDonkpocket - amount: 6 + - id: FoodDonkpocket + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -291,8 +294,8 @@ sprite: Objects/Consumable/Food/Baked/donkpocket.rsi - type: StorageFill contents: - - id: FoodDonkpocketSpicy - amount: 6 + - id: FoodDonkpocketSpicy + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -305,8 +308,8 @@ sprite: Objects/Consumable/Food/Baked/donkpocket.rsi - type: StorageFill contents: - - id: FoodDonkpocketTeriyaki - amount: 6 + - id: FoodDonkpocketTeriyaki + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -320,8 +323,8 @@ color: white - type: StorageFill contents: - - id: FoodDonkpocketPizza - amount: 6 + - id: FoodDonkpocketPizza + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -335,8 +338,8 @@ color: brown - type: StorageFill contents: - - id: FoodDonkpocketGondola - amount: 6 + - id: FoodDonkpocketGondola + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -349,8 +352,8 @@ sprite: Objects/Consumable/Food/Baked/donkpocket.rsi - type: StorageFill contents: - - id: FoodDonkpocketBerry - amount: 6 + - id: FoodDonkpocketBerry + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -364,8 +367,8 @@ color: yellow - type: StorageFill contents: - - id: FoodDonkpocketHonk - amount: 6 + - id: FoodDonkpocketHonk + amount: 6 - type: entity parent: FoodBoxDonkpocket @@ -380,5 +383,5 @@ color: green - type: StorageFill contents: - - id: FoodDonkpocketDink - amount: 6 + - id: FoodDonkpocketDink + amount: 6 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigarettes/packs.yml b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigarettes/packs.yml index 9750b497f4..24b80a6e0b 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigarettes/packs.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigarettes/packs.yml @@ -13,24 +13,25 @@ size: 6 - type: StorageFill contents: - - id: Cigarette - amount: 6 - - type: StorageCounter - countTag: Cigarette + - id: Cigarette + amount: 6 + - type: ItemCounter + count: + tags: [Cigarette] - type: Appearance visuals: - - type: BagOpenCloseVisualizer - openIcon: open - - type: StackVisualizer - sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/visualizer.rsi - composite: true - stackLayers: - - cig1 - - cig2 - - cig3 - - cig4 - - cig5 - - cig6 + - type: BagOpenCloseVisualizer + openIcon: open + - type: StackVisualizer + sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/visualizer.rsi + composite: true + stackLayers: + - cig1 + - cig2 + - cig3 + - cig4 + - cig5 + - cig6 - type: entity id: CigPackGreen @@ -42,7 +43,7 @@ netsync: false sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/green.rsi layers: - - state: closed + - state: closed - type: Item sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/green.rsi size: 6 @@ -57,7 +58,7 @@ netsync: false sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/red.rsi layers: - - state: closed + - state: closed - type: Item sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/red.rsi size: 6 @@ -72,7 +73,7 @@ netsync: false sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/blue.rsi layers: - - state: closed + - state: closed - type: Item sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/blue.rsi size: 6 @@ -87,7 +88,7 @@ netsync: false sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/black.rsi layers: - - state: closed + - state: closed - type: Item sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/black.rsi size: 6 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/case.yml b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/case.yml index b5edd2e6ab..7e13720eca 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/case.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/case.yml @@ -8,7 +8,7 @@ netsync: false sprite: Objects/Consumable/Smokeables/Cigars/case.rsi layers: - - state: closed + - state: closed - type: Storage capacity: 8 - type: Item @@ -16,25 +16,26 @@ size: 8 - type: StorageFill contents: - - id: Cigar - amount: 8 - - type: StorageCounter - countTag: Cigar + - id: Cigar + amount: 8 + - type: ItemCounter + count: + tags: [Cigar] - type: Appearance visuals: - - type: BagOpenCloseVisualizer - openIcon: open - - type: StackVisualizer - composite: true - stackLayers: - - cigar1 - - cigar2 - - cigar3 - - cigar4 - - cigar5 - - cigar6 - - cigar7 - - cigar8 + - type: BagOpenCloseVisualizer + openIcon: open + - type: StackVisualizer + composite: true + stackLayers: + - cigar1 + - cigar2 + - cigar3 + - cigar4 + - cigar5 + - cigar6 + - cigar7 + - cigar8 - type: entity id: CigarGoldCase @@ -44,5 +45,5 @@ components: - type: StorageFill contents: - - id: CigarGold - amount: 8 + - id: CigarGold + amount: 8 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks_cans.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks_cans.yml index 1a7f099beb..72ee575de3 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks_cans.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks_cans.yml @@ -193,8 +193,9 @@ contents: - id: DrinkColaCan amount: 6 - - type: StorageCounter - countTag: Cola + - type: ItemCounter + count: + tags: [Cola] - type: Appearance visuals: - type: StackVisualizer diff --git a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml index 6507da9848..322157c4f2 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml @@ -203,8 +203,6 @@ sprite: Objects/Fun/crayons.rsi size: 9999 HeldPrefix: box - - type: StorageCounter - countTag: Crayon - type: StorageFill contents: - id: CrayonRed @@ -214,7 +212,7 @@ - id: CrayonBlue - id: CrayonPurple - id: CrayonBlack - - type: ItemCounter + - type: ItemMapper mapLayers: black_box: whitelist: diff --git a/Resources/Prototypes/Entities/Objects/Tools/matches.yml b/Resources/Prototypes/Entities/Objects/Tools/matches.yml index 6d2fd13813..fb077a2aeb 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/matches.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/matches.yml @@ -63,8 +63,9 @@ contents: - id: Matchstick amount: 6 - - type: StorageCounter - countTag: Matchstick + - type: ItemCounter + count: + tags: [Cigar] - type: Appearance visuals: - type: BagOpenCloseVisualizer