# SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 SpeltIncorrectyl <66873282+SpeltIncorrectyl@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-FileCopyrightText: 2025 Benjamin Velliquette <32338704+bVelliquette@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: MachineFlatpacker
  parent: [ BaseMachinePowered, ConstructibleMachine, BaseSiloUtilizer ] # Goob edit
  name: Flatpacker 1001
  description: An industrial machine used for expediting machine construction across the station.
  components:
  - type: Sprite
    sprite: Structures/Machines/flatpacker.rsi
    snapCardinals: true
    layers:
    - state: base
    - state: screen
      map: ["enum.PowerDeviceVisualLayers.Powered"]
      shader: unshaded
    - state: panel
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
    - state: packing
      map: ["anim"]
      visible: false
    - state: inserting
      visible: false
      map: ["enum.MaterialStorageVisualLayers.Inserting"]
  - type: GenericVisualizer
    visuals:
      enum.PowerDeviceVisuals.Powered:
        enum.PowerDeviceVisualLayers.Powered:
          True: { visible: true }
          False: { visible: false }
      enum.FlatpackCreatorVisuals.Packing:
        anim:
          True: { visible: true }
          False: { visible: false }
  - type: FlatpackCreator
    baseMachineCost:
      Steel: 750
    baseComputerCost:
      Steel: 500
      Glass: 250
  - type: Machine
    board: FlatpackerMachineCircuitboard
  - type: MaterialStorage
    whitelist:
      tags:
      - Sheet
      - RawMaterial
      - Ingot
  - type: AmbientSound
    enabled: false
    volume: 5
    range: 3
    sound:
      path: /Audio/Items/rped.ogg
  - type: WiresPanel
  - type: WiresVisuals
  - type: Appearance
  - type: ActivatableUI
    key: enum.FlatpackCreatorUIKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.FlatpackCreatorUIKey.Key:
        type: FlatpackCreatorBoundUserInterface
  - type: ItemSlots
    slots:
      board_slot:
        name: flatpacker-item-slot-name
        whitelist:
          components:
          - MachineBoard
          - ComputerBoard
  - type: AutomationSlots # Goobstation
    slots:
    - !type:AutomatedItemSlot
      input: AutomationSlotBoard
      output: AutomationSlotBoard
      slotId: board_slot
    - !type:AutomatedMaterialStorage
      input: AutomationSlotMaterials
      output: null # no automatic silo stealer...
    - !type:AutomatedPorts
      sinks:
      - On
  - type: ContainerContainer
    containers:
      machine_board: !type:Container
      machine_parts: !type:Container
      board_slot: !type:ContainerSlot
  - type: Construction
    containers:
    - machine_parts
    - machine_board
    - board_slot
  - type: StaticPrice
    price: 2000

- type: entity
  id: FlatpackerNoBoardEffect
  categories:
  - HideSpawnMenu
  components:
  - type: Sprite
    sprite: Structures/Machines/autolathe.rsi
    state: icon
    color: "#222222"
