- type: Tag
  id: CMRollerItem

- type: Tag
  id: CMRollerBed

- type: entity
  id: RMCRollerBedDestruction
  abstract: true
  components:
  - type: Damageable
    damageContainer: StructuralMarine
    damageModifierSet: StructuralMarine
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: ReceiverXenoClaws
    minimumClawStrength: Normal
    hitsToDestroy: 1
  - type: Construction
    graph: RMCRollerBed
    node: Metal

- type: entity
  parent: [ RMCRollerBedDestruction, RollerBed ]
  id: CMRollerBed
  name: roller bed
  description: A collapsed roller bed that can be carried around.
  components:
  - type: Tag
    tags:
    - CMRollerItem
    - CMRollerBed
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/rollerbeds.rsi
    noRot: true
    layers:
    - state: roller_down
      map: [ "unfoldedLayer" ]
    - state: folded
      map: [ "foldedLayer" ]
      visible: false
    - state: roller_up
      map: [ "buckledLayer" ]
      visible: false
  - type: Item
    size: Small
    inhandVisuals:
      left:
      - state: inhand-left
      right:
      - state: inhand-right
  - type: GenericVisualizer
    visuals:
      enum.StrapVisuals.State:
        buckledLayer:
          True: { visible: true }
          False: { visible: false }
      enum.FoldedVisuals.State:
        foldedLayer:
          True: { visible: true }
          False: { visible: false }
        unfoldedLayer:
          True: { visible: false }
          False: { visible: true }
  - type: InteractedBlacklist
    blacklist:
      components:
      - Xeno
  - type: Clothing
    quickEquip: false
    slots:
    - suitstorage
  - type: Foldable
    fitIntoEntityStorage: true
  - type: RMCStrapNoDrawDepthChange
  - type: RMCRetargetBucklePull
  - type: PhysicalComposition
    materialComposition:
      RMCPlastic: 5000

- type: entity
  parent: CMRollerBed
  id: CMRollerBedSpawnFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

- type: entity
  parent: CMRollerBed
  id: CMPortableSurgicalBed
  name: portable surgical bed
  description: A collapsible surgical bed. It's not perfect, but it's the best you'll get short of an actual surgical table.
  components:
  - type: Item
    heldPrefix: surgical
  - type: Sprite
    layers:
    - state: surgical_down
      map: [ "unfoldedLayer" ]
    - state: surgical_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: surgical_up
      map: [ "buckledLayer" ]
      visible: false
  - type: Appearance
  - type: ReceiverXenoClaws
    minimumClawStrength: ImpossiblySharp
  - type: PhysicalComposition
    materialComposition:
      RMCPlastic: 6000

- type: entity
  parent: CMPortableSurgicalBed
  id: CMPortableSurgicalBedSpawnFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

# Copied most of RollerBed prototype except for pullable
- type: entity
  parent: [ RMCRollerBedDestruction, BaseDeployFoldable ]
  id: RMCMedevacStretcher
  name: medevac stretcher
  description: A collapsible stretcher that can be activated to send patients to an overhead dropship.
  components:
  - type: Item
    size: Small
    heldPrefix: stretcher
  - type: Clickable
  - type: InteractionOutline
  - type: CollisionWake
  - type: Transform
    noRot: true
  - type: Sprite
    sprite: _RMC14/Structures/Furniture/rollerbeds.rsi
    noRot: true
    drawdepth: OverMobs
    layers:
    - state: stretcher_down
      map: [ "unfoldedLayer" ]
    - state: stretcher_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: stretcher_box
      map: [ "buckledLayer" ]
      visible: false
    - state: beacon_active_up
      map: [ "buckledBeaconLayer" ]
      visible: false
    - state: winched_stretcher
      map: [ "stretcherAnimatedLayer" ]
      visible: false
  - type: Physics
    bodyType: Dynamic
    fixedRotation: false
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.35
        density: 80
        mask:
        - MobMask
  - type: Strap
    position: Down
    rotation: -90
    buckleOffset: "0,0.15"
  - 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 }
      enum.MedevacStretcherVisuals.BeaconState:
        buckledBeaconLayer:
          On: { visible: true }
          Off: { visible: false }
      enum.MedevacStretcherVisuals.MedevacingState:
        buckledLayer:
          True: { state: winched_stretcher }
          False: { state: stretcher_box }
  - type: Corrodible
  - type: MedevacStretcher
  - type: Tag
    tags:
    - CMRollerItem
  - type: ReceiverXenoClaws
    minimumClawStrength: ImpossiblySharp
  - type: PhysicalComposition
    materialComposition:
      CMSteel: 5000
      RMCPlastic: 5000

- type: entity
  parent: RMCMedevacStretcher
  id: RMCMedevacStretcherFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

# Hospital Bed

- type: entity
  parent: CMRollerBed
  id: RMCRollerBedHospital
  name: hospital roller bed
  description: A basic cushioned leather board resting on a small frame. Not very comfortable at all, but allows the patient to rest lying down while moved to another location rapidly. Not great for surgery, but better than nothing.
  components:
  - type: Sprite
    layers:
    - state: bigroller_down
      map: [ "unfoldedLayer" ]
    - state: surgical_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: bigroller_up
      map: [ "buckledLayer" ]
      visible: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalBlood
  components:
  - type: Sprite
    layers:
    - state: bigrollerblood_down
      map: [ "unfoldedLayer" ]
    - state: surgical_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: bigrollerblood_up
      map: [ "buckledLayer" ]
      visible: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalBloodFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalSheet
  components:
  - type: Sprite
    layers:
    - state: bigrollerhospitalsheet_down
      map: [ "unfoldedLayer" ]
    - state: surgical_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: bigrollerhospitalsheet_up
      map: [ "buckledLayer" ]
      visible: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalSheetFolded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalSheet2
  components:
  - type: Sprite
    layers:
    - state: bigrollerhospitalsheet2_down
      map: [ "unfoldedLayer" ]
    - state: surgical_folded
      map: [ "foldedLayer" ]
      visible: false
    - state: bigrollerhospitalsheet2_up
      map: [ "buckledLayer" ]
      visible: false

- type: entity
  parent: RMCRollerBedHospital
  id: RMCRollerBedHospitalSheet2Folded
  suffix: folded
  components:
  - type: Foldable
    folded: true
  - type: Strap
    enabled: false
