- type: entity
  id: ClosetBase
  parent: BaseStructureDynamic
  name: closet
  description: A standard-issue Nanotrasen storage unit.
  abstract: true
  components:
  - type: Animateable
  - type: ResistLocker
  - type: Transform
    noRot: true
  - type: Sprite
    noRot: true
    sprite: Structures/Storage/closet.rsi
    layers:
    - state: generic
      map: ["enum.StorageVisualLayers.Base"]
    - state: generic_door
      map: ["enum.StorageVisualLayers.Door"]
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
    - state: paper
      visible: false
      sprite: Structures/Storage/closet_labels.rsi
      map: ["enum.PaperLabelVisuals.Layer"]
  - type: MovedByPressure
  - type: PaperLabel
    labelSlot:
      insertVerbText: comp-paper-label-insert
      ejectVerbText: comp-paper-label-eject
      whitelist:
        components:
        - Paper
      blacklist:
        tags:
        - Book
  - type: ItemSlots
  - type: DamageOnHighSpeedImpact
    damage:
      types:
        Blunt: 5
    soundHit:
      collection: MetalThud
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.25,-0.48,0.25,0.48"
        density: 75
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: EntityStorage
    # Sunrise edit start
    closeSound:
      path: /Audio/_Sunrise/Structures/Closets/close.ogg
      params:
        volume: -1
    openSound:
      path: /Audio/_Sunrise/Structures/Closets/open.ogg
      params:
        volume: -1
    # Sunrise edit end
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
      paper_label: !type:ContainerSlot
  - type: Weldable
  - type: PlaceableSurface
    placeCentered: true
    isPlaceable: false
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
          params:
            volume: -6
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
  - type: GenericVisualizer
    visuals:
      enum.PaperLabelVisuals.HasLabel:
        enum.PaperLabelVisuals.Layer:
          True: { visible: true }
          False: { visible: false }
      enum.StorageVisuals.Open:
        enum.PaperLabelVisuals.Layer:
          True: { visible: false }
      enum.PaperLabelVisuals.LabelType:
        enum.PaperLabelVisuals.Layer:
          Paper: { state: paper }
          Bounty: { state: bounty }
          CaptainsPaper: { state: captains_paper }
          Invoice: { state: invoice }
  - type: Appearance
  - type: EntityStorageVisuals
    stateBaseClosed: generic
    stateDoorOpen: generic_open
    stateDoorClosed: generic_door
  - type: StaticPrice
    price: 75

# steel closet base (that can be constructed/deconstructed)
- type: entity
  id: ClosetSteelBase
  parent: ClosetBase
  components:
  - type: Construction
    graph: ClosetSteel
    node: done
    containers:
    - entity_storage
  - type: Paintable
    group: Closet

#Wall Closet
- type: entity
  parent: BaseWallmountMetallic
  id: BaseWallCloset
  abstract: true
  name: wall closet
  description: A standard-issue Nanotrasen storage unit, now on walls.
  components:
  - type: ResistLocker
  - type: Weldable
  - type: StaticPrice
    price: 75
  - type: Sprite
    drawdepth: WallMountedItems
    noRot: false
    sprite: Structures/Storage/wall_locker.rsi
    layers:
    - state: generic
      map: ["enum.StorageVisualLayers.Base"]
    - state: generic_door
      map: ["enum.StorageVisualLayers.Door"]
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
  - type: EntityStorage
    isCollidableWhenOpen: true
    enteringOffset: 0, -0.6
    enteringRange: 0.03
    closeSound:
      path: /Audio/Items/deconstruct.ogg
    openSound:
      path: /Audio/Items/deconstruct.ogg
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
        ents: []
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
          params:
            volume: -6
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
  - type: Appearance
  - type: EntityStorageVisuals
    stateBaseClosed: generic
    stateDoorOpen: generic_open
    stateDoorClosed: generic_door
  - type: Construction
    graph: ClosetWall
    node: done
    containers:
    - entity_storage
  - type: Paintable
    group: WallCloset

#Wall locker
- type: entity
  id: BaseWallLocker
  parent: BaseWallCloset
  abstract: true
  components:
  - type: AccessReader
  - type: Lock
  - type: LockVisuals
  - type: Sprite
    sprite: Structures/Storage/wall_locker.rsi
    layers:
    - state: generic
      map: ["enum.StorageVisualLayers.Base"]
    - state: generic_door
      map: ["enum.StorageVisualLayers.Door"]
    - state: locked
      map: ["enum.LockVisualLayers.Lock"]
      shader: unshaded
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
  - type: Paintable
    group: WallLocker

#Base suit storage unit
#I am terribly sorry for duplicating the closet almost-wholesale, but the game malds at me if I don't so here we are.
- type: entity
  id: SuitStorageBase
  parent: BaseStructure
  name: suit storage unit
  description: A fancy hi-tech storage unit made for storing space suits.
  components:
  - type: AccessReader
  - type: Lock
  - type: Anchorable
    delay: 2
  - type: StaticPrice
    price: 80
  - type: ResistLocker
  - type: Transform
    noRot: true
  - type: Sprite
    noRot: true
    sprite: Structures/Storage/suit_storage.rsi
    layers:
    - state: base
    - state: door
      map: ["enum.StorageVisualLayers.Door"]
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
    - state: locked
      map: ["enum.LockVisualLayers.Lock"]
      shader: unshaded
  - type: MovedByPressure
  - type: DamageOnHighSpeedImpact
    damage:
      types:
        Blunt: 5
    soundHit:
      collection: MetalThud
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.25,-0.48,0.25,0.48"
        density: 350
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: EntityStorage
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
  - type: Weldable
  - type: PlaceableSurface
    placeCentered: true
    isPlaceable: false
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
          params:
            volume: -6
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
  - type: Appearance
  - type: EntityStorageVisuals
    # stateBase: base  // This field does not exist. this is probably a bug. TODO
    stateDoorOpen: base
    stateDoorClosed: door
  - type: LockVisuals
