[MIRROR] Removing random sleeps (#10165)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Willburd <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-02-14 21:30:12 -07:00
committed by GitHub
parent a182c4528d
commit ff165c6c71
7 changed files with 59 additions and 77 deletions

View File

@@ -235,11 +235,10 @@
//If we're in an area that is fucking ideal, and we don't have to do anything, chances are we won't next tick either so why redo these calculations? //If we're in an area that is fucking ideal, and we don't have to do anything, chances are we won't next tick either so why redo these calculations?
//JESUS FUCK. THERE ARE LITERALLY 250 OF YOU MOTHERFUCKERS ON ZLEVEL ONE AND YOU DO THIS SHIT EVERY TICK WHEN VERY OFTEN THERE IS NO REASON TO //JESUS FUCK. THERE ARE LITERALLY 250 OF YOU MOTHERFUCKERS ON ZLEVEL ONE AND YOU DO THIS SHIT EVERY TICK WHEN VERY OFTEN THERE IS NO REASON TO
if(pump_direction && pressure_checks == PRESSURE_CHECK_EXTERNAL && controller_iteration > 10) //99% of all vents if(pump_direction && pressure_checks == PRESSURE_CHECK_EXTERNAL && Master.iteration > 10) //99% of all vents
//Fucking hibernate because you ain't doing shit. //Fucking hibernate because you ain't doing shit.
hibernate = 1 hibernate = 1
spawn(rand(100,200)) //hibernate for 10 or 20 seconds randomly addtimer(VARSET_CALLBACK(src, hibernate, 0), rand(10 SECONDS,20 SECONDS), TIMER_DELETE_ME) //hibernate randomly
hibernate = 0
if (power_draw >= 0) if (power_draw >= 0)
@@ -380,13 +379,11 @@
return return
if(signal.data["status"] != null) if(signal.data["status"] != null)
spawn(2) addtimer(CALLBACK(src, PROC_REF(broadcast_status)), 2, TIMER_DELETE_ME)
broadcast_status()
return //do not update_icon return //do not update_icon
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2) addtimer(CALLBACK(src, PROC_REF(broadcast_status)), 2, TIMER_DELETE_ME)
broadcast_status()
update_icon() update_icon()
return return

View File

@@ -160,11 +160,10 @@
power_draw = pump_gas(src, environment, air_contents, transfer_moles, power_rating) power_draw = pump_gas(src, environment, air_contents, transfer_moles, power_rating)
if(scrubbing && power_draw < 0 && controller_iteration > 10) //99% of all scrubbers if(scrubbing && power_draw < 0 && Master.iteration > 10) //99% of all scrubbers
//Fucking hibernate because you ain't doing shit. //Fucking hibernate because you ain't doing shit.
hibernate = 1 hibernate = 1
spawn(rand(100,200)) //hibernate for 10 or 20 seconds randomly addtimer(VARSET_CALLBACK(src, hibernate, 0), rand(10 SECONDS,20 SECONDS), TIMER_DELETE_ME) //hibernate randomly
hibernate = 0
if (power_draw >= 0) if (power_draw >= 0)
last_power_draw = power_draw last_power_draw = power_draw
@@ -253,13 +252,11 @@
return return
if(signal.data["status"] != null) if(signal.data["status"] != null)
spawn(2) addtimer(CALLBACK(src, PROC_REF(broadcast_status)), 2, TIMER_DELETE_ME)
broadcast_status()
return //do not update_icon return //do not update_icon
// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") // log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
spawn(2) addtimer(CALLBACK(src, PROC_REF(broadcast_status)), 2, TIMER_DELETE_ME)
broadcast_status()
update_icon() update_icon()
return return

View File

@@ -8,7 +8,6 @@
var/global/datum/controller/game_controller/master_controller //Set in world.New() var/global/datum/controller/game_controller/master_controller //Set in world.New()
var/global/controller_iteration = 0
var/global/last_tick_duration = 0 var/global/last_tick_duration = 0
/datum/controller/game_controller /datum/controller/game_controller

View File

