# SPDX-FileCopyrightText: 2020 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2020 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2020 nuke <47336974+nuke-makes-games@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Galactic Chimp <GalacticChimpanzee@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Fishfish458 <47410468+Fishfish458@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Morber <14136326+Morb0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 fishfish458 <fishfish458>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 Jezithyr <6192499+Jezithyr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 gus <august.eymann@gmail.com>
# SPDX-FileCopyrightText: 2024 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Cojoke <83733158+Cojoke-dot@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 T-Stalker <43253663+DogZeroX@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@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: emergency flare
  parent: BaseItem
  id: Flare
  description: A flare that produces a very bright light for a short while. Point the flame away from yourself.
  components:
  - type: Tag
    tags:
    - Flare
    - Trash
  - type: SpaceGarbage
  - type: ExpendableLight
    glowDuration: 225
    fadeOutDuration: 15
    iconStateOn: flare_unlit
    iconStateSpent: flare_spent
    turnOnBehaviourID: turn_on
    fadeOutBehaviourID: fade_out
    litSound:
      path: /Audio/Items/Flare/flare_on.ogg
    loopedSound:
      path: /Audio/Items/Flare/flare_burn.ogg
      params:
        loop: true
        volume: -10
        maxDistance: 5
  - type: Sprite
    sprite: Objects/Misc/flare.rsi
    layers:
      - map: [ enum.ExpendableLightVisualLayers.Base ]
        state: flare_base
      - map: [ enum.ExpendableLightVisualLayers.Glow ]
        state: flare_burn
        color: "#FFFFFF"
        visible: false
        shader: unshaded
      - map: [ enum.ExpendableLightVisualLayers.Overlay ]
        state: flare_unlit
        color: "#FF0000"
  - type: Icon
    sprite: Objects/Misc/flare.rsi
    state: icon
  - type: Item
    sprite: Objects/Misc/flare.rsi
    heldPrefix: unlit
    size: Tiny
  - type: Appearance
  - type: PointLight
    enabled: false
    color: "#FF8080"
    radius: 1.0
    energy: 9.0
    netsync: false
  #- type: IgnitionSource Goobstation - causes a fuck ton of lag during high pop
  #  temperature: 1000
  - type: LightBehaviour
    behaviours:
      - !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
        id: turn_on
        maxDuration: 45.0
        startValue: 2.5
        endValue: 10.0
      - !type:RandomizeBehaviour # weaker flicker as it fades out
        id: fade_out
        interpolate: Nearest
        minDuration: 0.001
        maxDuration: 0.001
        startValue: 4.0
        endValue: 8.0
        property: Energy
        isLooped: true
      - !type:FadeBehaviour # fade out radius as it burns out
        id: fade_out
        maxDuration: 15.0
        startValue: 10.0
        endValue: 1.0
  - type: Extractable
    grindableSolutionName: flare
  - type: SolutionContainerManager
    solutions:
      flare:
        maxVol: 20
        reagents:
        # flare casing
        - ReagentId: Iron
          Quantity: 10
        # red phosphorus = red flare trust
        - ReagentId: Phosphorus
          Quantity: 3
        - ReagentId: Carbon
          Quantity: 1
        - ReagentId: Oxygen
          Quantity: 2
        # fuel or something
        - ReagentId: Charcoal
          Quantity: 2
        - ReagentId: Sulfur
          Quantity: 2