# Base Generator

- type: entity
  abstract: true
  id: BaseGenerator
  description: A high efficiency thermoelectric generator.
  name: generator
  placement:
    mode: SnapgridCenter
  components:
  - type: AmbientSound
    range: 5
    sound:
      path: /Audio/Ambience/Objects/engine_hum.ogg
  - type: Clickable
  - type: InteractionOutline
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
    - shape:
        !type:PhysShapeAabb
          bounds: "-0.4,-0.5,0.4,0.3"
      mass: 25
      mask:
      - Impassable
      - MobImpassable
      - VaultImpassable
      - SmallImpassable
      layer:
      - Opaque
      - MobImpassable
      - VaultImpassable
      - SmallImpassable
  - type: Transform
    anchored: true
  - type: Sprite
    sprite: Structures/Power/power.rsi
    state: generator
  - type: NodeContainer
    examinable: true
    nodes:
      output:
        !type:CableDeviceNode
        nodeGroupID: HVPower
  - type: PowerSupplier
    supplyRate: 3000
    supplyRampRate: 500
    supplyRampTolerance: 500
  - type: Anchorable
  - type: Pullable
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/metalbreak.ogg
      - !type:ExplodeBehavior
  - type: Explosive
    devastationRange: 1
    heavyImpactRange: 3
    lightImpactRange: 5
    flashRange: 6

# Base Wallmount Generator

- type: entity
  abstract: true
  id: BaseGeneratorWallmount
  parent: BaseGenerator
  name: wallmount generator
  description: A high efficiency thermoelectric generator stuffed in a wall cabinet.
  placement:
    mode: SnapgridCenter
  components:
  - type: AmbientOnPowered
  - type: AmbientSound
    volume: -15
    range: 2
    sound:
      path: /Audio/Ambience/Objects/hdd_buzz.ogg
  - type: PointLight
    netsync: false
    radius: 1.5
    energy: 1.6
    color: "#3db83b"
    castShadows: false
  - type: Fixtures
    fixtures:
      - shape:
          !type:PhysShapeAabb
            bounds: "-0.25,-0.25,0.3,0.25"
        layer: [ Passable ]
  - type: Transform
    anchored: true
  - type: Sprite
    drawdepth: WallMountedItems
    netsync: false
    sprite: Structures/Power/Generation/wallmount_generator.rsi
    layers:
    - state: panel
    - state: on
      shader: unshaded
#  - type: Appearance
#    visuals:
#    - type: ApcVisualizer
  - type: NodeContainer
    examinable: true
    nodes:
      output:
        !type:CableDeviceNode
        nodeGroupID: HVPower
  - type: PowerSupplier
    supplyRate: 3000
    supplyRampRate: 500
    supplyRampTolerance: 500

# Construction Frames

- type: entity
  abstract: true
  id: BaseGeneratorWallmountFrame
  name: wallmount generator frame
  description: A construction frame for a wallmount generator.
  placement:
    mode: SnapgridCenter
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: Physics
  - type: Fixtures
    fixtures:
      - shape:
          !type:PhysShapeAabb
            bounds: "-0.25,-0.25,0.3,0.25"
        layer: [ Passable ]
  - type: Transform
    anchored: true
  - type: Sprite
    drawdepth: WallMountedItems
    netsync: false
    sprite: Structures/Power/Generation/wallmount_generator.rsi
    layers:
    - state: panel
  - type: Construction
    graph: WallmountGenerator
    node: frame

# Generators in use

- type: entity
  parent: BaseGenerator
  id: GeneratorBasic
  suffix: Basic, 3kW
  components:
  - type: PowerSupplier
    supplyRate: 3000
    
- type: entity
  parent: BaseGenerator
  id: GeneratorPlasma
  suffix: Plasma, 5kW
  components:
  - type: PowerSupplier
    supplyRate: 5000 # 260 sec / sheet
  - type: Sprite
    sprite: Structures/Power/Generation/portable_generator.rsi
    state: portgen0_1
  - type: Construction
    graph: Machine
    node: machine
  - type: Wires
    BoardName: "GeneratorPlasma"
    LayoutId: GeneratorPlasma
  - type: Machine
    board: GeneratorPlasmaMachineCircuitboard
    
- type: entity
  parent: BaseGenerator
  id: GeneratorUranium
  suffix: Uranium, 15kW
  components:
  - type: PowerSupplier
    supplyRate: 15000 # 85 sec / sheet
  - type: Sprite
    sprite: Structures/Power/Generation/portable_generator.rsi
    state: portgen1_1
  - type: Construction
    graph: Machine
    node: machine
  - type: Wires
    BoardName: "GeneratorUranium"
    LayoutId: GeneratorUranium
  - type: Machine
    board: GeneratorUraniumMachineCircuitboard


- type: entity
  parent: BaseGeneratorWallmount
  id: GeneratorWallmountBasic
  suffix: Basic, 3kW
  components:
  - type: PowerSupplier
    supplyRate: 3000
  - type: Construction
    graph: WallmountGenerator
    node: generator

- type: entity
  parent: BaseGeneratorWallmount
  id: GeneratorWallmountAPU
  name: shuttle APU
  description: An auxiliary power unit for a shuttle - 6kW.
  suffix: APU, 6kW
  components:
  - type: PowerSupplier
    supplyRate: 6000
  - type: Construction
    graph: WallmountGenerator
    node: APU  

# RTG - no fuel requirement

- type: entity
  parent: BaseGenerator
  id: GeneratorRTG
  name: RTG
  description: A Radioisotope Thermoelectric Generator for long term power.
  suffix: 10kW
  components:
  - type: PowerSupplier
    supplyRate: 10000 # supposed to be low power at no fuel cost to power derelicts
  - type: Sprite
    sprite: Structures/Power/Generation/rtg.rsi
    state: rtg
  - type: AmbientSound
    range: 5
    sound:
      path: /Audio/Ambience/Objects/buzzing.ogg
# TODO: need radioactive fallout when destroyed

- type: entity
  parent: GeneratorRTG
  id: GeneratorRTGDamaged
  name: damaged RTG
  description: A Radioisotope Thermoelectric Generator for long term power. This one has damaged shielding.
  suffix: 10kW
  components:
  - type: PowerSupplier
    supplyRate: 10000
  - type: Sprite
    netsync: false
    sprite: Structures/Power/Generation/rtg.rsi
    layers:
      - state: rtg_damaged
      - state: rtg_glow
  - type: RadiationPulse # ideally only when opened.
    range: 2
    decay: false
    minPulseLifespan: 1
    maxPulseLifespan: 1
