# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 BramvanZijp <56019239+BramvanZijp@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 K-Dynamic <20566341+K-Dynamic@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 PunishedJoe <PunishedJoeseph@proton.me>
# SPDX-FileCopyrightText: 2025 SX-7 <92227810+SX-7@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 pheenty <fedorlukin2006@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  abstract: true
  parent: BaseItem
  id: ProjectileGrenadeBase
  components:
  - type: Appearance
  - type: Damageable
    damageContainer: Inorganic
  - type: DeleteOnTrigger
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:TriggerBehavior
  - type: ContainerContainer
    containers:
      cluster-payload: !type:Container
  - type: ProjectileGrenade
  - type: AnimationPlayer
  - type: GenericVisualizer
    visuals:
      enum.Trigger.TriggerVisuals.VisualState:
        enum.ConstructionVisuals.Layer:
          Primed: { state: primed }
          Unprimed: { state: icon }
  - type: Tag
    tags:
    - HandGrenade
  - type: Fixtures
    fixtures:
      fix1:
        shape: !type:PhysShapeCircle
          radius: 0.2
        density: 20 # derived from base_item
        mask:
        - ItemMask
        restitution: 0.3
        friction: 0.2

- type: entity
  parent: [ProjectileGrenadeBase, BaseSecurityContraband]
  id: GrenadeStinger
  name: stinger grenade
  description: Nothing to see here, please disperse.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/stingergrenade.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ProjectileGrenade
    fillPrototype: PelletClusterRubber
    capacity: 30
  - type: EmitSoundOnTrigger
    sound:
      path: "/Audio/Effects/flash_bang.ogg"
  - type: SpawnOnTrigger
    proto: GrenadeFlashEffect
  - type: OnUseTimerTrigger
    initialBeepDelay: 0
    beepInterval: 2
    delay: 3.5
  - type: TimerTriggerVisuals
    primingSound:
      path: /Audio/Effects/countdown.ogg

- type: entity
  parent: [ProjectileGrenadeBase, BaseSyndicateContraband]
  id: GrenadeIncendiary
  name: incendiary grenade
  description: Guaranteed to light up the mood.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/pyrogrenade.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ProjectileGrenade
    fillPrototype: PelletClusterIncendiary
    capacity: 30
  - type: OnUseTimerTrigger
    beepSound:
      path: "/Audio/Effects/beep1.ogg"
      params:
        volume: 5
    initialBeepDelay: 0
    beepInterval: 2
    delay: 3.5
  - type: EmitSoundOnTrigger
    sound:
      path: "/Audio/Weapons/Guns/Gunshots/batrifle.ogg"
  - type: StaticPrice
    price: 1500

- type: entity
  parent: [ProjectileGrenadeBase, BaseSyndicateContraband]
  id: GrenadeShrapnel
  name: shrapnel grenade
  description: Releases a deadly spray of shrapnel that causes severe bleeding.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/shrapnelgrenade.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ProjectileGrenade
    fillPrototype: PelletClusterLethal
    capacity: 30
  - type: OnUseTimerTrigger
    beepSound:
      path: "/Audio/Effects/beep1.ogg"
      params:
        volume: 5
    initialBeepDelay: 0
    beepInterval: 2
    delay: 3.5
  - type: EmitSoundOnTrigger
    sound:
      path: "/Audio/Weapons/Guns/Gunshots/batrifle.ogg"
  - type: StaticPrice
    price: 1500
