# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Adeinitas <147965189+adeinitas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 KISS <59531932+YuriyKiss@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Timemaster99 <57200767+Timemaster99@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 VMSolidus <evilexecutive@gmail.com>
# SPDX-FileCopyrightText: 2024 Yurii Kis <yurii.kis@smartteksas.com>
# SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseLandMine
  abstract: true
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: ItemToggle
    soundActivate:
      path: /Audio/Weapons/click.ogg
      params:
        maxDistance: 1
  - type: Pullable
  - type: MovedByPressure
  - type: Physics
    bodyType: Static
    fixedRotation: true
  - type: Fixtures
    fixtures:
      slips:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2,-0.2,0.2,0.2"
        hard: false
        layer:
          - LowImpassable
  - type: Sprite
    drawdepth: Items
    sprite: Objects/Misc/landmine.rsi
    layers:
    - state: landmine
    - state: landmine-unshaded
      shader: unshaded
      map: [ "enum.ToggleableVisuals.Layer" ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ToggleableVisuals.Enabled:
        enum.ToggleableVisuals.Layer:
          True: {visible: true}
          False: {visible: false}
  - type: Damageable
    damageContainer: Inorganic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 50
      behaviors:
      - !type:TriggerBehavior
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: LandMine
    sound:
        path: /Audio/Effects/beep_landmine.ogg
        params:
            maxDistance: 10
  - type: Armable
  - type: StepTrigger
    requiredTriggeredSpeed: 0
    stepOn: true
    triggerGroups: # Goobstation
      types:
      - Landmine

- type: entity
  id: LandMineKickUnarmed
  name: kick mine
  parent: BaseLandMine
  components:
  - type: GhostKickUserOnTrigger
  - type: DeleteOnTrigger

- type: entity
  id: LandMineKick
  suffix: armed
  parent: LandMineKickUnarmed
  components:
  - type: ItemToggle
    activated: true
    onActivate: false
  - type: Armable

- type: entity
  name: modular mine
  description: This bad boy could be packing any number of dangers. Or a bike horn.
  parent: BaseLandMine
  id: LandMineModularUnarmed
  components:
  - type: PayloadCase
  - type: Construction
    graph: ModularMineGraph
    node: emptyCase

- type: entity
  id: LandMineModular
  suffix: armed
  parent: LandMineModularUnarmed
  components:
  - type: ItemToggle
    activated: true
    onActivate: false
  - type: Armable

- type: entity
  name: explosive mine
  parent: BaseLandMine
  id: LandMineExplosiveUnarmed
  components:
  - type: ExplodeOnTrigger
  - type: Explosive
    explosionType: Default
    maxIntensity: 10
    intensitySlope: 3
    totalIntensity: 120 # about a ~4 tile radius
    canCreateVacuum: false

- type: entity
  suffix: armed
  parent: LandMineExplosiveUnarmed
  id: LandMineExplosive
  components:
  - type: ItemToggle
    activated: true
    onActivate: false
  - type: Armable
