# SPDX-FileCopyrightText: 2022 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 keronshb <54602815+keronshb@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 MisterMecky <mrmecky@hotmail.com>
# SPDX-FileCopyrightText: 2023 PeterFuto <futo.petr@gmail.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Theomund <34360334+Theomund@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 crazybrain23 <44417085+crazybrain23@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Fahasor <70820551+Fahasor@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 Scribbles0 <91828755+Scribbles0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@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: BaseBigBox
  name: cardboard box #it's still just a box
  description: Huh? Just a box...
  abstract: true
  components:
    - type: Transform
      noRot: true
    - type: Clickable
    - type: Physics
      bodyType: KinematicController
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.4,-0.4,0.4,0.4"
          density: 100
          mask:
            - MobMask
          layer:
            - MobLayer
          hard: true
    - type: Pullable
    - type: CardboardBox
      effectSound: /Audio/Effects/chime.ogg
    - type: InputMover
    - type: EntityStorage
      isCollidableWhenOpen: false
      openOnMove: false
      airtight: false
      capacity: 5 #5 entity capacity to fit all of your friends (or teammates on your nuclear operation without reinforcements).
    - type: ContainerContainer
      containers:
        entity_storage: !type:Container
    - type: Damageable
      damageContainer: Box
    - type: Sprite
      noRot: true
      sprite: Structures/Storage/closet.rsi
      layers:
      - state: cardboard
        map: ["enum.StorageVisualLayers.Base"]
      - state: cardboard_open
        map: ["enum.StorageVisualLayers.Door"]
    - type: Appearance
    - type: EntityStorageVisuals
      stateBaseClosed: cardboard
      stateDoorOpen: cardboard_open
    - type: Tag
      tags:
        - DoorBumpOpener
    - type: Construction
      graph: BaseBigBox
      node: basebigbox
      containers:
        - entity_storage

- type: entity
  id: StealthBox
  suffix: stealth
  parent: BaseBigBox
  description: Kept ya waiting, huh?
  components:
    - type: Damageable
      damageModifierSet: FlimsyMetallic #Syndicate boxes should have a bit of protection
    - type: CardboardBox
      quiet: true
    - type: Stealth
      hadOutline: true
    - type: StealthOnMove
      passiveVisibilityRate: -0.37
      movementVisibilityRate: 0.20

- type: entity
  id: BigBox
  parent: BaseBigBox
  components:
  - type: InteractionOutline
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 15
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]


#For admin spawning only
- type: entity
  id: GhostBox
  parent: StealthBox
  suffix: ""
  name: ghost box
  description: Beware!
  components:
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.4,-0.4,0.4,0.4"
          mask:
            - MobMask
          layer:
            - SlipLayer
          hard: false #It's a ghostly box, it can go through walls
    - type: EntityStorage
      isCollidableWhenOpen: false
      openOnMove: false
      airtight: false