- type: entity
  abstract: true
  parent: [ BaseStructureDynamic, BasePaperLabelableVisualized ]
  id: BaseCrate
  name: crate
  description: A large container for items.
  components:
  - type: Animateable
  - type: Transform
    noRot: true
  - type: Sprite
    noRot: true
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.4,-0.4,0.4,0.29"
        density: 50
        mask:
        - CrateMask #this is so they can go under plastic flaps
        layer:
        - MachineLayer
  - type: EntityStorage
  - type: PlaceableSurface
    isPlaceable: false # defaults to closed.
  - type: EntityStorageVisuals
    stateDoorOpen: open
    stateDoorClosed: closed
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
      paper_label: !type:ContainerSlot
  - type: StaticPrice
    price: 75
  - type: RequireProjectileTarget

- type: entity
  parent: BaseCrate
  id: CrateGeneric
  categories: [ HideSpawnMenu ]
  components:
  - type: Icon
    sprite: Structures/Storage/Crates/generic.rsi
    state: icon
  - type: Sprite
    sprite: Structures/Storage/Crates/generic.rsi
    layers:
    - state: base
      map: ["enum.StorageVisualLayers.Base"]
    - state: closed
      map: ["enum.StorageVisualLayers.Door"]
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
    - state: paper
      sprite: Structures/Storage/Crates/labels.rsi
      map: ["enum.PaperLabelVisuals.Layer"]
  - type: Damageable
    damageModifierSet: Metallic
  - type: Injurable
    damageContainer: StructuralInorganic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
  - type: Construction
    graph: CrateGenericSteel
    node: crategenericsteel
    containers:
    - entity_storage

- type: entity
  parent: CrateGeneric
  id: CrateBaseWeldable
  categories: [ HideSpawnMenu ]
  components:
  - type: Weldable
  - type: ResistLocker

- type: entity
  parent: CrateBaseWeldable
  id: CrateBaseSecure
  suffix: Secure
  components:
  - type: Lock
  - type: LockVisuals
  - type: AccessReader
  - type: Icon
    sprite: Structures/Storage/Crates/secure.rsi
    state: icon
  - type: Sprite
    sprite: Structures/Storage/Crates/secure.rsi
    layers:
    - state: base
    - state: closed
      map: ["enum.StorageVisualLayers.Door"]
    - state: welded
      visible: false
      map: ["enum.WeldableLayers.BaseWelded"]
    - state: locked
      map: ["enum.LockVisualLayers.Lock"]
      shader: unshaded
    - state: paper
      sprite: Structures/Storage/Crates/labels.rsi
      offset: "-0.5,0"
      map: ["enum.PaperLabelVisuals.Layer"]
  - type: Damageable
    damageModifierSet: StructuralMetallic
  - type: Construction
    graph: CrateSecure
    node: cratesecure
    containers:
    - entity_storage
  - type: Reflect
    reflects:
    - Energy
    reflectProb: 0.2
    spread: 90
  - type: Paintable
    group: CrateSecure
