# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Sir Winters <7543955+Owai-Seek@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Alzore <140123969+Blackern5000@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2024 Nairod <110078045+Nairodian@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 PJBot <pieterjan.briers+bot@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 Simon <63975668+Simyon264@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Spessmann <156740760+Spessmann@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 lunarcomets <140772713+lunarcomets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Ted Lukin <66275205+pheenty@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseDefibrillator
  parent: BaseItem
  name: defibrillator
  description: CLEAR! Zzzzat!
  abstract: true
  components:
    - type: Sprite
      sprite: Objects/Specific/Medical/defib.rsi
      layers:
        - state: icon
        - state: screen
          map: [ "enum.ToggleableVisuals.Layer" ]
          visible: false
          shader: unshaded
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.ToggleableVisuals.Enabled:
          enum.ToggleableVisuals.Layer:
            True: { visible: true }
            False: { visible: false }
    - type: Item
      size: Large
    - type: Speech
      speechVerb: Robotic
    - type: ItemToggle
      soundActivate:
        path: /Audio/Items/Defib/defib_safety_on.ogg
      soundDeactivate:
        path: /Audio/Items/Defib/defib_safety_off.ogg
    - type: Defibrillator
      zapHeal:
        types:
          Asphyxiation: -40
    - type: DoAfter
    - type: UseDelay
    - type: StaticPrice
      price: 30
    - type: GuideHelp
      guides:
      - MedicalDoctor
    - type: LanguageSpeaker # Einstein Engines - Language
    - type: LanguageKnowledge # Einstein Engines - Language
      speaks:
      - TauCetiBasic
      understands:
      - TauCetiBasic

- type: entity
  id: Defibrillator
  parent: [ BaseDefibrillator, PowerCellSlotMediumItem ]
  components:
  - type: MultiHandedItem
  - type: ToggleCellDraw
  - type: PowerCellDraw
    useCharge: 100

- type: entity
  id: DefibrillatorEmpty
  parent: Defibrillator
  suffix: Empty
  components:
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default

- type: entity
  id: DefibrillatorOneHandedUnpowered
  parent: BaseDefibrillator
  suffix: One-Handed, Always Powered

- type: entity
  id: DefibrillatorCompact # This should be a research item at some point # Goobstation - it is.
  parent: [ BaseDefibrillator, PowerCellSlotMediumItem ]
  name: compact defibrillator
  description: Now in fun size!
  components:
  - type: Sprite
    sprite: Objects/Specific/Medical/defibsmall.rsi
    layers:
      - state: icon
      - state: screen
        map: [ "enum.ToggleableVisuals.Layer" ]
        visible: false
        shader: unshaded
      - state: ready
        map: ["enum.PowerDeviceVisualLayers.Powered"]
        shader: unshaded
  - type: Item
    size: Normal
  - type: ToggleCellDraw
  - type: PowerCellDraw
    useCharge: 100
  - type: Defibrillator
    zapHeal:
      types:
        Asphyxiation: -40
    doAfterDuration: 3 # Goob value
  - type: DoAfter
  - type: UseDelay

- type: entity
  id: DefibrillatorSyndicate
  parent: [ DefibrillatorCompact, BaseSyndicateContraband ]
  name: interdyne defibrillator
  description: Doubles as a self-defense weapon against war-crime inclined tiders.
  components:
  - type: Sprite
    sprite: Objects/Specific/Medical/defibsyndi.rsi
    layers:
      - state: icon
      - state: screen
        map: [ "enum.ToggleableVisuals.Layer" ]
        visible: false
        shader: unshaded
      - state: ready
        map: ["enum.PowerDeviceVisualLayers.Powered"]
        shader: unshaded
  - type: MeleeWeapon
    damage:
      types:
        Blunt: 8
  - type: ItemToggleMeleeWeapon
    activatedSoundOnHit:
      path: /Audio/Items/Defib/defib_zap.ogg
      params:
        variation: 0.250
    activatedSoundOnHitNoDamage:
      path: /Audio/Items/Defib/defib_zap.ogg
      params:
        variation: 0.250
        volume: -10
    activatedDamage:
      types:
        Blunt: 8
        Shock: 16
