# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Acruid <shatter66@gmail.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 cyclowns <cyclowns@protonmail.ch>
# SPDX-FileCopyrightText: 2021 mirrorcult <notzombiedude@gmail.com>
# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Profane McBane <profanedbane+github@gmail.com>
# SPDX-FileCopyrightText: 2022 keronshb <54602815+keronshb@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2023 Naive817 <31364560+Naive817@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kevin Zheng <kevinz5000@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2025 holorain <scratchysenior@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: RadiationCollector
  parent: ConstructibleMachine # Goobstation
  name: radiation collector
  suffix: Empty tank
  description: A machine that collects radiation and turns it into power. Requires plasma gas to function.
  placement:
    mode: SnapgridCenter
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 190
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: Transform
    anchored: true
    noRot: true
  - type: Sprite
    sprite: Structures/Power/Generation/Singularity/collector.rsi
    snapCardinals: true
    layers:
      - state: ca_off
        map: ["enum.RadiationCollectorVisualLayers.Main"]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.RadiationCollectorVisuals.TankInserted:
        tankInserted:
          False: { state: ca-tank, visible: false }
          True: { state: ca-tank, visible: true }
      enum.RadiationCollectorVisuals.PressureState:
        pressureLight:
          0: { state: ca-o0, shader: "unshaded" }
          1: { state: ca-o1, shader: "unshaded" }
          2: { state: ca-o2, shader: "unshaded" }
          3: { state: ca-o3, shader: "unshaded" }
  - type: AnimationPlayer
  - type: NodeContainer
    examinable: true
    nodes:
      input:
        !type:CableDeviceNode
        nodeGroupID: HVPower
  - type: PowerMonitoringDevice
    group: Generator
    loadNode: input
    collectionName: radiationCollector
    sprite: Structures/Power/Generation/Singularity/collector.rsi
    state: static
  - type: RadiationCollector
    chargeModifier: 15000
    radiationReactiveGases:
      - reactantPrototype: Plasma
        powerGenerationEfficiency: 1
        reactantBreakdownRate: 0.0001
  - type: RadiationReceiver
  - type: PowerSupplier
  - type: Anchorable
  - type: Rotatable
  - type: Pullable
  - type: GuideHelp
    guides:
    - SingularityEngine
    - Power
  - type: ContainerContainer
    containers:
      gas_tank: !type:ContainerSlot {}
      machine_board: !type:Container # Goobstation
      machine_parts: !type:Container # Goobstation
  - type: ItemSlots
    slots:
      gas_tank:
        startingItem: PlasmaTank
        whitelist:
          components:
          - GasTank
  - type: RadCollectorSignal # Goobstation
  - type: AutomationSlots # Goobstation
    slots:
    - !type:AutomatedItemSlot
      input: AutomationSlotGasTank
      output: AutomationSlotGasTank
      slotId: gas_tank
    - !type:AutomatedPorts
      sources:
      - RadEmpty
      - RadLow
      - RadFull
  - type: UseDelay
    delay: 1
  - type: LightningTarget # Goobstation
    lightningExplode: false # Goobstation
  - type: Machine # Goobstation
    board: RadiationCollectorCircuitboard # Goobstation

- type: entity
  id: RadiationCollectorNoTank
  suffix: No tank
  parent: RadiationCollector
  components:
  - type: ItemSlots
    slots:
      gas_tank:
        whitelist:
          components:
          - GasTank

- type: entity
  id: RadiationCollectorFullTank
  suffix: Filled tank
  parent: RadiationCollector
  components:
  - type: ItemSlots
    slots:
      gas_tank:
        startingItem: PlasmaTankFilled
        whitelist:
          components:
          - GasTank
