# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 IrisTheAmped <iristheamped@gmail.com>
# SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter <solsticeofthewinter@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: EnergyChemDispenser
  parent: SmallConstructibleMachine
  name: energy chemical dispenser
  suffix: energy
  description: A bluespace Chemical Dispenser that uses station energy to synthesize Reagents. The future is here and now.
  placement:
    mode: SnapgridCenter
  components:
  - type: Sprite
    sprite: Structures/dispensers.rsi
    state: industrial-working
    snapCardinals: true
  - type: Transform
    anchored: true
    noRot: true
  - type: Clickable
  - type: InteractionOutline
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.25, -0.4, 0.25, 0.4"
        density: 190
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: Battery
    maxCharge: 1500
    startingCharge: 1500
  - type: ApcPowerReceiverBattery
    idleLoad: 65
    batteryRechargeRate: 30
    batteryRechargeEfficiency: 1.0
  - type: ApcPowerReceiver
    powerLoad: 65
  - type: ExtensionCableReceiver
  - type: Anchorable
  - type: Pullable
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:ChangeConstructionNodeBehavior
        node: machineFrame
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: ContainerContainer
    containers:
      machine_board: !type:Container
      machine_parts: !type:Container
      energyBeakerSlot: !type:ContainerSlot
      storagebase: !type:Container
  - type: StaticPrice
    price: 1000
  - type: WiresPanel
  - type: GuideHelp
    guides:
    - Chemicals
    - Chemist
  - type: StealTarget
    stealGroup: ChemDispenser
  - type: Machine
    board: EnergyChemDispenserMachineCircuitboard
  - type: ActivatableUI
    key: enum.EnergyReagentDispenserUiKey.Key
  - type: UserInterface
    interfaces:
      enum.EnergyReagentDispenserUiKey.Key:
        type: EnergyReagentDispenserBoundUserInterface
      enum.StorageUiKey.Key:
        type: StorageBoundUserInterface
  - type: EnergyReagentDispenser #Keep on bottom for view's sake, format is reagentProto: Cost
    energyBeakerSlot:
      whitelistFailPopup: reagent-dispenser-component-cannot-put-entity-message
      whitelist:
        components:
        - FitsInDispenser
    reagents:
      Aluminium: 8
      Carbon: 3
      Chlorine: 12
      Copper: 5
      Ethanol: 8
      Fluorine: 12
      Hydrogen: 3
      Iodine: 8
      Iron: 5
      Lithium: 12
      Mercury: 12
      Nitrogen: 3
      Oxygen: 3
      Phosphorus: 5
      Potassium: 8
      Radium: 15
      Silicon: 3
      Sodium: 5
      Sugar: 5
      Sulfur: 5
