Files
Aurora.3/code/modules/power/lights/bulbs.dm
hazelratandGitHub e9f1bb5709 Area-based Horizon lighting (#22511)
This adds unique lighting palettes to different areas of the SCCV
Horizon. It does this by tying randomized_lighting variable for light
fixtures to the department variable of the area they are in. This
solution is intended to save a lot of time and effort, both now and
later, which would otherwise be spent mapping down each colour of
lighting into every department manually.

Notable points:
- This shifts the parent colour for light bulbs from LIGHT_COLOR_HALOGEN
(#C0C0CA) to the new LIGHT_COLOR_OFFWHITE (#efe5bb), and shifts the
randomized_colors variable to the according list. This shifts them from
a slightly murky blue-tinted white to a slightly brighter yellow-tinted
white. Slightly warm lighting will now be the default for every map.
Warmer lighting communicates the age of a ship or station, the worsening
economic prospects of the setting, and it's also a bit cosier.
- Stark white lighting is retained for medical and the bridge. Research
has been given purple-tinted lighting.
- Command offices are also under blue lighting currently, to visually
differentiate them from the rest of their departments.
- To avoid too much player-facing bloat, only a box for pale purple has
been added so janitors can replace the lighting in research. Otherwise,
yellow can be used for engineering, white for public areas, and blue for
high-security areas.
- Offsites and offships shouldn't be hugely changed by the shift in
default lighting - it's a slight change in hue.

Screenshots below!
<details>
<img width="1077" height="1080" alt="image"
src="https://github.com/user-attachments/assets/1987e29f-c34c-44ea-865f-5f81c0e5c47f"
/>
<img width="1080" height="1080" alt="image"
src="https://github.com/user-attachments/assets/79279c6c-da56-4676-a0e9-7e5db43002cd"
/>
<img width="1083" height="1080" alt="image"
src="https://github.com/user-attachments/assets/621589b5-ada6-4d80-9f8f-8cf13a47df39"
/>
<img width="1085" height="1080" alt="image"
src="https://github.com/user-attachments/assets/09284700-8408-4a86-86c5-7575e7c94a27"
/>
<img width="1081" height="1080" alt="image"
src="https://github.com/user-attachments/assets/8246585c-f437-437a-8d32-9997fae05298"
/>
<img width="1078" height="1080" alt="image"
src="https://github.com/user-attachments/assets/a34841dd-3f49-4010-b2e0-d2e9a748e617"
/>
<img width="1084" height="1080" alt="image"
src="https://github.com/user-attachments/assets/55e89703-8ac7-4fa7-9775-19818c10c119"
/>
<img width="1080" height="1080" alt="image"
src="https://github.com/user-attachments/assets/684dea04-90c5-4877-b2bf-08a2146efb5e"
/>
<img width="1078" height="1080" alt="image"
src="https://github.com/user-attachments/assets/6ce42ac1-0f4b-49eb-8f2c-c6fb1830877e"
/>
<img width="1083" height="1080" alt="image"
src="https://github.com/user-attachments/assets/bc41a4f4-8d5c-4348-b9fe-a41d7950ce37"
/>
<img width="1081" height="1080" alt="image"
src="https://github.com/user-attachments/assets/48c4b733-a375-482b-9f70-e2aa6d0b3e27"
/>
<img width="1083" height="1080" alt="image"
src="https://github.com/user-attachments/assets/52e0041a-602d-4f4b-9d6c-7d0a0946f90b"
/>
</details>
2026-05-27 15:37:50 +00:00

221 lines
6.1 KiB
Plaintext

// the light item
// can be tube or bulb subtypes
// will fit into empty /obj/structure/machinery/light of the corresponding type
/obj/item/light
icon = 'icons/obj/machinery/light.dmi'
force = 2
throwforce = 5
w_class = WEIGHT_CLASS_TINY
matter = list(DEFAULT_WALL_MATERIAL = 60)
drop_sound = 'sound/items/drop/drinkglass.ogg'
pickup_sound = 'sound/items/pickup/drinkglass.ogg'
var/status = 0 // LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
var/switchcount = 0 // number of times switched
var/rigged = 0 // true if rigged to explode
var/brightness_range = 2 //how much light it gives off
var/brightness_power = 0.45
var/brightness_color = LIGHT_COLOR_OFFWHITE
var/lighttype = null
var/randomize_range = TRUE
var/randomize_color = TRUE
var/list/randomized_colors = LIGHT_WARM_COLORS
/obj/item/light/antagonist_hints(mob/user, distance, is_adjacent)
. += ..()
. += "Injecting 5 units of phoron into a light bulb/tube with a syringe will rig it to explode!"
. += "When rigged, the light will explode immediately when it is next turned on."
/obj/item/light/Initialize()
. = ..()
if(randomize_range)
switch(lighttype)
if("tube")
brightness_range = rand(6,9)
if("bulb")
brightness_range = rand(4,6)
if(randomize_color)
brightness_color = pick(randomized_colors)
update()
// update the icon state and description of the light
/obj/item/light/proc/update()
ClearOverlays()
switch(status)
if(LIGHT_OK)
icon_state = "[lighttype]_attachment"
var/image/I = image(icon, "[lighttype]")
I.color = brightness_color
AddOverlays(I)
desc = "A replacement [name]."
if(LIGHT_BURNED)
icon_state = "[lighttype]_attachment"
var/image/I = image(icon, "[lighttype]_burned")
I.color = brightness_color
AddOverlays(I)
desc = "A burnt-out [name]."
if(LIGHT_BROKEN)
icon_state = "[lighttype]_attachment_broken"
var/image/I = image(icon, "[lighttype]_broken")
I.color = brightness_color
AddOverlays(I)
desc = "A broken [name]."
// attack bulb/tube with object
// if a syringe, can inject phoron to make it explode
/obj/item/light/attackby(obj/item/attacking_item, mob/user)
. = ..()
if(istype(attacking_item, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/S = attacking_item
to_chat(user, SPAN_NOTICE("You inject the solution into \the [src]."))
if(S.reagents.has_reagent(/singleton/reagent/toxin/phoron, 5))
log_admin("LOG: [user.name] ([user.ckey]) injected a light with phoron, rigging it to explode.")
message_admins("LOG: [user.name] ([user.ckey]) injected a light with phoron, rigging it to explode.")
rigged = TRUE
S.reagents.clear_reagents()
return TRUE
// called after an attack with a light item
// shatter light, unless it was an attempt to put it in a light socket
// now only shatter if the intent was harm
/obj/item/light/afterattack(atom/target, mob/user, proximity)
if(!proximity)
return
if(istype(target, /obj/structure/machinery/light))
return
if(user.a_intent != I_HURT)
return
shatter()
/obj/item/light/proc/shatter()
if(status == LIGHT_OK || status == LIGHT_BURNED)
visible_message(SPAN_WARNING("\The [src] shatters!"), SPAN_WARNING("You hear a small glass object shatter!"))
status = LIGHT_BROKEN
force = 11
sharp = TRUE
playsound(get_turf(src), 'sound/effects/glass_hit.ogg', 75, TRUE)
new /obj/item/material/shard(get_turf(src))
update()
/obj/item/light/tube
name = "light tube"
desc = "A replacement light tube."
icon_state = "ltube_preset"//preset state for mapping
item_state = "c_tube"
matter = list(MATERIAL_GLASS = 100)
brightness_range = 8
brightness_power = 0.4
lighttype = "ltube"
/obj/item/light/tube/colored
randomize_color = FALSE
/obj/item/light/tube/colored/red
name = "red light tube"
brightness_color = LIGHT_COLOR_SCARLET
/obj/item/light/tube/colored/green
name = "green light tube"
brightness_color = LIGHT_COLOR_GREEN
/obj/item/light/tube/colored/blue
name = "blue light tube"
brightness_color = LIGHT_COLOR_BLUE
/obj/item/light/tube/colored/magenta
name = "magenta light tube"
brightness_color = LIGHT_COLOR_VIOLET
/obj/item/light/tube/colored/pale_purple
name = "pale purple light tube"
brightness_color = LIGHT_COLOR_PALE_PURPLE
/obj/item/light/tube/colored/yellow
name = "yellow light tube"
brightness_color = LIGHT_COLOR_YELLOW
/obj/item/light/tube/colored/cyan
name = "cyan light tube"
brightness_color = LIGHT_COLOR_CYAN
/obj/item/light/tube/colored/beige
name = "beige light tube"
brightness_color = LIGHT_COLOR_BEIGE
/obj/item/light/tube/large
w_class = WEIGHT_CLASS_SMALL
name = "large light tube"
desc = "A replacement large light tube."
icon_state = "lstube_preset"
brightness_range = 15
brightness_power = 0.75
randomize_range = FALSE
lighttype = "lstube"
/obj/item/light/bulb
name = "light bulb"
desc = "A replacement light bulb."
icon_state = "lbulb_preset"//preset state for mapping
item_state = "egg"
matter = list(MATERIAL_GLASS = 100)
brightness_range = 5
brightness_power = 0.4
brightness_color = LIGHT_COLOR_TUNGSTEN
lighttype = "lbulb"
/obj/item/light/bulb/colored
randomize_color = FALSE
/obj/item/light/bulb/colored/red
name = "red light bulb"
brightness_color = LIGHT_COLOR_SCARLET
/obj/item/light/bulb/colored/green
name = "green light bulb"
brightness_color = LIGHT_COLOR_GREEN
/obj/item/light/bulb/colored/blue
name = "blue light bulb"
brightness_color = LIGHT_COLOR_BLUE
/obj/item/light/bulb/colored/magenta
name = "magenta light bulb"
brightness_color = LIGHT_COLOR_VIOLET
/obj/item/light/bulb/colored/pale_purple
name = "pale purple light tube"
brightness_color = LIGHT_COLOR_PALE_PURPLE
/obj/item/light/bulb/colored/yellow
name = "yellow light bulb"
brightness_color = LIGHT_COLOR_YELLOW
/obj/item/light/bulb/colored/cyan
name = "cyan light bulb"
brightness_color = LIGHT_COLOR_CYAN
/obj/item/light/bulb/colored/decayed
name = "decayed light bulb"
brightness_color = LIGHT_COLOR_DECAYED
/obj/item/light/bulb/colored/beige
name = "beige light bulb"
brightness_color = LIGHT_COLOR_BEIGE
/obj/item/light/throw_impact(atom/hit_atom)
..()
shatter()
/obj/item/light/clean()
. = ..()
brightness_color = initial(brightness_color)
update()