# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Jack Fox <35575261+DubiousDoggo@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Profane McBane <profanedbane+github@gmail.com>
# SPDX-FileCopyrightText: 2022 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Chase Maguire <32408355+Wirdal@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 ElectroJr <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2023 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 daerSeebaer <61566539+daerSeebaer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 PJBot <pieterjan.briers+bot@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 PopGamer46 <yt1popgamer@gmail.com>
# SPDX-FileCopyrightText: 2024 Pspritechologist <naaronn@gmail.com>
# SPDX-FileCopyrightText: 2024 Spessmann <156740760+Spessmann@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 VMSolidus <evilexecutive@gmail.com>
# SPDX-FileCopyrightText: 2024 Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 coolboy911 <85909253+coolboy911@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 lunarcomets <140772713+lunarcomets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@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: 2024 saintmuntzer <47153094+saintmuntzer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 SX_7 <sn1.test.preria.2002@gmail.com>
# SPDX-FileCopyrightText: 2025 Southbridge <7013162+southbridge-fur@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 yavuz <58685802+yahay505@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseShutter
  parent: BaseStructure
  name: shutter
  abstract: true
  description: One shudders to think about what might be behind this shutter.
  placement:
    mode: SnapgridCenter
  components:
  - type: StationAiWhitelist
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters.rsi
    drawdepth: BlastDoors
    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" # don't want this colliding with walls or they won't close
        density: 100
        mask:
        - FullTileMask
        layer:
        - AirlockLayer
  - type: ContainerFill
    containers:
      board: [ DoorElectronics ]
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: NavMapDoor
  - type: Tag
    tags:
    - ForceNoFixRotations # Don't want the fixrotations command to target these
  - type: Door
    openDrawDepth: BlastDoors
    closedDrawDepth: BlastDoors
    bumpOpen: false
    clickOpen: false
    closeTimeOne: 0.2
    closeTimeTwo: 1.2
    openTimeOne: 1.2
    openTimeTwo: 0.2
    openingAnimationTime: 1.4
    closingAnimationTime: 1.4
    crushDamage:
      types:
        Blunt: 5 # getting shutters closed on you probably doesn't hurt that much
    openSound:
      path: /Audio/Machines/shutter.ogg
    closeSound:
      path: /Audio/Machines/shutter.ogg
  - type: Weldable
    time: 3
  - type: Appearance
  - type: UserInterface
    interfaces:
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: Airtight
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: DoorSignalControl
  - type: DeviceNetwork
    deviceNetId: Wireless
    receiveFrequencyId: BasicDevice
  - type: WirelessNetworkConnection
    range: 200
  - type: DeviceLinkSink
    ports:
      - Open
      - Close
      - Toggle
  - type: DeviceLinkSource
    ports:
    - DoorStatus
    lastSignals:
      DoorStatus: false
  - type: InteractionPopup
    interactSuccessString: shutter-rattle
    messagePerceivedByOthers: shutter-rattle
    interactSuccessSound:
      collection: FenceRattle
  - type: BlockWeather
  - type: InteractionVerbs # EE: Interaction Verbs
    allowedVerbs:
    - KnockOn

- type: entity
  id: ShuttersNormal
  parent: BaseShutter
  components:
  - type: Occluder
  - type: Construction
    graph: Shutters
    node: Shutters
    containers:
    - board

- type: entity
  id: ShuttersNormalOpen
  parent: ShuttersNormal
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Physics
    canCollide: false
  - type: Occluder
    enabled: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

- type: entity
  id: ShuttersRadiation
  parent: BaseShutter
  name: radiation shutters
  description: Why did they make these shutters radioactive?
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters_radiation.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Occluder
  - type: Construction
    graph: Shutters
    node: ShuttersRadiation
    containers:
    - board
  - type: RadiationBlocker
    resistance: 4

- type: entity
  id: ShuttersRadiationOpen
  parent: ShuttersRadiation
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Occluder
    enabled: false
  - type: Physics
    canCollide: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

- type: entity
  id: ShuttersWindow
  parent: BaseShutter
  name: window shutters
  description: The Best (TM) place to see your friends explode!
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters_window.rsi
    layers:
    - state: closed
      map: ["enum.DoorVisualLayers.Base"]
  - type: Construction
    graph: Shutters
    node: ShuttersWindow
    containers:
    - board

- type: entity
  id: ShuttersWindowOpen
  parent: ShuttersWindow
  suffix: Open
  components:
  - type: Door
    state: Open
  - type: Physics
    canCollide: false
  - type: Airtight
    airBlocked: false
  - type: RadiationBlocker
    enabled: false

# Frame for construction
- type: entity
  id: ShuttersFrame
  parent: BaseStructureDynamic
  name: shutter frame
  description: A frame for constructing a shutter.
  components:
  - type: Sprite
    sprite: Structures/Doors/Shutters/shutters.rsi
    state: frame
  - type: Construction
    graph: Shutters
    node: frame1
    containers:
    - board
  - type: InteractionOutline
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Physics
    bodyType: Dynamic
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 55
        mask:
        - Impassable
        - HighImpassable
        layer:
        - HighImpassable
  - type: Transform
    noRot: false
