# SPDX-FileCopyrightText: 2020 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2020 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2020 SoulSloth <67545203+SoulSloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Ygg01 <daniel.fath7@gmail.com>
# SPDX-FileCopyrightText: 2020 chairbender <kwhipke1@gmail.com>
# SPDX-FileCopyrightText: 2021 Pancake <Pangogie@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Francesco <frafonia@gmail.com>
# SPDX-FileCopyrightText: 2022 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2022 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 ninruB <38016303+asperger-sind@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Cody ~ Aexxie <125095677+Aexxie@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2023 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 EmoGarbage404 <retron404@gmail.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  name: lantern
  parent: BaseItem
  id: Lantern
  description: The holy light guides the way.
  components:
    - type: HandheldLight
      addPrefix: true
      blinkingBehaviourId: blinking
      radiatingBehaviourId: radiating
    - type: LightBehaviour
      behaviours:
      - !type:FadeBehaviour
        id: radiating
        maxDuration: 2.0
        startValue: 3.0
        endValue: 2.0
        isLooped: true
        reverseWhenFinished: true
      - !type:PulseBehaviour
        id: blinking
        interpolate: Nearest
        maxDuration: 1.0
        startValue: 0.1
        endValue: 2.0
        isLooped: true
    - type: Sprite
      sprite: Objects/Tools/lantern.rsi
      layers:
      - state: lantern
      - state: lantern-on
        shader: unshaded
        visible: false
        map: [ "light" ]
    - type: Item
      sprite: Objects/Tools/lantern.rsi
      heldPrefix: off
    - type: UseDelay
      delay: 1
    - type: PointLight
      enabled: false
      radius: 3
      energy: 2.5
      color: "#FFC458"
      netsync: false
    - type: Appearance
    - type: ToggleableVisuals
      spriteLayer: light
    - type: ItemTogglePointLight
    - type: PowerCellSlot
      cellSlotId: cell_slot
    - type: ItemSlots
      slots:
        cell_slot:
          name: power-cell-slot-component-slot-name-default
          startingItem: PowerCellMedium
    - type: ContainerContainer
      containers:
        cell_slot: !type:ContainerSlot {}
    - type: StealTarget
      stealGroup: LAMP
    - type: Clothing
      sprite: Objects/Tools/lantern.rsi
      equippedPrefix: off
      quickEquip: false
      slots:
      - Belt
    - type: Tag
      tags:
      - Flashlight

- type: entity
  parent: Lantern
  id: LanternFlash
  suffix: Flash
  components:
    - type: Sprite
      sprite: Objects/Tools/lantern.rsi
      layers:
      - state: lantern
        map: [ "enum.FlashVisualLayers.BaseLayer" ]
      - state: lantern-on
        shader: unshaded
        visible: false
        map: [ "light" ]
      - state: flashing
        map: [ "enum.FlashVisualLayers.LightLayer" ]
        visible: false
    - type: PointLight
      radius: 5
      energy: 10
    - type: Flash
      flashOnMelee: false
      flashOnUse: false
    - type: LimitedCharges
      maxCharges: 15
    - type: MeleeWeapon
      damage:
        types:
          Blunt: 0 # melee weapon to allow flashing individual targets
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.FlashVisuals.Burnt:
          enum.FlashVisualLayers.BaseLayer:
            True: {state: burnt}
        enum.FlashVisuals.Flashing:
          enum.FlashVisualLayers.LightLayer:
            True: {visible: true}
            False: {visible: false}