@@ -5,18 +5,29 @@
icon_state = "emp" icon_state = "emp"
det_time = 20 det_time = 20
origin_tech = list(TECH_BLUESPACE = 4, TECH_MATERIAL = 4) origin_tech = list(TECH_BLUESPACE = 4, TECH_MATERIAL = 4)
var/light_sound = 'sound/effects/phasein.ogg'
var/blast_sound = 'sound/effects/bang.ogg'
/obj/item/grenade/anti_photon/detonate() /obj/item/grenade/anti_photon/detonate(var/parent_callback = FALSE)
playsound(src, 'sound/effects/phasein.ogg', 50, 1, 5) if(parent_callback) // An awful way to do this, but the spawn() setup left me no choice when porting to timers
..()
return
playsound(src, light_sound, 50, 1, 5)
set_light(10, -10, "#FFFFFF") set_light(10, -10, "#FFFFFF")
var/extra_delay = rand(0,90) var/extra_delay = rand(0,90)
addtimer(CALLBACK(src, PROC_REF(grenade_light),extra_delay), 200 + extra_delay, TIMER_DELETE_ME)
spawn(extra_delay) /obj/item/grenade/anti_photon/proc/grenade_light(var/extra_delay)
spawn(200) PRIVATE_PROC(TRUE)
SHOULD_NOT_OVERRIDE(TRUE)
if(prob(10+extra_delay)) if(prob(10+extra_delay))
set_light(10, 10, "#[num2hex(rand(64,255))][num2hex(rand(64,255))][num2hex(rand(64,255))]") set_light(10, 10, "#[num2hex(rand(64,255))][num2hex(rand(64,255))][num2hex(rand(64,255))]")
spawn(210) addtimer(CALLBACK(src, PROC_REF(grenade_blast)), 10, TIMER_DELETE_ME)
..()
playsound(src, 'sound/effects/bang.ogg', 50, 1, 5) /obj/item/grenade/anti_photon/proc/grenade_blast()
PRIVATE_PROC(TRUE)
SHOULD_NOT_OVERRIDE(TRUE)
detonate(TRUE) // See above for this sinful choice
playsound(src, blast_sound, 50, 1, 5)
qdel(src) qdel(src)

View File

@@ -25,8 +25,7 @@
activate(user) activate(user)
add_fingerprint(user) add_fingerprint(user)
spawn(5) addtimer(CALLBACK(src, PROC_REF(detonate)), 5, TIMER_DELETE_ME)
detonate()
return 0 return 0
return 1 return 1
@@ -39,9 +38,7 @@
active = 1 active = 1
icon_state = initial(icon_state) + "_active" icon_state = initial(icon_state) + "_active"
playsound(src, 'sound/weapons/armbomb.ogg', 75, 1, -3) playsound(src, 'sound/weapons/armbomb.ogg', 75, 1, -3)
spawn(det_time) addtimer(CALLBACK(src, PROC_REF(detonate)), det_time, TIMER_DELETE_ME)
detonate()
return
user.set_dir(get_dir(user, target)) user.set_dir(get_dir(user, target))
user.drop_item() user.drop_item()
var/t = (isturf(target) ? target : target.loc) var/t = (isturf(target) ? target : target.loc)
@@ -82,9 +79,7 @@
active = 1 active = 1
playsound(src, arm_sound, 75, 1, -3) playsound(src, arm_sound, 75, 1, -3)
spawn(det_time) addtimer(CALLBACK(src, PROC_REF(detonate)), det_time, TIMER_DELETE_ME)
detonate()
return
/obj/item/grenade/proc/detonate() /obj/item/grenade/proc/detonate()

View File

