- type: entity
  abstract: true
  parent: BaseStructure
  id: BaseMaterialDoor
  name: door
  description: A door, where will it lead?
  components:
  - type: Anchorable
    flags:
    - Anchorable
  - type: Rotatable
  - type: InteractionOutline
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/metal_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: AnimationPlayer
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.49,-0.49,0.49,0.49"
        density: 100
        mask:
        - FullTileMask
        layer:
        - AirlockLayer
  - type: Door
    bumpOpen: false
    clickOpen: true
    canCrush: false
    closeTimeOne: 0.2
    closeTimeTwo: 0.6
    openTimeOne: 0.6
    openTimeTwo: 0.2
    openingAnimationTime: 1.2
    closingAnimationTime: 1.2
    openSound:
      path: /Audio/Effects/stonedoor_openclose.ogg
    closeSound:
      path: /Audio/Effects/stonedoor_openclose.ogg
  - type: Appearance
  - type: Airtight
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: RCDDeconstructable
    cost: 6
    delay: 6
    fx: EffectRCDDeconstruct6
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Occluder
  - type: BlockWeather

- type: entity
  abstract: true
  parent: BaseMaterialDoor
  id: BaseMaterialDoorNavMap
  components:
  - type: NavMapDoor

### Metal doors ###

- type: entity
  parent: BaseMaterialDoorNavMap
  id: MetalDoor
  name: metal door
  components:
  - type: Construction
    graph: DoorGraph
    node: metalDoor
  - type: Destructible
    thresholds:
    - trigger: &DamageTrigger200 # Overkill threshold
        !type:DamageTrigger
        damage: 200
      behaviors: &OverkillBehavior
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger: &DamageTrigger150
        !type:DamageTrigger
        damage: 150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: PlasmaDoor
  name: plasma door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/plasma_door.rsi
  - type: Construction
    graph: DoorGraph
    node: plasmaDoor
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger200
      behaviors: *OverkillBehavior
    - trigger: *DamageTrigger150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetPlasma1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: GoldDoor
  name: gold door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/gold_door.rsi
  - type: Construction
    graph: DoorGraph
    node: goldDoor
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger200
      behaviors: *OverkillBehavior
    - trigger: *DamageTrigger150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          IngotGold1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: SilverDoor
  name: silver door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/silver_door.rsi
  - type: Construction
    graph: DoorGraph
    node: silverDoor
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger200
      behaviors: *OverkillBehavior
    - trigger: *DamageTrigger150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          IngotSilver1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: BananiumDoor
  name: bananium door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/bananium_door.rsi
  - type: Door
    openSound: &BikeHornSound
      collection: BikeHorn
      params:
        variation: 0.125
    closeSound: *BikeHornSound
  - type: Construction
    graph: DoorGraph
    node: bananiumDoor
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger200
      behaviors: *OverkillBehavior
    - trigger: *DamageTrigger150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialBananium1:
            min: 1
            max: 2

### Other doors ###

- type: entity
  parent: BaseMaterialDoorNavMap
  id: WoodDoor
  name: wooden door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/wood_door.rsi
  - type: Door
    openSound:
      path: /Audio/Effects/door_open.ogg
    closeSound:
      path: /Audio/Effects/door_close.ogg
  - type: Construction
    graph: DoorGraph
    node: woodDoor
  - type: Damageable
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger150
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: PaperDoor
  name: paper door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/paper_door.rsi
  - type: Door
    openSound:
      path: /Audio/Effects/paperdoor_openclose.ogg
    closeSound:
      path: /Audio/Effects/paperdoor_openclose.ogg
  - type: Construction
    graph: DoorGraph
    node: paperDoor
  - type: Damageable
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger150
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/poster_broken.ogg
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetPaper1:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: WebDoor
  name: web door
  description: A door, leading to the lands of the spiders... or a spaced room.
  components:
  - type: Sprite
    sprite: Structures/Doors/web_door.rsi
  - type: Door
    closeSound:
      path: /Audio/Effects/rustle1.ogg
    openSound:
      path: /Audio/Effects/rustle2.ogg
  - type: Construction
    graph: WebStructures
    node: door
  - type: Damageable
    damageModifierSet: Web
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger150
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWebSilk1:
            min: 1
            max: 2

- type: entity
  parent: BaseMaterialDoorNavMap
  id: CardDoor
  name: cardboard door
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/card_door.rsi
  - type: Door
    openSound:
      path: /Audio/Effects/card_drag.ogg
    closeSound:
      path: /Audio/Effects/card_drag.ogg
  - type: Construction
    graph: DoorGraph
    node: cardDoor
  - type: MeleeSound
    soundGroups:
      Brute:
        path:
          "/Audio/Weapons/pierce.ogg"
  - type: Damageable
    damageModifierSet: Card
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger150
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialCardboard:
            min: 3
            max: 5

- type: entity
  parent: BaseMaterialDoorNavMap
  id: IronstoneDoor
  name: ironstone door
  description: A mysterious door made of rune-etched stone.
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/ironstone_door.rsi
  - type: Door
    openSound:
      path: /Audio/Effects/stonedoor_openclose.ogg
    closeSound:
      path: /Audio/Effects/stonedoor_openclose.ogg
  - type: RCDDeconstructable
    deconstructable: false
  - type: Damageable
    damageModifierSet: Rock
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 250 # A pickaxe can destroy this in two hits, since the door is rock.
      behaviors: &IronstoneDestructionBehavior
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/break_stone.ogg
          params:
            volume: -6
      - !type:SpawnEntitiesBehavior
        spawn:
          SteelOre1:
            min: 0
            max: 1

- type: entity
  parent: IronstoneDoor
  id: EncrustedIronstoneDoor
  name: encrusted ironstone door
  description: A stone door covered in nacreous blobs of an unknown substance.
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/encrusted_ironstone_door.rsi
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors: *OverkillBehavior
    - trigger:
        !type:DamageTrigger
        damage: 375
      behaviors: *IronstoneDestructionBehavior
