# SPDX-FileCopyrightText: 2020 Git-Nivrak <59925169+Git-Nivrak@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 V�ctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 V�ctor Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 ColdAutumnRain <73938872+ColdAutumnRain@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Galactic Chimp <GalacticChimpanzee@gmail.com>
# SPDX-FileCopyrightText: 2021 Jaskanbe <86671825+Jaskanbe@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Kara D <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2021 Kara Dinyes <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2021 Leon Friedrich <60421075+leonsfriedrich@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Leon Friedrich <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Michael Will <will_m@outlook.de>
# SPDX-FileCopyrightText: 2021 PJBot <pieterjan.briers+bot@gmail.com>
# SPDX-FileCopyrightText: 2021 Paul <ritter.paul1+git@googlemail.com>
# SPDX-FileCopyrightText: 2021 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2021 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 SETh lafuente <cetaciocascarudo@gmail.com>
# SPDX-FileCopyrightText: 2021 ScalyChimp <72841710+scaly-chimp@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 SethLafuente <84478872+SethLafuente@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Silver <silvertorch5@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 TimrodDX <timrod@gmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <gradientvera@outlook.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 Ygg01 <y.laughing.man.y@gmail.com>
# SPDX-FileCopyrightText: 2021 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <notzombiedude@gmail.com>
# SPDX-FileCopyrightText: 2021 scrato <Mickaello2003@gmx.de>
# SPDX-FileCopyrightText: 2021 tmtmtl30 <53132901+tmtmtl30@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Andreas K�mper <andreas@kaemper.tech>
# SPDX-FileCopyrightText: 2022 CrudeWax <75271456+CrudeWax@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 E F R <602406+Efruit@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Flipp Syder <76629141+vulppine@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2022 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 WlarusFromDaSpace <44726328+WlarusFromDaSpace@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 keronshb <54602815+keronshb@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2022 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 vulppine <vulppine@gmail.com>
# SPDX-FileCopyrightText: 2022 wrexbe <81056464+wrexbe@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Chase Maguire <32408355+Wirdal@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Morb <14136326+Morb0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Tom Leys <tom@crump-leys.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aidenkrz <aiden@djkraz.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 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 a_person <alexanderbeaumont05@hotmail.com>
# SPDX-FileCopyrightText: 2024 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 osjarw <62134478+osjarw@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 BombasterDS <deniskaporoshok@gmail.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Southbridge <7013162+southbridge-fur@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseFirelock
  abstract: true
  parent: BaseStructure
  name: firelock
  description: Apply crowbar.
  components:
    - type: AtmosAlarmable
      syncWith:
        - FireAlarm
        - AirAlarm
    - type: ApcPowerReceiver
    - type: ExtensionCableReceiver
    - type: DeviceNetwork
      deviceNetId: AtmosDevices
      receiveFrequencyId: AtmosMonitor
    - type: DeviceNetworkRequiresPower
    - type: InteractionOutline
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: StrongMetallic
    - type: RCDDeconstructable
      cost: 4
      delay: 6
      fx: EffectRCDDeconstruct6
    - type: Tag
      tags:
      - ForceFixRotations # Allow fixrotations to target these
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 500
        behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
    - type: Sprite
      sprite: Structures/Doors/Airlocks/Standard/firelock.rsi
      snapCardinals: true
      layers:
        - state: closed
          map: ["enum.DoorVisualLayers.Base"]
        - state: closed_unlit
          shader: unshaded
          map: ["enum.DoorVisualLayers.BaseUnlit"]
          visible: false
        - state: welded
          map: ["enum.WeldableLayers.BaseWelded"]
        - state: bolted_unlit
          shader: unshaded
          map: ["enum.DoorVisualLayers.BaseBolted"]
          visible: false
        - state: panel_open
          map: ["enum.WiresVisualLayers.MaintenancePanel"]
        - state: pressure_unlit
          visible: false
          shader: unshaded
          map: ["enum.FirelockVisualLayersPressure.Base"]
        - state: temperature_unlit
          visible: false
          shader: unshaded
          map: ["enum.FirelockVisualLayersTemperature.Base"]
    - type: GenericVisualizer
      visuals:
        enum.FirelockVisuals.PressureWarning:
          enum.FirelockVisualLayersPressure.Base:
            True: { visible: true }
            False: { visible: false }
        enum.FirelockVisuals.TemperatureWarning:
          enum.FirelockVisualLayersTemperature.Base:
            True: { visible: true }
            False: { visible: false }
    - type: AnimationPlayer
    - 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: Door
      openDrawDepth: WallTops
      closeTimeOne: 0.1
      closeTimeTwo: 0.6
      openTimeOne: 0.1
      openTimeTwo: 0.6
      state: Open
      bumpOpen: false
      clickOpen: true
      crushDamage:
        types:
          Blunt: 15
      openSound:
        path: /Audio/Machines/airlock_open.ogg
      closeSound:
        path: /Audio/Machines/airlock_close.ogg
      denySound:
        path: /Audio/Machines/airlock_deny.ogg
      openingAnimationTime: 0.6
      closingAnimationTime: 0.6
    - type: Weldable
      fuel: 5
      time: 3
    - type: Firelock
    - type: Appearance
    - type: WiresVisuals
    - type: WiresPanel
    - type: UserInterface
      interfaces:
        enum.WiresUiKey.Key:
          type: WiresBoundUserInterface
    - type: Physics
      canCollide: false
    - type: Airtight
      airBlocked: false
      noAirWhenFullyAirBlocked: true
    - type: RadiationBlocker
      enabled: false
    - type: Occluder
      enabled: false
    - type: WallMount
      arc: 360
    - type: StaticPrice
      price: 150
    - type: DoorBolt # Goobstation - re adding fire door remote
    - type: AccessReader
      access: [ [ "Engineering" ] ]
    - type: PryUnpowered
      pryModifier: 0.5
    - type: PointLight
      energy: 0.5
      radius: 1.75
      color: Red
      enabled: false
      castShadows: false
    - type: NavMapDoor
    - type: GuideHelp
      guides:
      - FireAndGasControl
      - Fires
      - Spacing
    - type: Penetratable # Goobstation - Better snipers
      penetrateDamage: 75
      damagePenalty: 0.2
    - type: SyncSprite
    - type: WeldingSparksAnimation # Goobstation
      startingOffset: -0.5, 0

