- type: entity
  id: ClosetBase
  parent: [ BaseStructureDynamic, BasePaperLabelableVisualized ]
  name: closet
  description: A standard-issue NanoTrasen storage unit. # SL
  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: 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
  - 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
  # Starlight-start: Blinding from containers
  - type: ChildBlockVision
  # Starlight-end

# 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. # SL
  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
    # Starlight Start
    popupMessage: false
    powerNeeded: true
    # Starlight End
  - 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"]
    # Starlight Start: Maintenance panel
    - state: panel_open
      sprite: Structures/Storage/closet.rsi
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
      visible: false
    - state: electrified_ai
      sprite: Interface/Misc/ai_hud.rsi
      shader: unshaded
      visible: false
      map: ["enum.ElectrifiedLayers.HUD"]
    - state: electrified
      sprite: Effects/electricity.rsi
      shader: unshaded
      visible: false
      map: ["enum.ElectrifiedLayers.Sparks"]
    # Starlight End
  - type: Paintable
    group: WallLocker
  # Starlight Start: Wires panel
  - type: PoweredLocker
  - type: StationAiWhitelist
  - type: WiresPanel
  - type: WiresPanelSecurity
    wiresAccessible: True
  - type: WiresVisuals
  - type: Wires
    boardName: wires-board-name-locker
    layoutId: Locker
  - type: UserInterface
    interfaces:
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: GenericVisualizer
    visuals:
      enum.ElectrifiedVisuals.ShowSparks:
        enum.ElectrifiedLayers.Sparks:
          True: { visible: True }
          False: { visible: False }
  # Starlight End

#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
