- type: entity
  parent: [ BaseMachinePowered, ConstructibleMachine ]
  id: TelecomServer
  name: telecommunication server
  description: When powered and filled with encryption keys it allows radio headset communication.
  components:
  - type: Sprite
    sprite: Structures/Machines/telecomms.rsi
    snapCardinals: true
    layers:
    - state: telecom-nopower
    - state: telecom-stripe
    - state: telecom-on
      shader: unshaded
      visible: false
      map: ["telecom-on"]
    - state: variant-nokey
      map: ["variant-nokey"]
    - state: variant-default
      map: ["variant-default"]
    - state: variant-common
      map: ["variant-common"]
    - state: variant-cargo
      map: ["variant-cargo"]
    - state: variant-engineering
      map: ["variant-engineering"]
    - state: variant-medical
      map: ["variant-medical"]
    - state: variant-science
      map: ["variant-science"]
    - state: variant-sec
      map: ["variant-sec"]
    - state: variant-service
      map: ["variant-service"]
    - state: variant-command
      map: ["variant-command"]
# sunrise-start
    - state: variant-law
      map: ["variant-law"]
# sunrise-end
    - state: variant-multiple
      map: ["variant-multiple"]
    - state: telecom-open
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: ItemMapper
    sprite: Structures/Machines/telecomms.rsi
    mapLayers:
      variant-nokey:
        whitelist:
          components:
          - EncryptionKey  #Shown when no keys are present
        minCount: 0
      variant-default:
        whitelist:
          components:
          - EncryptionKey
        minCount: 1
      variant-common:
        whitelist:
          tags:
          - EncryptionCommon
      variant-cargo:
        whitelist:
          tags:
          - EncryptionCargo
      variant-engineering:
        whitelist:
          tags:
          - EncryptionEngineering
      variant-medical:
        whitelist:
          tags:
          - EncryptionMedical
      variant-science:
        whitelist:
          tags:
          - EncryptionScience
      variant-sec:
        whitelist:
          tags:
          - EncryptionSecurity
      variant-service:
        whitelist:
          tags:
          - EncryptionService
          # sunrise-start
      variant-law:
        whitelist:
          tags:
          - EncryptionLaw
          # sunrise-end
      variant-command:
        whitelist:
          tags:
          - EncryptionCommand
      variant-multiple:
        whitelist:
          components:
          - EncryptionKey  #Shown when multiple keys are present
        minCount: 2
  - type: PointLight
    enabled: false
    castShadows: false
    radius: 1.5
    energy: 1.6
    color: "#39b8ee"
  - type: LitOnPowered
  - type: GenericVisualizer
    visuals:
      enum.PowerDeviceVisuals.Powered:
        telecom-on:
          True: { visible: true }
          False: { visible: false }
        variant-common:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-cargo:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-engineering:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-medical:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-science:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-sec:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-service:
          True: { shader: unshaded }
          False: { shader: shaded }
# sunrise-start
        variant-law:
          True: { shader: unshaded }
          False: { shader: shaded }
# sunrise-end
        variant-command:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-default:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-multiple:
          True: { shader: unshaded }
          False: { shader: shaded }
        variant-nokey:
          True: { shader: unshaded }
          False: { shader: shaded }
  - type: Appearance
  - type: AmbientOnPowered
  - type: AmbientSound
    volume: -9
    range: 5
    enabled: false
    sound:
      path: /Audio/Ambience/Objects/server_fans.ogg
  - type: WiresVisuals
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.4,-0.4,0.4,0.4"
        density: 190
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:ChangeConstructionNodeBehavior
        node: machineFrame
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Machine
    board: TelecomServerCircuitboard
  - type: WiresPanel
  - type: Transform
    anchored: true
  - type: Pullable
  - type: EncryptionKeyHolder
    keysExtractionMethod: Prying
    keySlots: 10
  - type: TelecomServer
  - type: ContainerContainer
    containers:
      key_slots: !type:Container
      machine_board: !type:Container
      machine_parts: !type:Container

- type: entity
  parent: TelecomServer
  id: TelecomServerFilled
  suffix: Filled All
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyCommon
      - EncryptionKeyCargo
      - EncryptionKeyEngineering
      - EncryptionKeyMedical
      - EncryptionKeyScience
      - EncryptionKeySecurity
      - EncryptionKeyService
      - EncryptionKeyCommand
      - EncryptionKeyLaw # Sunrise-Edit
      - EncryptionKeyBlueShield # Sunrise-Edit

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledCommon
  suffix: Common
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyCommon

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledCargo
  suffix: Cargo
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyCargo

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledEngineering
  suffix: Engineering
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyEngineering

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledMedical
  suffix: Medical
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyMedical

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledScience
  suffix: Science
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyScience

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledSecurity
  suffix: Security
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeySecurity

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledService
  suffix: Service
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyService

- type: entity
  parent: TelecomServer
  id: TelecomServerFilledCommand
  suffix: Command
  components:
  - type: ContainerFill
    containers:
      key_slots:
      - EncryptionKeyCommand
