# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: CrewMonitoringServer
  parent: [ BaseMachinePowered, ConstructibleMachine ]
  name: crew monitoring server
  description: Receives and relays the status of all active suit sensors on the station.
  components:
    - type: Sprite
      sprite: Structures/Machines/server.rsi
      snapCardinals: true
      layers:
        - state: server-off
        - state: server-on
          visible: false
          map: [ "enum.PowerDeviceVisualLayers.Powered" ]
        - state: variant-crew
        - state: server_o
          map: ["enum.WiresVisualLayers.MaintenancePanel"]
    - type: Construction
      graph: Machine
      node: machine
      containers:
        - machine_board
        - machine_parts
    - type: Machine
      board: CrewMonitoringServerMachineCircuitboard
    - type: ContainerContainer
      containers:
        machine_board: !type:Container
        machine_parts: !type:Container
    - type: CrewMonitoringServer
    - type: SingletonDeviceNetServer
    - type: DeviceNetwork
      deviceNetId: Wireless
      transmitFrequencyId: CrewMonitor
      receiveFrequencyId: SuitSensor
      autoConnect: false
    - type: WirelessNetworkConnection
      range: 500
    - type: StationLimitedNetwork
    - type: ApcPowerReceiver
      powerLoad: 200
    - type: ExtensionCableReceiver
    - type: WiresPanel
    - type: WiresVisuals
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 600
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 300
          behaviors:
            - !type:DoActsBehavior
              acts: ["Destruction"]
            - !type:PlaySoundBehavior
              sound:
                collection: MetalGlassBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                SheetSteel1:
                  min: 1
                  max: 2
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.PowerDeviceVisuals.Powered:
          enum.PowerDeviceVisualLayers.Powered:
            True: {visible: true}
            False: {visible: false}
    - type: AmbientOnPowered
    - type: AmbientSound
      volume: -9
      range: 5
      enabled: false
      sound:
        path: /Audio/Ambience/Objects/server_fans.ogg
    - type: GuideHelp
      guides:
      - Medical
