- type: entity
  parent: Bed
  id: CMBed
  name: bed
  suffix: RMC
  description: A mattress seated on a rectangular metallic frame. This is used to support a lying person in a comfortable manner, notably for regular sleep. Ancient technology, but still useful.
  components:
  - type: VehicleSmashable
  - type: Transform
    anchored: true
  - type: Physics
    bodyType: Static
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: bed
  - type: InteractionOutline
  - type: HealOnBuckle
    damage: {}
  - type: Construction
    graph: RMCBed
    node: bed
  - type: RMCMesonsNonviewable
  - type: Damageable
    damageContainer: StructuralMarine
    damageModifierSet: StructuralMarine
  - type: MeleeReceivedMultiplier
    xenoDamage:
      types:
        Slash: 51
    otherMultiplier: 1
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          CMSheetMetal1:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: ["Destruction"]

- type: entity
  parent: CMBed
  id: RMCBedAlt
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: abed
  - type: Construction
    graph: RMCBed
    node: altBed

- type: entity
  parent: CMBed
  id: RMCBedPsych
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: psychbed
  - type: Construction
    graph: RMCBed
    node: bedPsych

- type: entity
  parent: CMBed
  id: RMCBedDingy
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: dingy_bed
  - type: Construction
    graph: RMCBed
    node: bedDingy

- type: entity
  parent: CMBed
  id: RMCBedAlien
  name: alien bed
  suffix: RMC|Alien
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: alien_bed
  - type: Construction

- type: entity
  parent: CMBed
  id: RMCBedBunk
  name: black bunk-bed
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: bunk_black
  - type: Construction

- type: entity
  parent: CMBed
  id: RMCBedBunkBlue
  name: blue bunk-bed
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: bunk_blue
  - type: Construction

- type: entity
  parent: CMBed
  id: RMCBedBunkGreen
  name: green bunk-bed
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: bunk_green
  - type: Construction

- type: entity
  parent: RMCBedBunkGreen
  id: RMCBedBunkGreenUnanchored
  suffix: RMC|Unanchored
  components:
  - type: Transform
    anchored: false

- type: entity
  parent: CMBed
  id: RMCBedBunkRed
  name: red bunk-bed
  components:
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bed.rsi
    state: bunk_red
  - type: Construction

# Bedroll

- type: entity
  parent: [BaseItem, BaseFoldable]
  id: Bedroll
  name: bedroll
  suffix: RMC
  description: A foldable bedroll, just about the only thing of comfort in the field. You're generally supposed to unroll it before sleeping, but who needs rules?
  components:
  - type: Transform
    noRot: true
  - type: Item
    size: Normal
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/bedroll.rsi
    noRot: true
    layers:
    - state: bedroll
      map: ["unfoldedLayer"]
    - state: bedroll_folded
      map: ["foldedLayer"]
      visible: false
    - state: bedroll_pillow
      map: ["buckledLayer"]
      visible: false
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.05"
        density: 190
        mask:
        - TableMask
  - type: Damageable
  - type: Destructible
    thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 50
        behaviors:
          - !type:PlaySoundBehavior
            sound:
              path: /Audio/Effects/poster_broken.ogg
          - !type:DoActsBehavior
            acts: ["Destruction"]
  - type: Pullable
  - type: Strap
    position: Down
    rotation: -90
  - type: Construction
    graph: bed
    node: bed
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.StrapVisuals.State:
        buckledLayer:
          True: {visible: true}
          False: {visible: false}
      enum.FoldedVisuals.State: # Copypasta from BaseFoldable b/c collections don't merge when overriding component prototypes.
        foldedLayer:
          True: {visible: true}
          False: {visible: false}
        unfoldedLayer:
          True: {visible: false}
          False: {visible: true}

- type: entity
  parent: Bedroll
  id: BedrollFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false
