- type: entity
  name: lantern
  parent: BaseItem
  id: BaseLamp
  abstract: true
  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: PowerCellSlot
    cellSlotId: cell_slot
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: PowerCellSmall
        # Sunrise-Start
        whitelist:
          tags:
          - PowerCell
        # Sunrise-End
  - type: ContainerContainer
    containers:
      cell_slot: !type:ContainerSlot
  - type: Sprite
    sprite: Objects/Misc/Lights/lights.rsi
  - type: Item
    sprite: Objects/Misc/Lights/lights.rsi
    size: Normal
    heldPrefix: off
  - type: PointLight
    enabled: false
    radius: 3
    energy: 2
    netsync: false
  - type: ToggleableVisuals
    spriteLayer: light
  - type: ItemTogglePointLight
  - type: Appearance
  - type: Physics
    canCollide: false
  - type: StealTarget
    stealGroup: LAMP

- type: entity
  name: lamp
  id: Lamp
  parent: BaseLamp
  description: A light emitting device.
  components:
  - type: Sprite
    sprite: Objects/Misc/Lights/lamp.rsi
    layers:
      - state: lamp
        map: [ "base" ]
      - state: lamp-on
        shader: unshaded
        visible: false
        map: [ "light" ]
  - type: Item
    sprite: Objects/Misc/Lights/lamp.rsi
  - type: HolidayVisuals
    holidays:
      festive:
      - FestiveSeason
  - type: GenericVisualizer
    visuals:
      enum.HolidayVisuals.Holiday:
        base:
          festive: { state: christmaslamp }
        light:
          festive: { state: christmaslamp-on }
  - type: Rotatable

- type: entity
  name: banana lamp
  id: LampBanana
  parent: BaseLamp
  description: A light emitting device, shaped like a banana.
  components:
  - type: Sprite
    layers:
      - state: bananalamp
      - state: bananalamp_on
        shader: unshaded
        visible: false
        map: [ "light" ]
  - type: Rotatable

- type: entity
  name: desk lamp
  id: LampGold
  parent: BaseLamp
  description: A light emitting device that would look great on a desk.
  components:
  - type: Sprite
    sprite: Objects/Misc/Lights/lampgreen.rsi
    layers:
      - state: lampgreen
        map: [ "base" ]
      - state: lampgreen-on
        shader: unshaded
        visible: false
        map: [ "light" ]
  - type: Item
    sprite: Objects/Misc/Lights/lampgreen.rsi
  - type: HolidayVisuals
    holidays:
      festive:
      - FestiveSeason
  - type: GenericVisualizer
    visuals:
      enum.HolidayVisuals.Holiday:
        base:
          festive:
            sprite: Objects/Misc/Lights/lamp.rsi
            state: christmaslamp
        light:
          festive:
            sprite: Objects/Misc/Lights/lamp.rsi
            state: christmaslamp-on
  - type: Rotatable

- type: entity
  name: interrogator lamp
  id: LampInterrogator
  parent: [ BaseLamp, BaseSecurityContraband ]
  description: Ultra-bright lamp for the bad cop.
  components:
  - type: Sprite
    sprite: Objects/Misc/Lights/lampint.rsi
    layers:
      - state: lamp-int
        map: [ "enum.FlashVisualLayers.BaseLayer" ]
      - state: lamp-int-on
        shader: unshaded
        visible: false
        map: [ "light" ]
      - state: flashing
        map: [ "enum.FlashVisualLayers.LightLayer" ]
        visible: false
  - type: Item
    sprite: Objects/Misc/Lights/lampint.rsi
  - type: StaticPrice
    price: 2500
  - type: PointLight
    netsync: false
    enabled: false
    radius: 2
    energy: 0.5
    color: "#FFFFEE"
  - type: Flash
    flashOnMelee: false
    flashOnUse: false
  - type: UseDelay
    delay: 1
  - type: LimitedCharges
    maxCharges: 3
  - type: AutoRecharge
    rechargeDuration: 30
  - type: MeleeWeapon
    wideAnimationRotation: 180
    damage:
      types:
        Blunt: 0 # melee weapon to allow flashing individual targets
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: PowerCellHigh
        # Sunrise-Start
        whitelist:
          tags:
          - PowerCell
        # Sunrise-End
  - type: GenericVisualizer
    visuals:
      enum.FlashVisuals.Burnt:
        enum.FlashVisualLayers.BaseLayer:
          True: {state: burnt}
      enum.FlashVisuals.Flashing:
        enum.FlashVisualLayers.LightLayer:
          True: {visible: true}
          False: {visible: false}

- type: entity
  name: floodlight
  id: Floodlight
  parent: BaseLamp
  description: A pole with powerful mounted lights on it.
  components:
  - type: Item
    size: Normal
  - type: Sprite
    sprite: Objects/Misc/Lights/lights.rsi
    layers:
      - state: floodlight
        map: [ "base" ]
      - state: floodlight-on
        shader: unshaded
        visible: false
        map: [ "light" ]
  - type: Physics
    canCollide: true
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2, -0.5, 0.2, 0.5"
        density: 50
        mask:
        - HighImpassable
  - type: PointLight
    enabled: false
    radius: 8
    energy: 5
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: PowerCellMedium
  - type: Anchorable
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: GlassBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          FloodlightBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: PhysicalComposition
    materialComposition:
      Glass: 500
      Steel: 200
- type: entity
  name: broken floodlight
  id: FloodlightBroken
  parent: BaseItem
  description: A pole with powerful mounted lights on it. It's broken.
  components:
  - type: Item
    size: Normal
    sprite: Objects/Misc/Lights/lights.rsi
    heldPrefix: floodlight-broken
  - type: Sprite
    sprite: Objects/Misc/Lights/lights.rsi
    state: floodlight-broken
  - type: Anchorable
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 40
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 20
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2, -0.5, 0.2, 0.5"
        density: 50
        mask:
        - HighImpassable
  - type: PhysicalComposition
    materialComposition:
      Glass: 500
      Steel: 200
