Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions code/modules/power/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
var/on = FALSE // 1 if on, 0 if off
var/on_gs = FALSE
var/forced_off = FALSE
var/static_power_used = 0
var/brightness = 8 // luminosity when on, also used in power calculation
var/bulb_power = 1 // basically the alpha of the emitted light source
Expand Down Expand Up @@ -308,7 +309,7 @@
/obj/machinery/light/Destroy()
var/area/A = get_area(src)
if(A)
on = FALSE
on = FALSE && !forced_off
// A.update_lights()
QDEL_NULL(cell)
return ..()
Expand All @@ -317,12 +318,15 @@
cut_overlays()
switch(status) // set icon_states
if(LIGHT_OK)
if(forced_off)
icon_state = "[base_state]"
return
var/area/A = get_area(src)
if(emergency_mode || (A && A.fire))
icon_state = "[base_state]_emergency"
else
icon_state = "[base_state]"
if(on)
if(on && !forced_off)
var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE)
glowybit.alpha = CLAMP(light_power*250, 30, 200)
add_overlay(glowybit)
Expand Down Expand Up @@ -417,7 +421,7 @@
// attempt to set the light's on/off status
// will not switch on if broken/burned/empty
/obj/machinery/light/proc/seton(s)
on = (s && status == LIGHT_OK)
on = (s && status == LIGHT_OK && !forced_off)
update()

/obj/machinery/light/get_cell()
Expand Down Expand Up @@ -470,7 +474,7 @@
switchcount = L.switchcount
rigged = L.rigged
brightness = L.brightness
on = has_power()
on = has_power() && !forced_off
update()

qdel(L)
Expand All @@ -493,6 +497,13 @@
do_sparks(3, TRUE, src)
if (prob(75))
electrocute_mob(user, get_area(src), src, rand(0.7,1.0), TRUE)
//attempt to turn off light with multitool
else if(W.tool_behaviour == TOOL_MULTITOOL)
set_light(0)
forced_off = !forced_off
on = !on
update_icon()
update()
else
return ..()

Expand Down Expand Up @@ -529,7 +540,7 @@
/obj/machinery/light/attacked_by(obj/item/I, mob/living/user)
..()
if(status == LIGHT_BROKEN || status == LIGHT_EMPTY)
if(on && (I.flags_1 & CONDUCT_1))
if(on && (I.flags_1 & CONDUCT_1) && !forced_off)
if(prob(12))
electrocute_mob(user, get_area(src), src, 0.3, TRUE)

Expand Down Expand Up @@ -600,7 +611,7 @@
on = !on
update(0)
sleep(rand(5, 15))
on = (status == LIGHT_OK)
on = (status == LIGHT_OK) && !forced_off
update(0)
flickering = 0

Expand Down Expand Up @@ -718,7 +729,7 @@
return
status = LIGHT_OK
brightness = initial(brightness)
on = TRUE
on = TRUE && !forced_off
update()

/obj/machinery/light/tesla_act(power, tesla_flags)
Expand Down Expand Up @@ -746,7 +757,7 @@
var/turf/T = get_turf(src.loc)
break_light_tube() // break it first to give a warning
sleep(2)
explosion(T, 0, 0, 2, 2)
explosion(T, 0, 1, 2, 4)
sleep(1)
qdel(src)

Expand Down