# SPDX-FileCopyrightText: 2019 DamianX <DamianX@users.noreply.github.com>
# SPDX-FileCopyrightText: 2019 Ephememory <yetanotherscuffed@gmail.com>
# SPDX-FileCopyrightText: 2019 Pieter-Jan Briers <pieterjan.briers@gmail.com>
# SPDX-FileCopyrightText: 2020 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Hugo Laloge <hugo.laloge@gmail.com>
# SPDX-FileCopyrightText: 2020 L.E.D <10257081+unusualcrow@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2020 Remie Richards <remierichards@gmail.com>
# SPDX-FileCopyrightText: 2020 V�ctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 V�ctor Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2020 Ygg01 <daniel.fath7@gmail.com>
# SPDX-FileCopyrightText: 2020 lajolico <55922029+lajolico@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 py01 <60152240+collinlunn@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 py01 <pyronetics01@gmail.com>
# SPDX-FileCopyrightText: 2020 unusualcrow <unusualcrow@protonmail.com>
# SPDX-FileCopyrightText: 2020 windarkata <windarkata@gmail.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Galactic Chimp <GalacticChimpanzee@gmail.com>
# SPDX-FileCopyrightText: 2021 Julian Giebel <j.giebel@netrocks.info>
# SPDX-FileCopyrightText: 2021 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Pancake <Pangogie@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 ike709 <ike709@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nairod <110078045+Nairodian@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 crazybrain23 <44417085+crazybrain23@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# 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: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: ResearchAndDevelopmentServer
  parent: [ BaseMachinePowered, ConstructibleMachine ]
  name: R&D server
  description: Contains the collective knowledge of the station's scientists. Destroying it would send them back to the stone age. You don't want that do you?
  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-research
      - state: server_o
        map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: PointLight
    enabled: false
    castShadows: false
    radius: 1.5
    energy: 1.6
    color: "#b211b2"
  - type: LitOnPowered
  - type: ResearchServer
  - type: TechnologyDatabase
    supportedDisciplines:
    - Industrial
    - Arsenal
    - Experimental
    - CivilianServices
  - type: ApcPowerReceiver
    powerLoad: 200
  - type: ExtensionCableReceiver
  - type: WiresPanel
  - type: WiresVisuals
  - type: Machine
    board: ResearchAndDevelopmentServerMachineCircuitboard
  - 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: MetalBreak
      - !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:
    - Science
  - type: ResearchPointSource # Goobstation
    pointspersecond: 15
    active: true

- type: entity
  id: BaseResearchAndDevelopmentPointSource
  parent: BaseMachinePowered
  name: "base R&D point source"
  # We should make this abstract once there are actual point sources.
  components:
  - type: Sprite
    sprite: Structures/Machines/rndpointsource.rsi
    layers:
    - state: rndpointsource-off
    - state: rndpointsource
      shader: unshaded
      map: ["enum.PowerDeviceVisualLayers.Powered"]
  - type: ResearchClient
  - type: ResearchPointSource
    pointspersecond: 25
    active: true
  - type: PointLight
    radius: 1.5
    energy: 1.6
    color: "#3db83b"
  - type: ActivatableUI
    key: enum.ResearchClientUiKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.ResearchClientUiKey.Key:
        type: ResearchClientBoundUserInterface
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.PowerDeviceVisuals.Powered:
        enum.PowerDeviceVisualLayers.Powered:
          True: {visible: true}
          False: {visible: false}
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 400
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
  - type: GuideHelp
    guides:
    - Science
