# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 Ripmorld <60119809+UKNOWH@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 BombasterDS <115770678+BombasterDS@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 pheenty <fedorlukin2006@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseItem
  abstract: true
  id: BasePayload
  components:
  - type: Appearance
  - type: Sprite
  - type: Tag
    tags:
    - Payload
  - type: Damageable
    damageContainer: Inorganic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  name: shrapnel payload # Goobstation - shrapnel payload
  parent: [ BasePayload, BaseSecurityContraband ]
  id: ShrapnelPayload
  components:
  - type: Sprite
    sprite: Objects/Devices/payload.rsi
    state: payload-explosive-armed
  # Goobstation - shrapnel payload
  #- type: Explosive
  #  explosionType: Default
  #  # same as the standard grenade, but those numbers were also just picked out of a hat.
  #  maxIntensity: 10
  #  intensitySlope: 3
  #  totalIntensity: 120 # about a ~4 tile radius
  #- type: ExplodeOnTrigger
  - type: Destructible
    thresholds:
  #  - trigger:
  #      !type:DamageTypeTrigger
  #      damageType: Heat
  #      damage: 25
  #   behaviors:
  #    - !type:ExplodeBehavior
  #  - trigger:
  #      !type:DamageTrigger
  #      damage: 50
  #    behaviors:
  #    - !type:DoActsBehavior
  #      acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 25
      behaviors:
      - !type:TriggerBehavior
  - type: DeleteOnTrigger
  - type: ContainerContainer
    containers:
      cluster-payload: !type:Container
  - type: ProjectileGrenade # Should be worse than the syndicate one
    fillPrototype: PelletClusterLethalWeak
    capacity: 20

- type: entity
  name: chemical payload
  parent: [ BasePayload, BaseMedicalScienceContraband ]
  id: ChemicalPayload
  description: A chemical payload. Has space to store two beakers. In combination with a trigger and a case, this can be used to initiate chemical reactions.
  components:
  - type: Sprite
    sprite: Objects/Devices/payload.rsi
    state: payload-empty
    layers:
    - state: payload-empty
      map: ["base"]
  - type: ChemicalPayload
    beakerSlotA: &slotDef
      whitelist:
        components:
        - FitsInDispenser
      swap: false
    beakerSlotB: *slotDef
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ChemicalPayloadVisuals.Slots:
        base:
          None: { state: payload-empty }
          Left: { state: payload-chemical-left }
          Right: { state: payload-chemical-right }
          Both: { state: payload-chemical-armed }
  - type: ItemSlots
  - type: ContainerContainer
    containers:
      BeakerSlotA: !type:ContainerSlot
      BeakerSlotB: !type:ContainerSlot
  - type: StaticPrice
    price: 60
  - type: PhysicalComposition #Goobstation - Recycle update
    materialComposition:
      Steel: 50
      Plastic: 75

- type: entity
  name: flash payload
  parent: [ BasePayload, BaseSecurityScienceCommandContraband ]
  id: FlashPayload
  description: A single-use flash payload.
  components:
    - type: Sprite
      sprite: Objects/Devices/payload.rsi
      state: payload-flash-armed
    - type: DeleteOnTrigger
    - type: FlashOnTrigger
      range: 6
    - type: Flashbang # Goobstation
    - type: EmitSoundOnTrigger
      sound:
        path: "/Audio/Effects/flash_bang.ogg"
    - type: PhysicalComposition #Goobstation - Recycle update
      materialComposition:
        Steel: 12
        Plastic: 25
        Glass: 12
