mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 07:03:30 +01:00
Merge pull request #14728 from S-CR/#14727-Fix
Light Flickers Now Process Asynchronously Again
This commit is contained in:
@@ -522,17 +522,27 @@
|
||||
/obj/machinery/light/proc/flicker(amount = rand(10, 20))
|
||||
if(flickering)
|
||||
return
|
||||
if(on)
|
||||
flickering = TRUE
|
||||
for(var/i in 1 to amount)
|
||||
if(status != LIGHT_OK)
|
||||
break
|
||||
on = !on
|
||||
update() // No param means that ghosts can burn out lights
|
||||
sleep(rand(5, 15))
|
||||
if(status == LIGHT_OK)
|
||||
on = TRUE
|
||||
update(FALSE)
|
||||
|
||||
if(!on)
|
||||
return
|
||||
|
||||
flickering = TRUE
|
||||
INVOKE_ASYNC(src, /obj/machinery/light/.proc/flicker_event, amount)
|
||||
|
||||
/**
|
||||
* Flicker routine for the light.
|
||||
* Called by invoke_async so the parent proc can return immediately.
|
||||
*/
|
||||
/obj/machinery/light/proc/flicker_event(amount)
|
||||
for(var/i in 1 to amount)
|
||||
if(status != LIGHT_OK)
|
||||
break
|
||||
on = !on
|
||||
update() // No param means that ghosts can burn out lights
|
||||
sleep(rand(5, 15))
|
||||
if(status == LIGHT_OK)
|
||||
on = TRUE
|
||||
update(FALSE)
|
||||
flickering = FALSE
|
||||
|
||||
// ai attack - make lights flicker, because why not
|
||||
|
||||
Reference in New Issue
Block a user