# 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: 2022 Jessica M <jessica@jessicamaybe.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.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 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2022 rolfero <45628623+rolfero@users.noreply.github.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 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deepdarkdepths <155149356+deepdarkdepths@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  name: green glowstick
  parent: BaseItem
  id: GlowstickBase
  description: Useful for raves and emergencies.
  components:
    - type: SpaceGarbage
    - type: ExpendableLight
      glowDuration: 900 # time in seconds
      glowColorLit: "#00FF00"
      fadeOutDuration: 300
      turnOnBehaviourID: turn_on
      fadeOutBehaviourID: fade_out
      iconStateLit: glowstick_lit
      iconStateSpent: glowstick_unlit
      litSound:
        path: /Audio/Items/Handcuffs/rope_breakout.ogg
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
      - map: [ enum.ExpendableLightVisualLayers.Base ]
        state: glowstick_base
      - map: [ enum.ExpendableLightVisualLayers.Glow ]
        state: glowstick_glow
        visible: false
        shader: unshaded
      - map: [ enum.ExpendableLightVisualLayers.Overlay ]
        state: glowstick_unlit
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: Appearance
    - type: PointLight
      enabled: false
      color: "#00FF00"
      radius: 5
      energy: 0
      netsync: false
    - type: LightBehaviour
      behaviours:
        - !type:FadeBehaviour # slowly fade in once activated
          id: turn_on
          interpolate: Linear
          maxDuration: 10.0
          startValue: 0.0
          endValue: 3.0
          property: Energy
        - !type:FadeBehaviour # fade out energy as it burns out
          id: fade_out
          interpolate: Linear
          maxDuration: 10 # 300.0
          startValue: 3.0
          endValue: 0.2
          property: Energy
        - !type:FadeBehaviour # fade out radius as it burns out
          id: fade_out
          interpolate: Linear
          maxDuration: 10 # 300.0
          startValue: 5.0
          endValue: 1.5
    - type: Tag
      tags:
      - Trash

- type: entity
  name: red glowstick
  parent: GlowstickBase
  id: GlowstickRed
  components:
    - type: ExpendableLight
      spentName: expendable-light-spent-red-glowstick-name
      glowColorLit: "#FF0000"
    - type: PointLight
      color: "#FF0000"

- type: entity
  name: purple glowstick
  parent: GlowstickBase
  id: GlowstickPurple
  components:
    - type: ExpendableLight
      spentName: expendable-light-spent-purple-glowstick-name
      glowColorLit: "#FF00FF"
    - type: PointLight
      color: "#FF00FF"

- type: entity
  name: yellow glowstick
  parent: GlowstickBase
  id: GlowstickYellow
  components:
    - type: ExpendableLight
      spentName: expendable-light-spent-yellow-glowstick-name
      glowColorLit: "#FFFF00"
    - type: PointLight
      color: "#FFFF00"

- type: entity
  name: blue glowstick
  parent: GlowstickBase
  id: GlowstickBlue
  components:
    - type: ExpendableLight
      spentName: expendable-light-spent-blue-glowstick-name
      glowColorLit: "#0000FF"
    - type: PointLight
      color: "#0000FF"

# ----------------------------------------------------------------------------
# THE FOLLOWING ARE ALL DUMMY ENTITIES USED TO TEST THE LIGHT BEHAVIOUR SYSTEM
# ----------------------------------------------------------------------------
- type: entity
  name: light pulse test
  parent: BaseItem
  id: LightBehaviourTest1
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: true
      color: "#FF0000"
      radius: 5
    - type: LightBehaviour
      behaviours:
        - !type:PulseBehaviour
          interpolate: Cubic
          maxDuration: 10.0
          startValue: 1.0
          endValue: 7.0
          isLooped: true
          property: Energy
          enabled: true

- type: entity
  name: color cycle test
  parent: BaseItem
  id: LightBehaviourTest2
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: true
      color: "#FF0000"
      radius: 5
    - type: LightBehaviour
      behaviours:
        - !type:ColorCycleBehaviour
          interpolate: Nearest
          maxDuration: 0.8
          isLooped: true
          enabled: true
          colors:
            - red
            - blue
            - green

- type: entity
  name: multi-behaviour light test
  parent: BaseItem
  id: LightBehaviourTest3
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: false
      color: "#FF0000"
      radius: 5
    - type: LightBehaviour
      behaviours:
        - !type:PulseBehaviour
          interpolate: Nearest
          minDuration: 0.2
          maxDuration: 1.0
          endValue: 0.2
          property: AnimatedEnable
          isLooped: true
          enabled: true
        - !type:ColorCycleBehaviour
          interpolate: Cubic
          maxDuration: 0.8
          isLooped: true
          enabled: true
          colors:
            - red
            - blue
            - green

- type: entity
  name: light fade in test
  parent: BaseItem
  id: LightBehaviourTest4
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: false
      color: "#FF0000"
      radius: 5
    - type: LightBehaviour
      behaviours:
        - !type:FadeBehaviour
          interpolate: Cubic
          maxDuration: 5.0
          startValue: 0.0
          endValue: 10.0
          isLooped: true
          property: Energy
          enabled: true

- type: entity
  name: light pulse radius test
  parent: BaseItem
  id: LightBehaviourTest5
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: false
      color: "#FF0000"
      radius: 5
    - type: LightBehaviour
      behaviours:
        - !type:PulseBehaviour
          interpolate: Cubic
          minDuration: 1.0
          maxDuration: 5.0
          startValue: 2.0
          endValue: 10.0
          isLooped: true
          enabled: true

- type: entity
  name: light randomize radius test
  parent: BaseItem
  id: LightBehaviourTest6
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      sprite: Objects/Misc/glowstick.rsi
      layers:
        - state: glowstick_base
        - state: glowstick_unlit
          shader: unshaded
          color: "#FF0000"
    - type: Item
      sprite: Objects/Misc/glowstick.rsi
      heldPrefix: unlit
    - type: PointLight
      enabled: false
      color: "#FF0000"
      radius: 5
      energy: 10
    - type: LightBehaviour
      behaviours:
        - !type:RandomizeBehaviour
          interpolate: Nearest
          maxDuration: 0.5
          startValue: 10.0
          endValue: 25.0
          isLooped: true
          enabled: true