# SPDX-FileCopyrightText: 2024 Dvir <39403717+dvir001@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 pheenty <fedorlukin2006@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: PlantBox
  name: plant box
  description: A large storage container for holding plants and seeds.
  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

  # plantbox-specific
  - type: Sprite
    noRot: true
    sprite: _NF/Structures/Storage/plantbox.rsi
    layers:
    - state: plantbox
    - state: plantbox-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
    maxItemSize: Normal
    storageOpenSound: /Audio/Effects/closetopen.ogg
    storageCloseSound: /Audio/Effects/closetclose.ogg
    whitelist:
      components:
      - Produce
      - Seed
  - 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
  - type: MagnetPickup
  - type: ItemToggle
