#region base
- type: entity
  id: NFBaseMagnetBox
  parent: BaseStructureDynamic
  abstract: true
  components:
  - type: StaticPrice
    price: 625
  - type: InteractionOutline
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Wood
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 450
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:EmptyAllContainersBehaviour
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank1:
            min: 3
            max: 5
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Climbable
  - type: Sprite
    noRot: true
    sprite: /Textures/_NF/Structures/Storage/magnetbox.rsi
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.StorageVisuals.Open:
        top:
          True: { visible: false }
          False: { visible: true }
      enum.ToggleableVisuals.Enabled:
        enum.ToggleableVisuals.Layer:
          True: { visible: True }
          False: { visible: False }
  - type: Storage
    grid:
    - 0,0,19,9 # DeltaV: Expanded to ore bag of holding storage
    maxItemSize: Normal
    storageOpenSound: /Audio/Effects/closetopen.ogg
    storageCloseSound: /Audio/Effects/closetclose.ogg
  - type: UserInterface
    interfaces:
      enum.StorageUiKey.Key:
        type: StorageBoundUserInterface
  - type: ContainerContainer
    containers:
      storagebase: !type:Container
        ents: [ ]
  - type: Dumpable
  - type: MagnetPickup
    range: 1.5 # Ore bag has a range of 1.0
    magnetEnabled: false
    magnetCanBeEnabled: false
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.4
        density: 20
        mask:
        - SmallMobMask
        layer:
        - MachineLayer
  - type: ItemToggle
    soundActivate: &soundActivate
      collection: sparks
      params:
        variation: 0.25
    soundDeactivate: *soundActivate
    onUse: false
    onAltUse: true
    onActivate: false
  - type: ItemToggleExamine
    on: item-toggle-examine-magnet-on
    off: item-toggle-examine-magnet-off

#region ore box
- type: entity
  id: NFMagnetBoxOre
  parent: NFBaseMagnetBox
  name: ore box
  description: A large storage container for collecting and holding unprocessed ores and fragments.
  components:
  - type: Sprite
    layers:
    - state: orebox
    - state: orebox-top
      map: [ top ]
      visible: true
    - state: controller
    - state: controller-on
      visible: False
      map: [ "enum.ToggleableVisuals.Layer" ]
      shader: unshaded
  - type: Storage
    whitelist:
      tags:
      - Ore
      - ArtifactFragment
  - type: PirateBountyItem
    id: NFMagnetBoxOre

#region construction box
- type: entity
  id: NFMagnetBoxConstruction
  parent: NFBaseMagnetBox
  name: construction box
  description: A large storage container for holding construction materials.
  components:
  - type: Sprite
    layers:
    - state: constructionbox
    - state: constructionbox-top
      map: [ top ]
      visible: true
    - state: controller
    - state: controller-on
      visible: False
      map: [ "enum.ToggleableVisuals.Layer" ]
      shader: unshaded
  - type: Storage
    whitelist:
      tags:
      - Ingot
      - RodMetal1
      - Sheet
      - CableCoil
      components:
      - ConstructionMaterials
    blacklist:
      tags:
      - PrizeTicket

#region plant box
- type: entity
  id: NFMagnetBoxPlant
  parent: NFBaseMagnetBox
  name: plant box
  description: A large storage container for holding plants and seeds.
  components:
  - type: Sprite
    layers:
    - state: plantbox
    - state: plantbox-top
      map: [ top ]
      visible: true
    - state: controller
    - state: controller-on
      visible: False
      map: [ "enum.ToggleableVisuals.Layer" ]
      shader: unshaded
  - type: Storage
    whitelist:
      components:
        - Produce
        - Seed

#region trash box
- type: entity
  id: NFMagnetBoxRubbish
  parent: NFBaseMagnetBox
  name: dumpster
  description: A large storage container for holding trash. It smells like the big city.
  components:
  - type: GoblinVehicle
  - type: Sprite
    layers:
    - state: rubbishbox
    - state: rubbishbox-top
      map: [ top ]
      visible: true
    - state: controller
    - state: controller-on
      visible: False
      map: [ "enum.ToggleableVisuals.Layer" ]
      shader: unshaded
  - type: Flammable
    fireSpread: true
    canResistFire: true
    damage: #per second, scales with number of fire 'stacks'
      types:
        Heat: 1.5
  - type: FireVisuals
    sprite: Mobs/Effects/onfire.rsi
    normalState: Generic_mob_burning
  - type: Storage
    whitelist:
      tags:
      - Recyclable
      - Trash
    maxItemSize: Huge # so you can pick up scrap chunks

#region treasure box
- type: entity
  id: NFMagnetBoxTreasure
  parent: NFBaseMagnetBox
  name: treasure chest
  description: A large storage container for holding treasure.
  components:
    - type: GenericVisualizer
      visuals:
        enum.StorageVisuals.Open:
          closed:
            True: { visible: false }
            False: { visible: true }
          open:
            True: { visible: true }
            False: { visible: false }
        enum.ToggleableVisuals.Enabled:
          enum.ToggleableVisuals.Layer:
            True: { visible: True }
            False: { visible: False }
    - type: Sprite
      layers:
        - state: treasurebox-closed
          map: [ closed ]
          visible: true
        - state: treasurebox-open
          map: [ open ]
          visible: false
        - state: controller
        - state: controller-on
          visible: false
          map: [ "enum.ToggleableVisuals.Layer" ]
          shader: unshaded
    - type: Storage
      whitelist:
        components:
          - NFTreasure
          - NFCoin
