# SPDX-FileCopyrightText: 2020 Remie Richards <remierichards@gmail.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Galactic Chimp <GalacticChimpanzee@gmail.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Michael Phillips <1194692+MeltedPixel@users.noreply.github.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 <zddm@outlook.es>
# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jessica M <jessica@jessicamaybe.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Profane McBane <profanedbane+github@gmail.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Will Robson <WPRobson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 keronshb <54602815+keronshb@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Derby <Derby@ss14>
# SPDX-FileCopyrightText: 2023 DerbyX <50932435+DerbyX@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Admiral-Obvious-001 <89495925+Admiral-Obvious-001@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ubaser <134914314+UbaserB@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 VMSolidus <evilexecutive@gmail.com>
# SPDX-FileCopyrightText: 2024 Verm <32827189+Vermidia@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 shamp <140359015+shampunj@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 BombasterDS <deniskaporoshok@gmail.com>
# SPDX-FileCopyrightText: 2025 BombasterDS2 <shvalovdenis.workmail@gmail.com>
# SPDX-FileCopyrightText: 2025 Ignaz "Ian" Kraft <ignaz.k@live.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BodyBag
  parent: BaseDeployFoldable
  name: body bag
  description: A plastic bag designed for the storage and transportation of cadavers to stop body decomposition.
  components:
  - type: Item
    size: Small
    heldPrefix: bag
  - type: Sprite
    drawdepth: SmallObjects # I guess body bags need appear above a coroner's table?
    sprite: Objects/Specific/Medical/Morgue/bodybags.rsi
    layers:
    - state: bag
      map: ["unfoldedLayer", "enum.StorageVisualLayers.Base"]
    - state: bag_folded
      map: ["foldedLayer"]
      visible: false
    - state: open_overlay
      map: ["enum.StorageVisualLayers.Door"]
    - state: paper
      map: ["enum.PaperLabelVisuals.Layer"]
  - type: Icon
    sprite: Objects/Specific/Medical/Morgue/bodybags.rsi
    state: bag
  - type: Tag
    tags:
    - BodyBag
  - type: Clickable
  - type: InteractionOutline
  - type: MovedByPressure
  - type: Physics
    bodyType: Dynamic
  - type: Transform
    noRot: true
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.25,-0.4,0.25,0.1"
        density: 20
        mask:
        - ItemMask
        layer:
        - TabletopMachineLayer #Goobstation - Damageable body bag
  - type: EntityStorage
    capacity: 1
    isCollidableWhenOpen: true
    # Goobstation - immersive sim, everything can go in
    #whitelist: # Use a tag whitelist rather than filtering for PerishableComponent to avoid chefs using body bags for food preservation
    #  tags:
    #    - VimPilot # Pets
    #    - CanPilot # People
    closeSound:
      path: /Audio/Misc/zip.ogg
    openSound:
      path: /Audio/Misc/zip.ogg
  - type: EntityStorageLayingDownOverride
  - type: PaperLabel
    labelSlot:
      insertVerbText: comp-paper-label-insert
      ejectVerbText: comp-paper-label-eject
      whitelist:
        components:
        - Paper
      blacklist:
        tags:
        - Book
  - type: Appearance
  - type: EntityStorageVisuals
    stateDoorOpen: open_overlay
  - type: GenericVisualizer
    visuals:
      enum.PaperLabelVisuals.HasLabel:
        enum.PaperLabelVisuals.Layer:
          True: {visible: true}
          False: {visible: false}
      enum.PaperLabelVisuals.LabelType:
        enum.PaperLabelVisuals.Layer:
          Paper: { state: paper }
          Bounty: { state: bounty }
          CaptainsPaper: { state: captains_paper }
          Invoice: { state: invoice }
      enum.FoldedVisuals.State:
        foldedLayer:
          True: {visible: true}
          False: {visible: false}
        unfoldedLayer:
          True: {visible: false}
          False: {visible: true}
  - type: Pullable
  - type: AntiRottingContainer
  - type: ItemSlots
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
      paper_label: !type:ContainerSlot
  - type: StaticPrice
    price: 50
  - type: Damageable #Goobstation - Damageable body bag
    damageContainer: StructuralInorganic
    damageModifierSet: Web
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Effects/poster_broken.ogg

- type: entity
  id: BodyBagFolded
  name: body bag
  description: A plastic bag designed for the storage and transportation of cadavers to stop body decomposition.
  parent: BodyBag
  suffix: folded
  components:
  - type: Foldable
    folded: true
#  - type: BodyBagItem #TODO: we need some kind of generic placable, like thus:
# - type: Placeable
#   prototype: someId
#   snap: Center

- type: entity
  parent: BaseItem
  id: Ash
  name: ash
  description: This used to be something, but now it's not.
  components:
  - type: Item
    size: Tiny
  - type: Sprite
    sprite: Objects/Materials/materials.rsi
    state: ash
  - type: Tag
    tags:
    - Trash
    - Ash # Goobstation
  - type: SolutionContainerManager
    solutions:
      food:
        maxVol: 50
        reagents:
        - ReagentId: Ash
          Quantity: 10
  - type: SolutionSpiker
    sourceSolution: food
    ignoreEmpty: true
  - type: ScoopableSolution
    solution: food
  - type: Extractable
    grindableSolutionName: food
  - type: SupermatterImmune # Goobstation

- type: entity
  parent: Ash
  id: Ectoplasm
  name: ectoplasm
  description: Much less deadly in this form.
  components:
    - type: Sprite
      sprite: Mobs/Ghosts/revenant.rsi
      state: ectoplasm
    - type: Tag
      tags:
        - Trash
        - Ectoplasm
    - type: SolutionContainerManager
      solutions:
        food:
          maxVol: 50
          reagents:
            - ReagentId: Ash
              Quantity: 25
            - ReagentId: Necrosol
              Quantity: 25
    - type: GuideHelp
      guides:
      - MinorAntagonists
