- type: entity
  parent: StructureHealthMachine
  id: WeaponEnergyTurretControlPanelFrame
  name: sentry turret control panel assembly
  description: An incomplete wall-mounted assembly for a sentry turret control panel.
  categories: [ HideSpawnMenu ]
  placement:
    mode: SnapgridCenter
    snap:
    - Wallmount
  components:
  - type: Sprite
    noRot: false
    drawdepth: SmallObjects
    sprite: Structures/Wallmounts/turret_controls.rsi
    layers:
    - state: base
  - type: Damageable
    damageModifierSet: SteelMod
  - type: Destructible
    thresholds:
    - trigger: &DamageMachineNormal
        !type:DamageTrigger
        damage: 175
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
          params:
            volume: -4
  - type: Transform
    anchored: true
  - type: WallMount
  - type: Clickable
  - type: InteractionOutline
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: Construction
    graph: WeaponEnergyTurretControlPanel
    node: frame
    containers:
    - board

- type: entity
  abstract: true
  parent: WeaponEnergyTurretControlPanelFrame
  id: WeaponEnergyTurretStationControlPanelBase
  name: sentry turret control panel
  description: A wall-mounted interface for remotely configuring the operational parameters of linked sentry turrets.
  components:
  - type: Appearance
  - type: Sprite
    noRot: false
    drawdepth: SmallObjects
    sprite: Structures/Wallmounts/turret_controls.rsi
    layers:
    - state: base
    - state: safe
      map: ["enum.PowerDeviceVisualLayers.Powered"]
      shader: unshaded
    - state: wires
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
      visible: false
  - type: GenericVisualizer
    visuals:
      enum.WiresVisualLayers.MaintenancePanel:
        enum.WiresVisualLayers.MaintenancePanel:
          True: { visible: true }
          False: { visible: false }
      enum.PowerDeviceVisuals.Powered:
        enum.PowerDeviceVisualLayers.Powered:
          True: { visible: true }
          False: { visible: false }
      enum.TurretControllerVisuals.ControlPanel:
        enum.PowerDeviceVisualLayers.Powered:
          -1: { state: safe }
          0: { state: stun }
          1: { state: lethal }
  - type: Damageable
    damageModifierSet: GlassReinforcedMod
  - type: Destructible
    thresholds:
    - trigger: *DamageMachineNormal
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 0
            max: 1
      - !type:EmptyContainersBehaviour
        containers:
        - board
      - !type:ChangeConstructionNodeBehavior
        node: frame
  - type: StationAiWhitelist
  - type: DeployableTurretController
    accessGroups:
    - Cargo
    - Command
    - Engineering
    - General
    - Medical
    - Research
    - Security
    - Service
    - Silicon
    accessLevels:
    - Armory
    - Atmospherics
    - Bar
    - BasicSilicon
    - Borg
    - Brig
    - Detective
    - Captain
    - Cargo
    - Chapel
    - Chemistry
    - ChiefEngineer
    - ChiefMedicalOfficer
    - Command
    - Cryogenics
    - Engineering
    - External
    - HeadOfPersonnel
    - HeadOfSecurity
    - Hydroponics
    - Janitor
    - Kitchen
    - Lawyer
    - Maintenance
    - Medical
    - Quartermaster
    - Research
    - ResearchDirector
    - Salvage
    - Security
    - Service
    - Theatre
  - type: DeviceList
    isAllowList: true
  - type: DeviceNetwork
    deviceNetId: Wired
    receiveFrequencyId: Turret
    transmitFrequencyId: TurretControl
    sendBroadcastAttemptEvent: true
    prefix: device-address-prefix-console
  - type: DeviceNetworkRequiresPower
  - type: WiredNetworkConnection
  - type: ActivatableUI
    key: enum.DeployableTurretControllerUiKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.DeployableTurretControllerUiKey.Key:
        type: TurretControllerWindowBoundUserInterface
      enum.WiresUiKey.Key:
        type: WiresBoundUserInterface
  - type: WiresPanel
  - type: WiresVisuals
  - type: Wires
    boardName: wires-board-name-turret-controls
    layoutId: TurretControls
  - type: Lock
    locked: true
    unlockOnClick: false
  - type: LockedWiresPanel
  - type: ApcPowerReceiver
  - type: ExtensionCableReceiver
  - type: Electrified
    enabled: false
    usesApcPower: true
  - type: Construction
    graph: WeaponEnergyTurretControlPanel
    node: finish

- type: entity
  parent: WeaponEnergyTurretStationControlPanelBase
  id: WeaponEnergyTurretAIControlPanel
  suffix: AI, Silicon
  components:
  - type: AccessReader
    access: [["StationAi"], ["ResearchDirector"]]
  - type: ContainerFill
    containers:
      board:
      - WeaponEnergyTurretAIControlPanelElectronics
  - type: DeviceNetwork
    receiveFrequencyId: TurretAI
    transmitFrequencyId: TurretControlAI
  - type: TurretTargetSettings
    exemptAccessLevels:
    - BasicSilicon
    - Borg
  - type: DeployableTurretController
    accessGroups:
    - Silicon
    accessLevels:
    - BasicSilicon
    - Borg

- type: entity
  parent: WeaponEnergyTurretStationControlPanelBase
  id: WeaponEnergyTurretSecurityControlPanel
  suffix: Security
  components:
  - type: AccessReader
    access: [["StationAi"], ["Security"]]
  - type: ContainerFill
    containers:
      board:
      - WeaponEnergyTurretSecurityControlPanelElectronics
  - type: TurretTargetSettings
    exemptAccessLevels:
    - Security
    - BasicSilicon
    - Borg

- type: entity
  parent: WeaponEnergyTurretStationControlPanelBase
  id: WeaponEnergyTurretCommandControlPanel
  suffix: Command
  components:
  - type: AccessReader
    access: [["StationAi"], ["Command"]]
  - type: ContainerFill
    containers:
      board:
      - WeaponEnergyTurretCommandControlPanelElectronics
  - type: TurretTargetSettings
    exemptAccessLevels:
    - Command
    - BasicSilicon
    - Borg
