# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Booblesnoot42 <108703193+Booblesnoot42@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseStructure
  id: CryogenicSleepUnit
  name: cryogenic sleep unit
  description: A super-cooled container that keeps crewmates safe during space travel.
  components:
  - type: Sprite
    noRot: true
    sprite: Structures/cryostorage.rsi
    layers:
    - state: sleeper_0
      map: ["base"]
  - type: UserInterface
    interfaces:
      enum.CryostorageUIKey.Key:
        type: CryostorageBoundUserInterface
  - type: ActivatableUI
    key: enum.CryostorageUIKey.Key
  - type: AccessReader
    breakOnAccessBreaker: false
    access: [["Cryogenics"]]
  - type: InteractionOutline
  - type: Cryostorage
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.05"
        density: 190
        mask:
        - TableMask
  - type: DragInsertContainer
    containerId: storage
    entryDelay: 2
  - type: ExitContainerOnMove
    containerId: storage
  - type: PointLight
    color: Lime
    radius: 1.5
    energy: 0.5
    castShadows: false
  - type: ContainerContainer
    containers:
      storage: !type:ContainerSlot
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.CryostorageVisuals.Full:
        base:
          True: { state: sleeper_1 }
          False: { state: sleeper_0 }

# This one handles all spawns, latejoin and roundstart.
- type: entity
  parent: CryogenicSleepUnit
  id: CryogenicSleepUnitSpawner
  suffix: Spawner, Roundstart AllJobs
  components:
  - type: ContainerSpawnPoint
    containerId: storage

# This one only handles latejoin spawns.
- type: entity
  parent: CryogenicSleepUnit
  id: CryogenicSleepUnitSpawnerLateJoin
  suffix: Spawner, LateJoin
  components:
    - type: ContainerSpawnPoint
      containerId: storage
      spawnType: LateJoin