- type: entity # Starts fuse after taking 10 damage.
  parent: BaseItem
  abstract: true
  id: GrenadeBase
  components:
  - type: Sprite
    sprite: Objects/Weapons/Grenades/grenade.rsi
    layers:
    - state: icon
      map: ["enum.TriggerVisualLayers.Base"]
  - type: Item
    size: Small
  - type: Clothing
    quickEquip: false
    slots:
    - Belt
  - type: Damageable
    damageContainer: Inorganic
  - type: Appearance
  - type: AnimationPlayer
  - 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 # Starts fuse after taking 10 damage.
  parent: GrenadeBase
  abstract: true
  id: TimerGrenadeBase
  components:
  - type: TriggerOnUse
  - type: TimerTrigger
    delay: 3
  - type: Destructible
    thresholds:
    - trigger: # Start fuse
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:TimerStartBehavior
  - type: GenericVisualizer
    visuals:
      enum.Trigger.TriggerVisuals.VisualState:
        enum.ConstructionVisuals.Layer:
          Primed: { state: primed }
          Unprimed: { state: icon }

- type: entity # Starts fuse after taking 10 damage.
  parent: GrenadeBase
  abstract: true
  id: ImpactGrenadeBase
  components:
  - type: TriggerOnLand
  - type: LandAtCursor
  - type: Destructible
    thresholds:
    - trigger: # immediately explode
        !type:DamageTrigger
        damage: 45
      behaviors:
      - !type:TriggerBehavior
        keyOut: timer
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity # Starts fuse after taking 10 damage, instantly detonates/activates after taking 45 damage.
  abstract: true
  id: VolatileGrenadeBase
  components:
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:TimerStartBehavior
    - trigger: # immediately explode
        !type:DamageTrigger
        damage: 45
      behaviors:
      - !type:TriggerBehavior
        keyOut: timer
      - !type:DoActsBehavior
        acts: ["Destruction"]

- type: entity # Starts fuse after taking 10 damage, is destroyed without activating/detonating after taking 45 damage.
  abstract: true
  id: FragileGrenadeBase
  components:
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:TimerStartBehavior
    - trigger: # Disappear
        !type:DamageTrigger
        damage: 45
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
