+++ /dev/null
-using Content.Shared.Storage.Components;
-using JetBrains.Annotations;
-using Robust.Client.GameObjects;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Log;
-using Robust.Shared.Serialization;
-using Robust.Shared.Serialization.Manager.Attributes;
-using static Robust.Shared.Utility.SpriteSpecifier;
-
-namespace Content.Client.Storage.Visualizers
-{
- [UsedImplicitly]
- public sealed class BagOpenCloseVisualizer : AppearanceVisualizer, ISerializationHooks
- {
- private const string OpenIcon = "openIcon";
- [DataField(OpenIcon)]
- private string? _openIcon;
-
- void ISerializationHooks.AfterDeserialization()
- {
- if(_openIcon == null){
- Logger.Warning("BagOpenCloseVisualizer is useless with no `openIcon`");
- }
- }
-
- [Obsolete("Subscribe to your component being initialised instead.")]
- public override void InitializeEntity(EntityUid entity)
- {
- base.InitializeEntity(entity);
-
- var entities = IoCManager.Resolve<IEntityManager>();
-
- if (_openIcon != null &&
- entities.TryGetComponent<SpriteComponent?>(entity, out var spriteComponent) &&
- spriteComponent.BaseRSI?.Path is { } path)
- {
- spriteComponent.LayerMapReserveBlank(OpenIcon);
- spriteComponent.LayerSetSprite(OpenIcon, new Rsi(path, _openIcon));
- spriteComponent.LayerSetVisible(OpenIcon, false);
- }
- }
-
- [Obsolete("Subscribe to AppearanceChangeEvent instead.")]
- public override void OnChangeData(AppearanceComponent component)
- {
- base.OnChangeData(component);
-
- var entities = IoCManager.Resolve<IEntityManager>();
-
- if (_openIcon == null ||
- !entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent))
- return;
-
- if (!component.TryGetData<SharedBagState>(SharedBagOpenVisuals.BagState, out var bagState))
- return;
-
- switch (bagState)
- {
- case SharedBagState.Open:
- spriteComponent.LayerSetVisible(OpenIcon, true);
- break;
- default:
- spriteComponent.LayerSetVisible(OpenIcon, false);
- break;
- }
- }
- }
-}
# an alpha color which -Y- said he would implement.
- type: entity
- parent: BoxCardboard
+ parent: [ BoxCardboard, BaseBagOpenClose ]
id: FoodBoxDonut
name: donut box
description: Mmm, Donuts.
netsync: false
sprite: Objects/Consumable/Food/Baked/donut.rsi
state: box
+ layers:
+ - state: box
+ - state: box-open
+ map: ["openLayer"]
- type: Storage
capacity: 6
whitelist:
tags: [Donut]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: box-open
- type: StackVisualizer
composite: true
stackLayers:
# Egg
- type: entity
- parent: BoxCardboard
+ parent: [ BoxCardboard, BaseBagOpenClose ]
id: FoodContainerEgg
name: egg carton
description: Don't drop 'em!
netsync: false
sprite: Objects/Consumable/Food/egg.rsi
state: box-closed
+ layers:
+ - state: box-closed
+ - state: box-open
+ map: ["openLayer"]
- type: Storage
capacity: 12
whitelist:
tags: [Egg]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: box-open
- type: StackVisualizer
composite: true
stackLayers:
# Nugget
- type: entity
- parent: BoxCardboard
+ parent: [ BoxCardboard, BaseBagOpenClose ]
id: FoodBoxNugget
name: chicken nuggets
description: You suddenly have an urge to trade on the intergalactic stock market.
netsync: false
sprite: Objects/Consumable/Food/Baked/nuggets.rsi
state: box
+ layers:
+ - state: box
+ - state: box-open
+ map: ["openLayer"]
- type: Storage
capacity: 6
- type: Item
tags: [Nugget]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: box-open
- type: StackVisualizer
composite: true
stackLayers:
- type: entity
id: HappyHonk
- parent: BoxCardboard
+ parent: [ BoxCardboard, BaseBagOpenClose ]
name: happy honk meal
suffix: Toy Safe
description: The toy is more edible than the food.
netsync: false
sprite: Objects/Storage/Happyhonk/clown.rsi
state: box
+ layers:
+ - state: box
+ - state: box-open
+ map: ["openLayer"]
- type: Item
sprite: Objects/Storage/Happyhonk/clown.rsi
heldPrefix: box
- - type: Appearance
- visuals:
- - type: BagOpenCloseVisualizer
- openIcon: box-open
- type: Storage
capacity: 30
- type: Tag
- type: entity
id: CigCartonGreen
- parent: BoxCardboard
+ parent: [ BoxCardboard, BaseBagOpenClose ]
name: Spessman's Smokes carton
description: "A carton containing 6 packets of Spessman's Smokes."
components:
sprite: Objects/Consumable/Smokeables/Cigarettes/Cartons/green.rsi
layers:
- state: closed
+ - state: open
+ map: ["openLayer"]
- type: Storage
capacity: 36
- type: Item
contents:
- id: CigPackGreen
amount: 6
- - type: Appearance
- visuals:
- - type: BagOpenCloseVisualizer
- openIcon: open
- type: Tag
tags:
- Trash
- type: entity
id: CigPackBase
- parent: BaseStorageItem
+ parent: [ BaseStorageItem, BaseBagOpenClose ]
name: cigarette pack
abstract: true
components:
+ - type: Sprite
+ netsync: false
+ layers:
+ - state: closed
+ - state: open
+ map: ["openLayer"]
- type: Tag
tags:
- CigPack
tags: [Cigarette]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: open
- type: StackVisualizer
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/visualizer.rsi
composite: true
description: A label on the packaging reads, Wouldn't a slow death make a change?
components:
- type: Sprite
- netsync: false
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/green.rsi
- layers:
- - state: closed
- type: Item
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/green.rsi
description: The most popular brand of Space Cigarettes, sponsors of the Space Olympics.
components:
- type: Sprite
- netsync: false
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/red.rsi
- layers:
- - state: closed
- type: Item
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/red.rsi
description: For those who somehow want to obtain the record for the most amount of cancerous tumors.
components:
- type: Sprite
- netsync: false
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/blue.rsi
- layers:
- - state: closed
- type: Item
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/blue.rsi
description: Nomads's extra strong, for when your life is more extra hard.
components:
- type: Sprite
- netsync: false
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/black.rsi
- layers:
- - state: closed
- type: Item
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/black.rsi
name: Syndicate Smokes packet
description: Elite cigarettes for elite agents. Infused with medicine for when you need to do more than calm your nerves.
components:
- - type: StorageFill
- contents:
- - id: CigaretteSyndicate
- amount: 5
- type: Sprite
- netsync: false
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/syndicate.rsi
- layers:
- - state: closed
- type: Item
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/syndicate.rsi
+ - type: StorageFill
+ contents:
+ - id: CigaretteSyndicate
+ amount: 5
- type: entity
id: CigarCase
- parent: BaseStorageItem
+ parent: [ BaseStorageItem, BaseBagOpenClose ]
name: cigar case
description: A case for holding your cigars when you are not smoking them.
components:
sprite: Objects/Consumable/Smokeables/Cigars/case.rsi
layers:
- state: closed
+ - state: open
+ map: ["openLayer"]
- type: Storage
capacity: 8
- type: Item
tags: [Cigar]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: open
- type: StackVisualizer
composite: true
stackLayers:
- type: entity
name: match box
- parent: SmallboxItem
+ parent: [ SmallboxItem, BaseBagOpenClose ]
id: Matchbox
description: A small box of Almost But Not Quite Plasma Premium Matches.
components:
netsync: false
sprite: Objects/Tools/matches.rsi
layers:
- - state: matchbox
+ - state: matchbox
+ - state: matchbox-open
+ map: ["openLayer"]
- type: Item
sprite: Objects/Tools/matches.rsi
heldPrefix: matchbox
tags: [Matchstick]
- type: Appearance
visuals:
- - type: BagOpenCloseVisualizer
- openIcon: matchbox-open
- - type: StackVisualizer
- composite: true
- stackLayers:
- - matchbox1
- - matchbox2
- - matchbox3
+ - type: StackVisualizer
+ composite: true
+ stackLayers:
+ - matchbox1
+ - matchbox2
+ - matchbox3
- type: Tag
tags:
- Trash
storagebase: !type:Container
ents: []
+- type: entity
+ id: BaseBagOpenClose
+ abstract: true
+ components:
+ - type: Appearance
+ - type: GenericVisualizer
+ visuals:
+ enum.SharedBagOpenVisuals.BagState:
+ openLayer:
+ True: { visible: true }
+ False: { visible: false }
+
# PowerCellSlot parents
- type: entity
- type: entity
name: filing cabinet
- parent: BaseStructureDynamic
+ parent: [ BaseStructureDynamic, BaseBagOpenClose ]
id: filingCabinet
suffix: Empty
description: A cabinet for all your filing needs.
sprite: Structures/Storage/cabinets.rsi
state: filingcabinet
noRot: true
- - type: Appearance
- visuals:
- - type: BagOpenCloseVisualizer
- openIcon: filingcabinet-open
+ layers:
+ - state: filingcabinet
+ - state: filingcabinet-open
+ map: ["openLayer"]
- type: UserInterface
interfaces:
- key: enum.StorageUiKey.Key
- type: Sprite
sprite: Structures/Storage/cabinets.rsi
state: tallcabinet
+ layers:
+ - state: tallcabinet
+ - state: tallcabinet-open
+ map: ["openLayer"]
- type: Appearance
- visuals:
- - type: BagOpenCloseVisualizer
- openIcon: tallcabinet-open
- type: entity
name: chest drawer
sprite: Structures/Storage/cabinets.rsi
state: chestdrawer
noRot: true
+ layers:
+ - state: chestdrawer
+ - state: chestdrawer-open
+ map: ["openLayer"]
- type: Appearance
- visuals:
- - type: BagOpenCloseVisualizer
- openIcon: chestdrawer-open
- type: UserInterface
interfaces:
- key: enum.StorageUiKey.Key