# ScatteringGrenade is intended for grenades that spawn entities, especially those with timers
- type: entity
  abstract: true
  parent: GrenadeBase
  id: ScatteringGrenadeBase
  components:
  - type: ContainerContainer
    containers:
      cluster-payload: !type:Container
  - type: ScatteringGrenade

- type: entity
  parent: [FragileGrenadeBase, ScatteringGrenadeBase, TimerGrenadeBase, BaseSecurityContraband]
  id: ClusterBang
  name: clusterbang
  description: Can be used only with flashbangs. Explodes several times.
  components:
  - type: ScatteringGrenade
    whitelist:
      tags:
      - GrenadeFlashBang
    distance: 6
    velocity: 6
  - type: ClusterGrenadeVisuals
    state: base
  - type: Sprite
    sprite: Objects/Weapons/Grenades/clusterbang.rsi
    state: base-0

- type: entity
  parent: ClusterBang
  id: ClusterBangFull
  name: clusterbang
  description: Launches three flashbangs after the timer runs out.
  suffix: Full
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/clusterbang.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ScatteringGrenade
    whitelist:
      tags:
      - GrenadeFlashBang
    fillPrototype: GrenadeFlashBang
    distance: 6
    velocity: 6
  - type: TimerTriggerVisuals
    primingSound:
      path: /Audio/Effects/countdown.ogg
  - type: GenericVisualizer
    visuals:
      enum.Trigger.TriggerVisuals.VisualState:
        enum.ConstructionVisuals.Layer:
          Primed: { state: primed }
          Unprimed: { state: icon }
  - type: EmitSoundOnTrigger
    keysIn:
    - timer
    sound:
      path: "/Audio/Machines/door_lock_off.ogg"
    positional: true

- type: entity
  parent: [VolatileGrenadeBase, ScatteringGrenadeBase, TimerGrenadeBase, BaseSyndicateContraband]
  id: ClusterGrenade
  name: clustergrenade
  description: Why use one grenade when you can use three at once!
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/clusterbomb.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ScatteringGrenade
    fillPrototype: ExGrenade
    distance: 4
  - type: TimerTrigger
    beepSound:
      path: "/Audio/Effects/beep1.ogg"
      params:
        volume: 5
    initialBeepDelay: 0
    beepInterval: 0.5
  - type: EmitSoundOnTrigger
    keysIn:
    - timer
    sound:
      path: "/Audio/Machines/door_lock_off.ogg"
    positional: true
  - type: StaticPrice
    price: 2500

- type: entity
  parent: [FragileGrenadeBase, ScatteringGrenadeBase, ImpactGrenadeBase, BaseSyndicateContraband]
  id: ClusterBananaPeel
  name: cluster banana peel
  description: Splits into 6 explosive banana peels after throwing, guaranteed fun!
  components:
  - type: Sprite
    sprite: Objects/Specific/Hydroponics/banana.rsi
    layers:
    - state: produce
  - type: ScatteringGrenade
    fillPrototype: TrashBananaPeelExplosive
    capacity: 6
    delayBeforeTriggerContents: 20
    triggerKey: trigger
  - type: LandAtCursor
  - type: DamageOnLand
    damage:
      types:
        Blunt: 10
  - type: EmitSoundOnTrigger
    keysIn:
    - timer
    sound:
      path: "/Audio/Items/bikehorn.ogg"
    positional: true

- type: entity
  parent: [SoapSyndie, ScatteringGrenadeBase, ImpactGrenadeBase, BaseSyndicateContraband]
  id: SlipocalypseClusterSoap
  name: slipocalypse clustersoap
  description: Spreads small pieces of syndicate soap over an area upon landing on the floor.
  components:
  - type: Sprite
    sprite: Objects/Specific/Janitorial/soap.rsi
    layers:
    - state: syndie-4
  - type: ScatteringGrenade
    triggerKey: trigger
    fillPrototype: SoapletSyndie
    capacity: 30
    delayBeforeTriggerContents: 60
    randomDistance: true
    randomThrowDistanceMax: 3
  - type: LandAtCursor
  - type: DamageOnLand
    damage:
      types:
        Blunt: 10
  - type: EmitSoundOnTrigger
    keysIn:
    - timer
    sound:
      path: "/Audio/Effects/flash_bang.ogg"
    positional: true
  - type: StaticPrice
    price: 1000

- type: entity
  parent: [FragileGrenadeBase, ScatteringGrenadeBase, TimerGrenadeBase]
  id: GrenadeFoamDart
  name: foam dart grenade
  description: Releases a bothersome spray of foam darts that cause severe welching.
  components:
  - type: Sprite
    sprite: Objects/Fun/Foam/foam_grenade.rsi
    layers:
    - state: icon
      map: ["Base"]
    - state: primed
      map: ["enum.TriggerVisualLayers.Base"]
  - type: ScatteringGrenade
    fillPrototype: BulletFoam
    capacity: 30
    velocity: 30
  - type: TimerTrigger
    beepSound:
      path: "/Audio/Effects/beep1.ogg"
      params:
        volume: 5
    initialBeepDelay: 0
    beepInterval: 2
  - type: EmitSoundOnTrigger
    keysIn:
    - timer
    sound:
      path: "/Audio/Weapons/Guns/Gunshots/batrifle.ogg"
    positional: true
