# SPDX-FileCopyrightText: 2021 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 wrexbe <81056464+wrexbe@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2022 Errant <35878406+dmnct@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Justin Trotter <trotter.justin@gmail.com>
# SPDX-FileCopyrightText: 2022 Kevin Zheng <kevinz5000@gmail.com>
# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: [ BaseMachinePowered, ConstructibleMachine ]
  id: SalvageMagnet
  name: salvage magnet
  description: Pulls in salvage.
  components:
  - type: Sprite
    sprite: Structures/Machines/salvage.rsi
    layers:
    - state: salvage-magnet
    - state: salvage-magnet-ready
      visible: false
      map: [ "ready" ]
    - state: salvage-magnet-ready-blinking
      visible: false
      map: [ "readyBlinking" ]
    - state: salvage-magnet-unready
      visible: false
      map: [ "unready" ]
    - state: salvage-magnet-unready-blinking
      visible: false
      map: [ "unreadyBlinking" ]
    - state: salvage-magnet-o4
      map: ["chargeState"]
      shader: unshaded
  - type: ActivatableUI
    key: enum.SalvageMagnetUiKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.SalvageMagnetUiKey.Key:
        type: SalvageMagnetBoundUserInterface
  - type: Transform
    noRot: false
  - type: Appearance
  - type: Rotatable
  - type: IntrinsicRadioReceiver
  - type: ActiveRadio
    channels:
    - Supply
  - type: SalvageMagnet
  - type: ApcPowerReceiver
    powerLoad: 2500 # TODO change this to a HV power draw that really hits the grid hard WHEN active
  - type: Machine
    board: SalvageMagnetMachineCircuitboard

# For Knightship
- type: entity
  parent: SalvageMagnet
  id: SalvageLocator
  name: salvage locator
  description: Locates salvage.
  components:
  - type: SalvageMagnet
  - type: ApcPowerReceiver
    powerLoad: 1000

- type: weightedRandomEntity
  id: RandomAsteroidPool
  weights:
    AsteroidSalvageSmall: 3
    AsteroidSalvageMedium: 7
    AsteroidSalvageLarge: 5
    AsteroidSalvageHuge: 3