- 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/MaterialDoors/silver-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: RCDDeconstructable
    cost: 6
    delay: 6
    fx: EffectRCDDeconstruct6
  - type: Occluder
  - type: BlockWeather
  - type: IconSmooth
    key: walls
    mode: NoSprite
  - type: PlacementReplacement
    key: walls

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

### Metal doors ###
- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthDoorWeak ]
  id: PlasmaDoor
  name: plasma door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/plasma-door.rsi
  - type: Construction
    graph: DoorGraph
    node: plasmaDoor
  - type: Damageable
    damageModifierSet: PlasmaMod
  - type: Destructible
    thresholds:
    - trigger: &DamageDoorWeak
        !type:DamageTrigger
        damage: 100
      behaviors:
      - &SoundMetalBreak !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetPlasma1: &BaseDoorSpawn
            min: 3
            max: 5

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthDoorWeak ]
  id: GoldDoor
  name: gold door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/gold-door.rsi
  - type: Construction
    graph: DoorGraph
    node: goldDoor
  - type: Damageable
    damageModifierSet: PreciousMetalMod
  - type: Destructible
    thresholds:
    - trigger: *DamageDoorWeak
      behaviors:
      - *SoundMetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          IngotGold1: *BaseDoorSpawn

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthDoorWeak ]
  id: SilverDoor
  name: silver door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/silver-door.rsi
  - type: Construction
    graph: DoorGraph
    node: silverDoor
  - type: Damageable
    damageModifierSet: PreciousMetalMod
  - type: Destructible
    thresholds:
    - trigger: *DamageDoorWeak
      behaviors:
      - *SoundMetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          IngotSilver1: *BaseDoorSpawn

### Other doors ###

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthBarrierStrong ]
  id: WoodDoor
  name: wooden door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/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: WoodMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 120
      behaviors:
      - &SoundWoodDestroy !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank1: *BaseDoorSpawn

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthBarrierWeak ]
  id: PaperDoor
  name: paper door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/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: CardboardMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/poster_broken.ogg
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetPaper1: *BaseDoorSpawn

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthBarrierWeak ]
  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/MaterialDoors/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: ThreadMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - *SoundWoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWebSilk1:
            min: 1
            max: 2

- type: entity
  parent: [ BaseMaterialDoorNavMap, StructureHealthBarrierWeak ]
  id: CardDoor
  name: cardboard door
  components:
  - type: Sprite
    sprite: Structures/Doors/MaterialDoors/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: CardboardMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialCardboard: *BaseDoorSpawn