@@ -220,22 +220,31 @@
if(temperature_settings[watertemp] < T20C) if(temperature_settings[watertemp] < T20C)
return //no mist for cold water return //no mist for cold water
if(!ismist) if(!ismist)
spawn(50) addtimer(CALLBACK(src, PROC_REF(spawn_mist)), 50, TIMER_DELETE_ME)
if(src && on)
ismist = 1
mymist = new /obj/effect/mist(loc)
else else
ismist = 1 ismist = 1
mymist = new /obj/effect/mist(loc) mymist = new /obj/effect/mist(loc)
else if(ismist) else if(ismist)
ismist = 1 ismist = 1
mymist = new /obj/effect/mist(loc) mymist = new /obj/effect/mist(loc)
spawn(250) addtimer(CALLBACK(src, PROC_REF(remove_mist)), 250, TIMER_DELETE_ME)
if(src && !on)
/obj/machinery/shower/proc/spawn_mist()
PRIVATE_PROC(TRUE)
SHOULD_NOT_OVERRIDE(TRUE)
if(on)
ismist = 1
mymist = new /obj/effect/mist(loc)
/obj/machinery/shower/proc/remove_mist()
PRIVATE_PROC(TRUE)
SHOULD_NOT_OVERRIDE(TRUE)
if(!on)
qdel(mymist) qdel(mymist)
mymist = null mymist = null
ismist = 0 ismist = 0
//Yes, showers are super powerful as far as washing goes. //Yes, showers are super powerful as far as washing goes.
/obj/machinery/shower/proc/wash(atom/movable/O as obj|mob) /obj/machinery/shower/proc/wash(atom/movable/O as obj|mob)
if(!on) return if(!on) return
@@ -273,8 +282,7 @@
is_washing = 1 is_washing = 1
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.clean(src) T.clean(src)
spawn(100) addtimer(VARSET_CALLBACK(src, is_washing, 0), 100, TIMER_DELETE_ME)
is_washing = 0
/obj/machinery/shower/proc/process_heat(mob/living/M) /obj/machinery/shower/proc/process_heat(mob/living/M)
if(!on || !istype(M)) return if(!on || !istype(M)) return
@@ -310,8 +318,7 @@
if(honk_text) if(honk_text)
audible_message(span_maroon("[honk_text]")) audible_message(span_maroon("[honk_text]"))
src.add_fingerprint(user) src.add_fingerprint(user)
spawn(20) addtimer(VARSET_CALLBACK(src, spam_flag, 0), 20, TIMER_DELETE_ME)
spam_flag = 0
return return
//Admin spawn duckies //Admin spawn duckies
@@ -327,7 +334,7 @@
/obj/item/bikehorn/rubberducky/red/attack_self(mob/user as mob) /obj/item/bikehorn/rubberducky/red/attack_self(mob/user as mob)
if(honk_count >= 3) if(honk_count >= 3)
var/turf/epicenter = src.loc var/turf/epicenter = get_turf(src)
explosion(epicenter, 0, 0, 1, 3) explosion(epicenter, 0, 0, 1, 3)
qdel(src) qdel(src)
return return
@@ -338,8 +345,7 @@
if(honk_text) if(honk_text)
audible_message(span_maroon("[honk_text]")) audible_message(span_maroon("[honk_text]"))
honk_count ++ honk_count ++
spawn(20) addtimer(VARSET_CALLBACK(src, spam_flag, 0), 20, TIMER_DELETE_ME)
spam_flag = 0
return return
/obj/item/bikehorn/rubberducky/blue /obj/item/bikehorn/rubberducky/blue
@@ -360,8 +366,7 @@
if(honk_text) if(honk_text)
audible_message(span_maroon("[honk_text]")) audible_message(span_maroon("[honk_text]"))
src.add_fingerprint(user) src.add_fingerprint(user)
spawn(20) addtimer(VARSET_CALLBACK(src, spam_flag, 0), 20, TIMER_DELETE_ME)
spam_flag = 0
return return
/obj/item/bikehorn/rubberducky/pink /obj/item/bikehorn/rubberducky/pink
@@ -386,8 +391,7 @@
user.drop_item() user.drop_item()
user.forceMove(src) user.forceMove(src)
to_chat(user, span_vnotice("You have been swallowed alive by the rubber ducky. Your entire body compacted up and squeezed into the tiny space that makes up the oddly realistic and not at all rubbery stomach. The walls themselves are kneading over you, grinding some sort of fluids into your trapped body. You can even hear the sound of bodily functions echoing around you...")) to_chat(user, span_vnotice("You have been swallowed alive by the rubber ducky. Your entire body compacted up and squeezed into the tiny space that makes up the oddly realistic and not at all rubbery stomach. The walls themselves are kneading over you, grinding some sort of fluids into your trapped body. You can even hear the sound of bodily functions echoing around you..."))
spawn(20) addtimer(VARSET_CALLBACK(src, spam_flag, 0), 20, TIMER_DELETE_ME)
spam_flag = 0
return return
/obj/item/bikehorn/rubberducky/pink/container_resist(var/mob/living/escapee) /obj/item/bikehorn/rubberducky/pink/container_resist(var/mob/living/escapee)
@@ -455,8 +459,7 @@
if(honk_text) if(honk_text)
audible_message(span_maroon("[honk_text]")) audible_message(span_maroon("[honk_text]"))
src.add_fingerprint(user) src.add_fingerprint(user)
spawn(20) addtimer(VARSET_CALLBACK(src, spam_flag, 0), 20, TIMER_DELETE_ME)
spam_flag = 0
return return
/obj/item/bikehorn/rubberducky/white /obj/item/bikehorn/rubberducky/white
@@ -476,8 +479,6 @@
if(honk_text) if(honk_text)
audible_message(span_maroon("[honk_text]")) audible_message(span_maroon("[honk_text]"))
src.add_fingerprint(user) src.add_fingerprint(user)
spawn(20)
spam_flag = 0 //leaving this in incase it doesn't qdel somehow
qdel(src) qdel(src)
return return
@@ -487,25 +488,8 @@
icon = 'icons/obj/watercloset.dmi' icon = 'icons/obj/watercloset.dmi'
icon_state = "rubberducky_black" icon_state = "rubberducky_black"
item_state = "rubberducky_black" item_state = "rubberducky_black"
det_time = 20 light_sound = 'sound/voice/quack.ogg'
var/honk_text = 0 blast_sound = 'sound/voice/quack.ogg'
/obj/item/grenade/anti_photon/rubberducky/black/detonate()
playsound(src, 'sound/voice/quack.ogg', 50, 1, 5)
set_light(10, -10, "#FFFFFF")
var/extra_delay = rand(0,90)
spawn(extra_delay)
spawn(200)
if(prob(10+extra_delay))
set_light(10, 10, "#[num2hex(rand(64,255))][num2hex(rand(64,255))][num2hex(rand(64,255))]")
spawn(210)
..()
playsound(src, 'sound/voice/quack.ogg', 50, 1, 5)
if(honk_text)
audible_message(span_maroon("[honk_text]"))
qdel(src)
/obj/structure/sink /obj/structure/sink
name = "sink" name = "sink"

View File

@@ -38,7 +38,6 @@
/mob/living/silicon/robot/proc/use_power() /mob/living/silicon/robot/proc/use_power()
// Debug only // Debug only
// to_world("DEBUG: life.dm line 35: cyborg use_power() called at tick [controller_iteration]")
used_power_this_tick = 0 used_power_this_tick = 0
for(var/V in components) for(var/V in components)
var/datum/robot_component/C = components[V] var/datum/robot_component/C = components[V]