# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <gradientvera@outlook.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 CommieFlowers <rasmus.cedergren@hotmail.com>
# SPDX-FileCopyrightText: 2022 Jack Fox <35575261+DubiousDoggo@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 corentt <36075110+corentt@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 rolfero <45628623+rolfero@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Morb <14136326+Morb0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Tom Leys <tom@crump-leys.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 <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Piras314 <92357316+Piras314@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Armok <155400926+ARMOKS@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 McBosserson <148172569+McBosserson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 McBosserson <mcbosserson@hotmail.com>
# SPDX-FileCopyrightText: 2025 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Base SMES
- type: entity
  abstract: true
  id: BaseSMES
  parent: [ BaseMachine, ConstructibleMachine ]
  name: SMES
  description: A high-capacity superconducting magnetic energy storage (SMES) unit.
  placement:
    mode: SnapgridCenter
  components:
    - type: AmbientSound
      volume: -7
      range: 3
      sound:
        path: /Audio/Ambience/Objects/periodic_beep.ogg
    - type: Sprite
      sprite: Structures/Power/smes.rsi
      snapCardinals: true
      layers:
        - state: smes
        - map: ["enum.SmesVisualLayers.Charge"]
          state: "smes-og1" # -og0 does not exist
          shader: unshaded
          visible: false
        - map: ["enum.SmesVisualLayers.Input"]
          state: "smes-oc0"
          shader: unshaded
        - map: ["enum.SmesVisualLayers.Output"]
          state: "smes-op1"
          shader: unshaded
        - map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
          state: smes-open
    - type: Smes
    - type: Appearance
    - type: Battery
      startingCharge: 0
      maxCharge: 16000000 # Goobstation - SMES buff
      pricePerJoule: .00095
    - type: ExaminableBattery
    - type: NodeContainer
      examinable: true
      nodes:
        input:
          !type:CableTerminalPortNode
          nodeGroupID: HVPower
        output:
          !type:CableDeviceNode
          nodeGroupID: HVPower
    - type: PowerMonitoringDevice
      group: SMES
      sourceNode: input
      loadNode: output
      collectionName: smes
      sprite: Structures/Power/smes.rsi
      state: static
    - type: BatteryDischarger
      voltage: High
      node: output
    - type: BatteryCharger
      voltage: High
      node: input
    - type: PowerNetworkBattery
       # Goobstation - SMES buff
      maxSupply: 300000
      maxChargeRate: 10000
      supplyRampTolerance: 10000
      supplyRampRate: 2000
    - type: PointLight
      radius: 1.5
      energy: 1.6
      color: "#c9c042"
      castShadows: false
    - type: WiresPanel
    - type: WiresVisuals
    - type: Machine
      board: SMESMachineCircuitboard
    - type: StationInfiniteBatteryTarget
    - type: Electrified
      onHandInteract: false
      onInteractUsing: false
      onBump: false
      requirePower: true
      highVoltageNode: input
      mediumVoltageNode: output
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: StructuralMetallicStrong
    - type: BatterySensor
    - type: DeviceNetwork
      deviceNetId: AtmosDevices
      receiveFrequencyId: AtmosMonitor
      transmitFrequencyId: AtmosMonitor
      prefix: device-address-prefix-smes
      sendBroadcastAttemptEvent: true
      examinableAddress: true
    - type: WiredNetworkConnection
    - type: GuideHelp
      guides:
      - PowerStorage
      - VoltageNetworks
      - Power

    # Interface
    - type: BatteryInterface
      minChargeRate: 5000
      maxChargeRate: 300000 # Goobstation - SMES buff
      minSupply: 5000
      maxSupply: 300000 # Goobstation - SMES buff
    - type: UserInterface
      interfaces:
        enum.BatteryUiKey.Key:
          type: BatteryBoundUserInterface
    - type: ActivatableUI
      key: enum.BatteryUiKey.Key

# SMES' in use

- type: entity
  parent: BaseSMES
  id: SMESBasic
  suffix: Basic, 16MJ
  components:
  - type: Battery
     # Goobstation - SMES buff
    maxCharge: 16000000
    startingCharge: 16000000

- type: entity
  parent: SMESBasic
  id: SMESBasicEmpty
  suffix: Empty
  components:
  - type: Battery
    startingCharge: 0

- type: entity
  parent: BaseSMES
  id: SMESAdvanced
  suffix: Advanced, 32MJ
  name: advanced SMES
  description: An even-higher-capacity superconducting magnetic energy storage (SMES) unit.
  components:
  - type: Sprite
    sprite: Structures/Power/smes.rsi
    snapCardinals: true
    layers:
    - state: advancedsmes
    - map: [ "enum.SmesVisualLayers.Charge" ]
      state: "smes-og1" # -og0 does not exist
      shader: unshaded
      visible: false
    - map: [ "enum.SmesVisualLayers.Input" ]
      state: "smes-oc0"
      shader: unshaded
    - map: [ "enum.SmesVisualLayers.Output" ]
      state: "smes-op1"
      shader: unshaded
    - map: ["enum.WiresVisualLayers.MaintenancePanel"]
      state: advancedsmes-open
  - type: Machine
    board: SMESAdvancedMachineCircuitboard
  - type: Battery
     # Goobstation - SMES buff
    maxCharge: 32000000
    startingCharge: 32000000
  - type: PowerMonitoringDevice
    group: SMES
    sourceNode: input
    loadNode: output
    collectionName: smes
    sprite: Structures/Power/smes.rsi
    state: advancedsmes-static

- type: entity
  parent: SMESAdvanced
  id: SMESAdvancedEmpty
  suffix: Empty
  components:
  - type: Battery
    startingCharge: 0