- type: entity
  id: Firelock
  parent: BaseFirelock
  components:
  - type: StationAiWhitelist
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: Construction
    graph: Firelock
    node: Firelock
    containers:
    - board
  - type: ContainerFill
    containers:
      board: [ FirelockElectronics ]

- type: entity
  id: FirelockGlass
  parent: Firelock
  name: glass firelock
  components:
    - type: StationAiWhitelist
    - type: Sprite
      sprite: Structures/Doors/Airlocks/Glass/firelock.rsi
    - type: Occluder
      enabled: false
    - 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
          mask:
          - Impassable
          - HighImpassable
          layer:
          - GlassAirlockLayer
    - type: Door
      occludes: false
    - type: Construction
      node: FirelockGlass

- type: entity
  id: FirelockEdge
  parent: Firelock
  name: firelock
  components:
    - type: StationAiWhitelist
    - type: Sprite
      sprite: Structures/Doors/edge_door_hazard.rsi
      snapCardinals: false
    - type: Airtight
      airBlocked: false
      noAirWhenFullyAirBlocked: false
      airBlockedDirection:
        - South
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.49,-0.49,0.49,-0.2" # don't want this colliding with walls or they won't close
          mask:
          - Impassable
          - HighImpassable
          layer:
          - GlassAirlockLayer
    - type: Occluder
      enabled: false
    - type: Tag
      tags:
      - ForceNoFixRotations # Prevent fixrotations from targeting these, since the base Firelock is targeted
    - type: Door
      occludes: false
    - type: Physics
      canCollide: false
    - type: StaticPrice
      price: 100
    - type: Construction
      graph: Firelock
      node: FirelockEdge
    - type: WeldingSparksAnimation # Goobstation
      startingOffset: 0, -0.2
      endingOffset: 0, -0.5
