# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseItem
  id: BaseLightbulb
  abstract: true
  components:
  - type: MeleeSound
    soundGroups:
      Brute:
        collection: GlassSmash
  - type: Sprite
    sprite: Objects/Power/light_bulb.rsi
    layers:
      - map: [ enum.LightBulbVisualLayers.Base ]
        state: normal
  - type: LightBulb
  - type: Damageable
    damageContainer: Inorganic
  - type: DamageOnLand
    damage:
      types:
        Blunt: 5
  - type: DamageOtherOnHit
    damage:
      types:
        Blunt: 5
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors: #excess damage (nuke?). avoid computational cost of spawning entities.
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 5
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
          params:
            volume: -8
      - !type:DoActsBehavior
        acts: [ "Breakage" ]
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
          params:
            volume: -8
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Appearance
  - type: Tag
    tags:
    - Trash
  - type: PhysicalComposition #Goobstation - Recycle update
    materialComposition:
      Glass: 25
  - type: SpaceGarbage
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
  - type: ThrowableBlocked # Goobstation
    behavior: Damage
    damage:
      types:
        Blunt: 5

- type: entity
  parent: BaseLightbulb
  id: BaseLightTube
  abstract: true
  components:
  - type: Sprite
    sprite:  Objects/Power/light_tube.rsi
  - type: LightBulb
    bulb: Tube
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors: #excess damage (nuke?). avoid computational cost of spawning entities.
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 5
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
      - !type:DoActsBehavior
        acts: [ "Breakage" ]
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          ShardGlass:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

# Lighting color values gathered from
# https://andi-siess.de/rgb-to-color-temperature/
# https://academo.org/demos/colour-temperature-relationship/
- type: entity
  parent: BaseLightbulb
  name: incandescent light bulb
  id: LightBulb
  description: A light bulb.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#FFD1A3" # 4000K color temp
    lightEnergy: 1.0
    lightRadius: 6
    lightSoftness: 1.1
  - type: Tag
    tags:
    - LightBulb
    - Trash

- type: entity
  parent: BaseLightbulb
  name: led light bulb
  id: LedLightBulb
  description: A power efficient light bulb.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#EEEEFF"
    lightEnergy: 1
    lightRadius: 8
    lightSoftness: 1
    BurningTemperature: 350 #LEDs are colder than incandescent bulbs
    PowerUse: 6 #LEDs are more power efficient than incandescent bulbs
  - type: Tag
    tags:
    - LightBulb
    - Trash

- type: entity
  parent: BaseLightbulb
  name: dim light bulb
  id: DimLightBulb
  description: A dim light bulb for populating the darkness of maintenance.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#ba473f"
    lightEnergy: 0.5
    lightRadius: 5
    lightSoftness: 3
  - type: Tag
    tags:
    - LightBulb
    - Trash

- type: entity
  parent: BaseLightbulb
  name: warm light bulb
  id: WarmLightBulb
  description: A warm light bulb for a more cozy atmosphere.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#ff9833" # 2200k color temp
    lightEnergy: 1
    lightRadius: 6
    lightSoftness: 3
  - type: Tag
    tags:
    - LightBulb
    - Trash

- type: entity
  parent: LightBulb
  name: old incandescent light bulb
  id: LightBulbOld
  description: An aging light bulb.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#FFD1A3" # 4000K color temp
    lightEnergy: 0.3 # old incandescents just arent as bright
    lightRadius: 6
    lightSoftness: 1.1

- type: entity
  suffix: Broken
  parent: BaseLightbulb
  name: incandescent light bulb
  id: LightBulbBroken
  description: A light bulb.
  components:
  - type: LightBulb
    startingState: Broken
    bulb: Bulb

- type: entity
  parent: BaseLightbulb
  name: service light bulb
  id: ServiceLightBulb
  description: A low-brightness green lightbulb used in janitorial service lights.
  components:
  - type: LightBulb
    bulb: Bulb
    color: "#CCFF60"
    lightEnergy: 0.45
    lightRadius: 1.5
    lightSoftness: 3
  - type: Tag
    tags:
    - LightBulb
    - Trash

- type: entity
  parent: BaseLightTube
  name: fluorescent light tube
  id: LightTube
  description: A light fixture.
  components:
  - type: LightBulb
    color: "#FFE4CE" # 5000K color temp
    lightEnergy: 0.8
    lightRadius: 10
    lightSoftness: 1
    PowerUse: 25

- type: entity
  parent: LightTube
  name: old fluorescent light tube
  id: LightTubeOld
  description: An aging light fixture.
  components:
  - type: LightBulb
    color: "#FFDABB" # old fluorescents are yellower-4500K temp
    lightEnergy: 0.5
    lightRadius: 10
    lightSoftness: 1
    PowerUse: 10

- type: entity
  suffix: Broken
  parent: BaseLightTube
  name: fluorescent light tube
  id: LightTubeBroken
  description: A light fixture.
  components:
  - type: LightBulb
    startingState: Broken

- type: entity
  parent: BaseLightTube
  name: led light tube
  description: A high power high energy bulb.
  id: LedLightTube
  components:
  - type: LightBulb
    color: "#EEEEFF"
    lightEnergy: 1
    lightRadius: 15
    lightSoftness: 0.9
    BurningTemperature: 350
    PowerUse: 12

- type: entity
  parent: BaseLightTube
  name: exterior light tube
  description: A high power high energy bulb for the depths of space. May contain mercury.
  id: ExteriorLightTube
  components:
  - type: LightBulb
    color: "#B4FCF0"
    lightEnergy: 4.5
    lightRadius: 12
    lightSoftness: 0.5
    BurningTemperature: 350
    PowerUse: 100

