# 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
      # Very important:
      # Disable networking to prevent the battery getting continuously dirtied every tick as it interacts with the power network.
      # This can not be done by changing the charge rate as the power supply ramps up over time.
      # This disables prediction for this battery.
      netsync: false
      startingCharge: 0
      maxCharge: 8000000
    - 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
      maxSupply: 150000
      maxChargeRate: 5000
      supplyRampTolerance: 5000
      supplyRampRate: 1000
    - type: PointLight
      radius: 1.2
      energy: 3.0
      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
      damageModifierSet: StructuralMetallicStrong
    - type: Injurable
      damageContainer: StructuralInorganic
    - 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: 150000
      minSupply: 5000
      maxSupply: 150000
    - 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, 8MJ
  components:
  - type: Battery
    maxCharge: 8000000
    startingCharge: 8000000

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

- type: entity
  parent: BaseSMES
  id: SMESAdvanced
  suffix: Advanced, 16MJ
  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
    maxCharge: 16000000
    startingCharge: 16000000
  - 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
