# SPDX-FileCopyrightText: 2020 Peter Wedder <burneddi@gmail.com>
# SPDX-FileCopyrightText: 2021 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Galactic Chimp <GalacticChimpanzee@gmail.com>
# SPDX-FileCopyrightText: 2021 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Paul <ritter.paul1+git@googlemail.com>
# SPDX-FileCopyrightText: 2021 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Profane McBane <profanedbane+github@gmail.com>
# SPDX-FileCopyrightText: 2023 /ʊniɹɑː/ <onoira@psiko.zone>
# SPDX-FileCopyrightText: 2023 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Jeff <velcroboy333@hotmail.com>
# SPDX-FileCopyrightText: 2023 Kit0vras <123590995+Kit0vras@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Moomoobeef <62638182+Moomoobeef@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Velcroboy <107660393+ChilbroBaggins@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@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
  id: Bookshelf
  parent: BaseStructure
  name: "bookshelf"
  description: Mostly filled with books.
  components:
  - type: Sprite
    sprite: Structures/Furniture/bookshelf.rsi
    snapCardinals: true
    layers:
      - state: base
      - state: book-0
      - map: ["enum.StorageFillLayers.Fill"]
  - type: Appearance
  - type: StorageFillVisualizer
    maxFillLevels: 21
    fillBaseName: book
  - type: Damageable
    damageModifierSet: Wood
    damageContainer: StructuralInorganic
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroyHeavy
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 30
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: WoodDestroyHeavy
      - !type:SpawnEntitiesBehavior
        spawn:
          MaterialWoodPlank:
            min: 2
            max: 3
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Tag
    tags:
    - Structure
    - Wooden
  - type: Transform
    anchored: true
    noRot: true
  - type: Physics
    bodyType: Static
  - type: Anchorable
  - type: Pullable
  - type: Occluder
  - type: Storage
    grid:
    - 0,0,9,3
    maxItemSize: Normal
    whitelist:
      tags:
        - Document
        - Folder
        - Write
        - Book
        - Spellbook
  - type: UserInterface
    interfaces:
      enum.StorageUiKey.Key:
        type: StorageBoundUserInterface
  - type: InteractionOutline
  - type: ContainerContainer
    containers:
      storagebase: !type:Container
  - type: Construction
    graph: Bookshelf
    node: bookshelf
  - type: BlockWeather