- type: entity
  parent: BaseLightTube
  name: sodium light tube
  description: A high power high energy bulb for the depths of space. Salty.
  id: SodiumLightTube
  components:
  - type: LightBulb
    color: "#FFAF38"
    lightEnergy: 4
    lightRadius: 10
    lightSoftness: 0.5
    BurningTemperature: 350
    PowerUse: 100

- type: entity
  parent: BaseLightTube
  name: crystal light tube
  description: A high power high energy bulb which has a small colored crystal inside.
  id: BaseLightTubeCrystal
  abstract: true
  components:
  - type: LightBulb
    lightEnergy: 3
    lightRadius: 8
    lightSoftness: 0.5
    BurningTemperature: 350
    PowerUse: 60

- type: entity
  parent: BaseLightTubeCrystal
  name: cyan crystal light tube
  id: LightTubeCrystalCyan
  components:
  - type: LightBulb
    color: "#47f8ff"
  - type: Construction
    graph: CyanLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalCyan

- type: entity
  parent: BaseLightTubeCrystal
  name: blue crystal light tube
  id: LightTubeCrystalBlue
  components:
  - type: LightBulb
    color: "#39a1ff"
  - type: Construction
    graph: BlueLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalBlue

- type: entity
  parent: BaseLightTubeCrystal
  name: yellow crystal light tube
  id: LightTubeCrystalYellow
  components:
  - type: LightBulb
    color: "#ffde46"
  - type: Construction
    graph: YellowLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalYellow

- type: entity
  parent: BaseLightTubeCrystal
  name: pink crystal light tube
  id: LightTubeCrystalPink
  components:
  - type: LightBulb
    color: "#ff66cc"
  - type: Construction
    graph: PinkLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalPink

- type: entity
  parent: BaseLightTubeCrystal
  name: orange crystal light tube
  id: LightTubeCrystalOrange
  components:
  - type: LightBulb
    color: "#ff8227"
  - type: Construction
    graph: OrangeLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalOrange

- type: entity
  parent: BaseLightTubeCrystal
  name: black crystal light tube
  description: A high power high energy bulb which has a small colored crystal inside. It isn't very bright.
  id: LightTubeCrystalBlack
  components:
  - type: LightBulb
    color: "#363636"
    lightEnergy: 1
    lightRadius: 8
  - type: Construction
    graph: BlackLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalBlack

- type: entity
  parent: BaseLightTubeCrystal
  name: red crystal light tube
  id: LightTubeCrystalRed
  components:
  - type: LightBulb
    color: "#fb4747"
  - type: Construction
    graph: RedLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalRed

- type: entity
  parent: LightTubeCrystalCyan
  name: green crystal light tube
  id: LightTubeCrystalGreen
  components:
  - type: LightBulb
    color: "#52ff39"
  - type: Construction
    graph: GreenLight
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalGreen


- type: entity
  parent: BaseLightbulb
  name: crystal light bulb
  description: A high power high energy bulb which has a small colored crystal inside.
  id: BaseLightbulbCrystal
  abstract: true
  components:
  - type: LightBulb
    color: "#47f8ff"
    lightEnergy: 1
    lightRadius: 6
    lightSoftness: 0.5
    BurningTemperature: 350
    PowerUse: 60
    bulb: Bulb

- type: entity
  parent: BaseLightbulbCrystal
  name: cyan crystal light bulb
  id: LightBulbCrystalCyan
  components:
  - type: LightBulb
    color: "#47f8ff"
  - type: Construction
    graph: CyanLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalCyan

- type: entity
  parent: BaseLightbulbCrystal
  name: blue crystal light bulb
  id: LightBulbCrystalBlue
  components:
  - type: LightBulb
    color: "#39a1ff"
  - type: Construction
    graph: BlueLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalBlue

- type: entity
  parent: BaseLightbulbCrystal
  name: yellow crystal light bulb
  id: LightBulbCrystalYellow
  components:
  - type: LightBulb
    color: "#ffde46"
  - type: Construction
    graph: YellowLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalYellow

- type: entity
  parent: BaseLightbulbCrystal
  name: pink crystal light bulb
  id: LightBulbCrystalPink
  components:
  - type: LightBulb
    color: "#ff66cc"
  - type: Construction
    graph: PinkLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalPink

- type: entity
  parent: BaseLightbulbCrystal
  name: orange crystal light bulb
  id: LightBulbCrystalOrange
  components:
  - type: LightBulb
    color: "#ff8227"
  - type: Construction
    graph: OrangeLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalOrange

- type: entity
  parent: BaseLightbulbCrystal
  name: black crystal light bulb
  description: A high power high energy bulb which has a small colored crystal inside. It isn't very bright.
  id: LightBulbCrystalBlack
  components:
  - type: LightBulb
    color: "#363636"
    lightEnergy: 1
    lightRadius: 8
  - type: Construction
    graph: BlackLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalBlack

- type: entity
  parent: BaseLightbulbCrystal
  name: red crystal light bulb
  id: LightBulbCrystalRed
  components:
  - type: LightBulb
    color: "#fb4747"
  - type: Construction
    graph: RedLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalRed

- type: entity
  parent: BaseLightbulbCrystal
  name: green crystal light bulb
  id: LightBulbCrystalGreen
  components:
  - type: LightBulb
    color: "#52ff39"
  - type: Construction
    graph: GreenLightBulb
    node: icon
  - type: ToolRefinable
    refineResult:
    - id: SheetGlass1
    - id: ShardCrystalGreen
