mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] removes sleep from light flickers (#10237)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7e80ca2fb6
commit
3913e6971c
@@ -748,19 +748,27 @@ var/global/list/light_type_cache = list()
|
||||
|
||||
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
|
||||
if(flickering) return
|
||||
flickering = 1
|
||||
spawn(0)
|
||||
if(on && status == LIGHT_OK)
|
||||
for(var/i = 0; i < amount; i++)
|
||||
if(status != LIGHT_OK) break
|
||||
on = !on
|
||||
update(0)
|
||||
if(!on) // Only play when the light turns off.
|
||||
playsound(src, 'sound/effects/light_flicker.ogg', 50, 1)
|
||||
sleep(rand(5, 15))
|
||||
on = (status == LIGHT_OK)
|
||||
update(0)
|
||||
if(on && status == LIGHT_OK)
|
||||
flickering = 1
|
||||
do_flicker(amount)
|
||||
|
||||
/obj/machinery/light/proc/do_flicker(remaining_flicks)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
PRIVATE_PROC(TRUE)
|
||||
if(status != LIGHT_OK)
|
||||
flickering = 0
|
||||
return
|
||||
on = !on
|
||||
update(0)
|
||||
if(!on) // Only play when the light turns off.
|
||||
playsound(src, 'sound/effects/light_flicker.ogg', 50, 1)
|
||||
if(remaining_flicks > 0)
|
||||
remaining_flicks--
|
||||
addtimer(CALLBACK(src, PROC_REF(do_flicker), remaining_flicks), rand(5, 15), TIMER_DELETE_ME)
|
||||
return
|
||||
on = (status == LIGHT_OK)
|
||||
update(0)
|
||||
flickering = 0
|
||||
|
||||
// ai attack - turn on/off emergency lighting for a specific fixture
|
||||
/obj/machinery/light/attack_ai(mob/user)
|
||||
|
||||
Reference in New Issue
Block a user