# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 gus <august.eymann@gmail.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Aineias1 <dmitri.s.kiselev@gmail.com>
# SPDX-FileCopyrightText: 2025 FaDeOkno <143940725+FaDeOkno@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 McBosserson <148172569+McBosserson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Milon <plmilonpl@gmail.com>
# SPDX-FileCopyrightText: 2025 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2025 Rouden <149893554+Roudenn@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 TheBorzoiMustConsume <197824988+TheBorzoiMustConsume@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Unlumination <144041835+Unlumy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 gluesniffler <linebarrelerenthusiast@gmail.com>
# SPDX-FileCopyrightText: 2025 username <113782077+whateverusername0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 whateverusername0 <whateveremail>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: OreBox
  name: ore box
  description: A large storage container for holding unprocessed ores.
  parent: BaseStructureDynamic
  components:
  - type: StaticPrice
    price: 500
  - type: Anchorable
  - type: InteractionOutline
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 150
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:EmptyAllContainersBehaviour
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank1:
            min: 3
            max: 5
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Climbable

  # orebox-specific
  - type: Sprite
    noRot: true
    sprite: /Textures/Structures/Storage/orebox.rsi
    layers:
    - state: orebox
    - state: orebox-top
      map: [ top ]
      visible: true
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.StorageVisuals.Open:
        top:
          True: { visible: false }
          False: { visible: true }
  - type: Storage
    grid:
    - 0,0,19,9 # Lavaland Change
    maxItemSize: Normal
    storageOpenSound: /Audio/Effects/closetopen.ogg
    storageCloseSound: /Audio/Effects/closetclose.ogg
    whitelist:
      tags:
      - ArtifactFragment # Lavaland Change
      - Ore
  - type: UserInterface
    interfaces:
      enum.StorageUiKey.Key:
        type: StorageBoundUserInterface
  - type: ContainerContainer
    containers:
      storagebase: !type:Container
        ents: [ ]
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.3
        # very not dense to make it easy to pull
        density: 20
        mask:
        - MachineMask
        layer:
        - MachineLayer
  # Lavaland Change Start
  - type: OreBag
  - type: MagnetPickup
  - type: ItemToggle
  # Lavaland Change End