# SPDX-FileCopyrightText: 2023 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Ilya246 <ilyukarno@gmail.com>
# SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@gmail.com>
# SPDX-FileCopyrightText: 2025 Will-Oliver-Br <164823659+Will-Oliver-Br@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseStructureDynamic
  id: SmartFridge
  name: SmartFridge
  description: A refrigerated storage unit for keeping items cold and fresh.
  categories: [ HideSpawnMenu ] # DeltaV - apparently we can't migrate abstract/disabled prototypes
  components:
  - type: StationAiWhitelist
  - type: Vocalizer
    hideChat: true
  - type: VocalizerRequiresPower
  - type: DatasetVocalizer
    dataset: SmartFridgeAds
  - type: Speech
  - type: Appearance
  - type: Sprite
    sprite: Structures/Machines/smartfridge.rsi
    snapCardinals: true
    layers:
    - state: smartfridge
      map: ["enum.StorageVisualLayers.Base"]
    - state: smartfridge_door
      map: ["enum.StorageVisualLayers.Door"]
      shader: unshaded
  - type: EntityStorageVisuals
    stateBaseClosed: smartfridge
    stateDoorOpen: smartfridge_open
    stateDoorClosed: smartfridge_door
  - type: PointLight
    radius: 1.5
    energy: 1.6
    color: "#9dc5c9"
  - type: EntityStorage
    isCollidableWhenOpen: true
    closeSound:
      path: /Audio/Machines/windoor_open.ogg
      params:
        volume: -3
    openSound:
      path: /Audio/Machines/windoor_open.ogg
      params:
        volume: -3
  - type: ContainerContainer
    containers:
      entity_storage: !type:Container
  - type: UseDelay
    delay: 1
  - type: AntiRottingContainer
  - type: ResistLocker
  - type: Physics
    bodyType: Static
  - type: Transform
    noRot: true
    anchored: True
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        mask:
        - MachineMask
        layer:
        - MachineLayer
        density: 200
  - type: Anchorable
    delay: 2
  - type: InteractionOutline
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: ["Breakage"]
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: DamageOnHighSpeedImpact
    damage:
      types:
        Blunt: 5
    soundHit:
      collection: MetalThud
