From 450151a81d077ad16df881c5ddf00b36c8b74307 Mon Sep 17 00:00:00 2001 From: AutisticFroggy <52133791+AutisticFroggy@users.noreply.github.com> Date: Tue, 3 Dec 2019 18:43:36 +0800 Subject: [PATCH] Update lighting.dm --- code/modules/power/lighting.dm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 5e22ce6ab286..c96577e094d2 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -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 @@ -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 ..() @@ -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) @@ -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() @@ -470,7 +474,7 @@ switchcount = L.switchcount rigged = L.rigged brightness = L.brightness - on = has_power() + on = has_power() && !forced_off update() qdel(L) @@ -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 ..() @@ -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) @@ -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 @@ -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) @@ -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)