mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
New powernet light flicker (#92567)
## About The Pull Request Changes light flicker to be an overlay instead of a rapid turning on/off of the light itself. It acts similar to a brownout and delayed restart of the light. The introduction of lights flickering when the powernet is hit by a bomb is a cool effect, but makes it very apparent the current flicker method's limitations. Rapid cycling of machinery on/off as fast as 0.5 seconds, spanning over dozens of lights at a time leads to the subsystem not being able to keep up with the lighting changes. It ultimately results in just a single broken looking change of lighting <details> <summary>Screenshots/Videos</summary> Before: https://github.com/user-attachments/assets/8237e72e-1edc-4423-b48b-8dd403ee3111 https://github.com/user-attachments/assets/f3a3d481-61fa-4fd9-b51c-3c1e080e129c After: https://github.com/user-attachments/assets/0fa2bbfd-4ca7-422a-8cd1-b6b738addb0f https://github.com/user-attachments/assets/8b8b10b9-912a-4476-9a11-985f79228500 </details> ## Why It's Good For The Game The powernet flicker effect looks better (and also now has an electrical sizzle sound) ## Changelog 🆑 LT3 code: Improved powernet light flickering /🆑
This commit is contained in:
@@ -192,7 +192,7 @@
|
||||
if(window.fulltile)
|
||||
new /obj/effect/temp_visual/revenant/cracks(window.loc)
|
||||
for(var/obj/machinery/light/light in victim)
|
||||
light.flicker(20) //spooky
|
||||
light.flicker(rand(3, 5)) //spooky
|
||||
|
||||
//Malfunction: Makes bad stuff happen to robots and machines.
|
||||
/datum/action/cooldown/spell/aoe/revenant/malfunction
|
||||
|
||||
@@ -180,6 +180,9 @@
|
||||
|
||||
var/area/local_area = get_room_area()
|
||||
|
||||
if(flickering)
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_flickering")
|
||||
return
|
||||
if(low_power_mode || major_emergency || (local_area?.fire))
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_emergency")
|
||||
return
|
||||
@@ -225,7 +228,11 @@
|
||||
if(reagents)
|
||||
START_PROCESSING(SSmachines, src)
|
||||
var/area/local_area = get_room_area()
|
||||
if (local_area?.fire)
|
||||
if (flickering)
|
||||
brightness_set = brightness * bulb_low_power_brightness_mul
|
||||
power_set = bulb_low_power_pow_mul
|
||||
color_set = nightshift_light_color
|
||||
else if (local_area?.fire)
|
||||
color_set = fire_colour
|
||||
power_set = fire_power
|
||||
brightness_set = fire_brightness
|
||||
@@ -500,27 +507,36 @@
|
||||
)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/light/proc/flicker(amount = rand(10, 20))
|
||||
/obj/machinery/light/proc/flicker(amount = 1)
|
||||
set waitfor = FALSE
|
||||
if(flickering || !on || status != LIGHT_OK)
|
||||
return
|
||||
|
||||
. = TRUE // did we actually flicker? Send this now because we expect immediate response, before sleeping.
|
||||
flickering = TRUE
|
||||
set_light(
|
||||
l_range = brightness * bulb_low_power_brightness_mul,
|
||||
l_power = bulb_low_power_pow_mul,
|
||||
l_color = nightshift_light_color,
|
||||
)
|
||||
cut_overlays(src)
|
||||
stoplag(0.7 SECONDS)
|
||||
if(prob(30))
|
||||
do_sparks(number = 2, cardinal_only = TRUE, source = src)
|
||||
|
||||
for(var/i in 1 to amount)
|
||||
if(status != LIGHT_OK || !has_power())
|
||||
break
|
||||
on = !on
|
||||
flickering = !flickering
|
||||
update(FALSE)
|
||||
stoplag(rand(0.5 SECONDS, 1.5 SECONDS))
|
||||
stoplag(pick(list(2 SECONDS, 4 SECONDS, 6 SECONDS)))
|
||||
|
||||
if(has_power())
|
||||
on = (status == LIGHT_OK)
|
||||
else
|
||||
on = FALSE
|
||||
|
||||
update(FALSE)
|
||||
flickering = FALSE
|
||||
update(FALSE)
|
||||
|
||||
// ai attack - make lights flicker, because why not
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@
|
||||
return
|
||||
|
||||
flickering = TRUE
|
||||
var/most_flickers = 1
|
||||
for(var/obj/machinery/power/terminal/terminal in nodes)
|
||||
if(!istype(terminal.master, /obj/machinery/power/apc))
|
||||
continue
|
||||
@@ -123,12 +122,10 @@
|
||||
if(!prob(flicker_prob))
|
||||
continue
|
||||
|
||||
var/flicker_count = rand(1, 3)
|
||||
most_flickers = max(most_flickers, flicker_count)
|
||||
var/obj/machinery/power/apc/apc = terminal.master
|
||||
for(var/obj/machinery/light/light as anything in apc.get_lights())
|
||||
light.flicker(flicker_count)
|
||||
light.flicker(amount = 1)
|
||||
CHECK_TICK
|
||||
|
||||
// don't let another flicker propagation until our slowest area is done (with some added leeway)
|
||||
addtimer(VARSET_CALLBACK(src, flickering, FALSE), most_flickers * 2 SECONDS)
|
||||
addtimer(VARSET_CALLBACK(src, flickering, FALSE), 9 SECONDS)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.6 KiB |
Reference in New Issue
Block a user