- type: entity
  name: bed
  id: Bed
  parent: BaseStructure
  description: This is used to lie in, sleep in or strap on. Resting here provides extremely slow healing.
  components:
  - type: HealOnBuckle
    damage:
      types:
        Poison: -0.1
        Blunt: -0.1
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.05"
        density: 190
        mask:
        - TableMask
  - type: Sprite
    sprite: Structures/Furniture/furniture.rsi
    state: bed
    noRot: true
  - type: Strap
    position: Down
    rotation: -90
  # Construction has to be before PlaceableSurface or you'll place things onto the entity instead of deconstructing it.
  - type: Construction
    graph: bed
    node: bed
  # So that you can put bedsheets on beds again. Would be cool to have a tag
  # for this so that only bedsheets can be placed.
  - type: PlaceableSurface
    placeCentered: true
  - type: Damageable
    damageContainer: Inorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 2
  - type: Transform
    anchored: true
    noRot: true
  - type: Anchorable
  - type: Pullable


- type: entity
  parent: Bed
  id: MedicalBed
  name: medical bed
  description: A hospital bed for patients to recover in. Resting here provides fairly slow healing.
  components:
  - type: Sprite
    state: bed-MED
  - type: HealOnBuckle
    damage:
      types:
        Poison: -0.2
        Cold: -0.4
        Blunt: -0.2
  - type: Construction
    graph: bed
    node: medicalbed
  - type: GuideHelp
    guides:
    - MedicalDoctor

- type: entity
  parent: Bed
  id: DogBed
  name: dog bed
  description: A comfy-looking dog bed. You can even strap your pet in, in case the gravity turns off.
  components:
  - type: Sprite
    state: dogbed
  - type: Strap
    position: Stand
    rotation: 0
  - type: Construction
    graph: bed
    node: dogbed
  - type: Damageable
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank:
            min: 1
            max: 5

- type: entity
  parent: Bed
  id: Mattress
  name: mattress
  description: Better sleep in that then on the floor i guess.
  components:
  - type: Sprite
    state: mattress
  - type: Damageable
    damageModifierSet: Inflatable

- type: entity
  parent: Bed
  id: WebBed
  name: web bed
  description: You got webbed.
  components:
  - type: Damageable
    damageModifierSet: Web
  - type: Sprite
    sprite: Structures/Web/bed.rsi
    state: icon
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWebSilk:
            min: 1
            max: 1
  - type: Construction
    graph: WebStructures
    node: bed

- type: entity
  parent: Bed
  id: PsychBed
  name: psychologist bed
  description: An upholstered bed for the psychological care of patients.
  components:
  - type: Sprite
    state: psychbed
  - type: HealOnBuckle
    damage:
      types:
        Cold: -0.5
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank:
            min: 2
            max: 2
