# SPDX-FileCopyrightText: 2022 Andreas Kämper <andreas@kaemper.tech>
# SPDX-FileCopyrightText: 2022 E F R <602406+Efruit@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Flipp Syder <76629141+vulppine@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Fooberticus Bazly <34943053+fooberticus@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 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 fooberticus <fooberticus@protonmail.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2022 vulppine <vulppine@gmail.com>
# SPDX-FileCopyrightText: 2022 wrexbe <81056464+wrexbe@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Morb <14136326+Morb0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 qwerltaz <69696513+qwerltaz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@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 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Marty <martynashagriefer@gmail.com>
# SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: AirAlarm
  name: air alarm
  description: An air alarm. Alarms... air?
  placement:
    mode: SnapgridCenter
    snap:
    - Wallmount
  components:
  - type: StationAiWhitelist
  - type: WallMount
  - type: ApcPowerReceiver
  - type: Electrified
    enabled: false
    usesApcPower: true
  - type: ExtensionCableReceiver
  - type: DeviceNetwork
    deviceNetId: AtmosDevices
    receiveFrequencyId: AtmosMonitor
    transmitFrequencyId: AtmosMonitor
    prefix: device-address-prefix-air-alarm
    sendBroadcastAttemptEvent: true
  - type: WiredNetworkConnection
  # for output status ports
  - type: WirelessNetworkConnection
    range: 200
  - type: DeviceList
  - type: DeviceNetworkRequiresPower
  - type: DeviceLinkSource
    ports:
    - AirDanger
    - AirWarning
    - AirNormal
    lastSignals:
      AirDanger: false
      AirWarning: false
      AirNormal: false
  - type: AtmosAlarmable
    syncWith:
    - AirAlarm
    - AirSensor
    - GasVent
    - GasScrubber
  - type: AtmosAlarmableVisuals
    layerMap: "airAlarmState"
    alarmStates:
      Normal: alarm0
      Warning: alarm1
      Danger: alarm2
    hideOnDepowered: [ "airAlarmState" ]
  - type: Tag
    tags:
      - AirAlarm
  - type: AtmosDevice
  - type: AirAlarm
  - type: AtmosAlertsDevice
    group: AirAlarm
  - type: Clickable
  - type: InteractionOutline
  - type: UserInterface
    interfaces:
      enum.SharedAirAlarmInterfaceKey.Key:
        type: AirAlarmBoundUserInterface
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: WiresPanel
  - type: Wires
    boardName: wires-board-name-airalarm
    layoutId: AirAlarm
  - type: AccessReader
    access: [["Engineering"]] #Goob change from atmos to engi
  - type: ContainerFill
    containers:
      board: [ AirAlarmElectronics ]
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: Appearance
  - type: WiresVisuals
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors.rsi
    layers:
    - state: alarmp
      map: ["airAlarmBase"]
    - state: alarm0
      map: ["airAlarmState"] # TODO: fire alarm enum
    - state: alarmx
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: Transform
    anchored: true
  - type: Construction
    graph: AirAlarm
    node: air_alarm
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 200
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 100
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
          - !type:PlaySoundBehavior
            sound:
              collection: MetalGlassBreak
              params:
                volume: -4
  - type: GuideHelp
    guides:
    - AirAlarms
    - DeviceMonitoringAndControl

- type: entity
  id: AirAlarmAssembly
  name: air alarm assembly
  description: An air alarm. Doesn't look like it'll be alarming air any time soon.
  placement:
    mode: SnapgridCenter
    snap:
    - Wallmount
  components:
  - type: WallMount
  - type: Clickable
  - type: InteractionOutline
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors.rsi
    layers:
    - state: alarm_b1
      map: [ "enum.ConstructionVisuals.Layer" ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ConstructionVisuals.Key:
        enum.ConstructionVisuals.Layer:
          assembly: { state: alarm_b1 }
          electronics: { state: alarm_b1 }
  - type: Construction
    graph: AirAlarm
    node: assembly
  - type: Transform
    anchored: true
