- type: entity
  parent: BaseWallmountMachine
  id: FireAlarm
  name: fire alarm
  description: A fire alarm. Spicy!
  components:
  - type: LightningTarget
    priority: 0
  - type: Electrified
    enabled: false
    usesApcPower: true
  - type: ExtensionCableReceiver
  - type: DeviceNetwork
    deviceNetId: AtmosDevices
    receiveFrequencyId: AtmosMonitor
    transmitFrequencyId: AtmosMonitor
    prefix: device-address-prefix-fire-alarm
    sendBroadcastAttemptEvent: true
    examinableAddress: true
  - type: DeviceList
  - type: WiredNetworkConnection
  - type: DeviceNetworkRequiresPower
  - type: AtmosDevice
  - type: AtmosAlarmable
    syncWith:
      - FireAlarm
      - AirSensor
      - GasVent
      - GasScrubber
    monitorAlertTypes:
      - Temperature
  - type: AtmosAlarmableVisuals
    layerMap: "fireAlarmState"
    alarmStates:
      Normal: fire_off
      Warning: fire_off # shouldn't be alarming at a warning
      Danger: fire_on
      Emagged: fire_emagged
    hideOnDepowered: [ "fireAlarmState" ]
  - type: Tag
    tags:
      - FireAlarm
  - type: FireAlarm
  - type: AtmosAlertsDevice
    group: FireAlarm
  - type: ContainerFill
    containers:
      board: [ FireAlarmElectronics ]
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: Appearance
  - type: WiresVisuals
  - type: AlertLevelDisplay
    alertVisuals:
      Green: fire_0
      Blue: fire_1
      Red: fire_2
      Violet: fire_1
      Yellow: fire_1
      DeltaNuke: fire_3
      # TODO: add missing alarm states
  - type: UserInterface
    interfaces:
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: WiresPanel
  - type: Wires
    boardName: wires-board-name-firealarm
    layoutId: FireAlarm
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors.rsi
    layers:
    - state: fire0
      map: ["fireAlarmBase"]
    - state: fire_off
      map: ["fireAlarmState"]
    - state: fire_b2
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: Transform
    anchored: true
  - type: Construction
    graph: FireAlarm
    node: fire_alarm
  - type: Damageable
    damageModifierSet: Metallic
  - type: Injurable
    damageContainer: StructuralInorganic
  - type: GuideHelp
    guides:
    - Networking
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 80
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
          params:
            volume: -4
  - type: StationAiWhitelist

- type: entity
  parent: BaseWallmountMetallic
  id: FireAlarmAssembly
  name: fire alarm assembly
  description: A fire alarm assembly. Very mild.
  components:
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors.rsi
    layers:
    - state: fire_b1
      map: [ "enum.ConstructionVisuals.Layer" ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ConstructionVisuals.Key:
        enum.ConstructionVisuals.Layer:
          assembly: { state: fire_b1 }
          electronics: { state: fire_b2 }
  - type: Construction
    graph: FireAlarm
    node: assembly
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 15
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
          params:
            volume: -4

- type: entity
  id: FireAlarmXeno
  parent: FireAlarm
  description: An alien fire alarm. Works just the same!
  components:
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors_xeno.rsi

- type: entity
  id: FireAlarmAssemblyXeno
  parent: FireAlarmAssembly
  description: An alien fire alarm assembly. Good luck with the wires.
  components:
  - type: Sprite
    sprite: Structures/Wallmounts/air_monitors_xeno.rsi
