# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Chris V <HoofedEar@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Fishfish458 <47410468+Fishfish458@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Leeroy <97187620+elthundercloud@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 fishfish458 <fishfish458>
# SPDX-FileCopyrightText: 2023 PixelTK <85175107+PixelTheKermit@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 brainfood1183 <113240905+brainfood1183@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Pspritechologist <naaronn@gmail.com>
# SPDX-FileCopyrightText: 2024 VMSolidus <evilexecutive@gmail.com>
# SPDX-FileCopyrightText: 2024 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Chaboricks <95505064+Chaboricks@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseMaterialDoor
  parent: BaseStructure
  name: door
  abstract: true
  description: A door, where will it lead?
  components:
  - 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: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Occluder
  - type: BlockWeather
  - type: InteractionVerbs # EE: Interaction Verbs
    allowedVerbs:
    - KnockOn

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

- type: entity
  id: MetalDoor
  name: metal door
  parent: BaseMaterialDoorNavMap
  components:
  - type: Construction
    graph: DoorGraph
    node: metalDoor

- type: entity
  id: WoodDoor
  name: wooden door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/wood_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Door
    bumpOpen: false
    clickOpen: true
    closeTimeOne: 0.2
    closeTimeTwo: 0.6
    openTimeOne: 0.6
    openTimeTwo: 0.2
    openSound:
      path: /Audio/Effects/door_open.ogg
    closeSound:
      path: /Audio/Effects/door_close.ogg
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Construction
    graph: DoorGraph
    node: woodDoor

- type: entity
  id: PaperDoor
  name: paper door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/paper_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Construction
    graph: DoorGraph
    node: paperDoor
  - type: Door
    openSound:
      path: /Audio/Effects/paperdoor_openclose.ogg
    closeSound:
      path: /Audio/Effects/paperdoor_openclose.ogg

- type: entity
  id: PlasmaDoor
  name: plasma door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/plasma_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallicStrong
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Construction
    graph: DoorGraph
    node: plasmaDoor

- type: entity
  id: GoldDoor
  name: gold door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/gold_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Construction
    graph: DoorGraph
    node: goldDoor

- type: entity
  id: SilverDoor
  name: silver door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/silver_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Construction
    graph: DoorGraph
    node: silverDoor

- type: entity
  id: BananiumDoor
  name: bananium door
  parent: BaseMaterialDoorNavMap
  description: A door, where will it lead?
  components:
  - type: Sprite
    sprite: Structures/Doors/MineralDoors/bananium_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Construction
    graph: DoorGraph
    node: bananiumDoor
  - type: Door
    openSound:
      path: /Audio/Items/bikehorn.ogg
    closeSound:
      path: /Audio/Items/bikehorn.ogg

- type: entity
  id: WebDoor
  name: web door
  parent: BaseMaterialDoorNavMap
  description: A door, leading to the lands of the spiders... or a spaced room.
  components:
  - type: Sprite
    sprite: Structures/Doors/web_door.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Construction
    graph: WebStructures
    node: door
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 100
      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: 3
            max: 5
  - type: Damageable
    damageModifierSet: Web
  - type: Door
    closeSound:
      path: /Audio/Effects/rustle1.ogg
    openSound:
      path: /Audio/Effects/rustle2.ogg
