Ports over Timer Subsystem

This commit is contained in:
Fox McCloud
2018-04-28 20:26:04 -04:00
parent 580d5b353d
commit cfe182a1f7
63 changed files with 642 additions and 209 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
update_self()
forceMove(mob_info.spawn_point)
if(!mob_info.is_trap)
addtimer(src, "despawn", mob_info.lifetime)
addtimer(CALLBACK(src, .proc/despawn), mob_info.lifetime)
/obj/effect/nanomob/proc/update_self()
if(!mob_info)
@@ -12,7 +12,7 @@
var/water_timer = 0
/obj/effect/waterfall/New()
water_timer = addtimer(src, "drip", water_frequency)
water_timer = addtimer(CALLBACK(src, .proc/drip), water_frequency, TIMER_STOPPABLE)
/obj/effect/waterfall/Destroy()
if(water_timer)
@@ -25,4 +25,4 @@
W.dir = dir
spawn(1)
W.loc = get_step(W, dir)
water_timer = addtimer(src, "drip", water_frequency)
water_timer = addtimer(CALLBACK(src, .proc/drip), water_frequency, TIMER_STOPPABLE)
@@ -238,7 +238,7 @@
return null
D.occupant = occupant
D.roomtimer = addtimer(src, "process_room", PAY_INTERVAL, 0, roomid)
D.roomtimer = addtimer(CALLBACK(src, .proc/process_room, roomid), PAY_INTERVAL, TIMER_STOPPABLE)
vacant_rooms -= D
guests[occupant] = roomid
@@ -252,7 +252,7 @@
return
if(D.account.charge(100, transaction_purpose = "10 minutes", dest_name = name))
D.roomtimer = addtimer(src, "process_room", PAY_INTERVAL, 0, roomid)
D.roomtimer = addtimer(CALLBACK(src, .proc/process_room, roomid), PAY_INTERVAL, TIMER_STOPPABLE)
else
force_checkout(roomid)
+2 -2
View File
@@ -11,7 +11,7 @@
dream_images += pick_n_take(dreams)
dreaming++
for(var/i in 1 to dream_images.len)
addtimer(src, "experience_dream", ((i - 1) * rand(30,60)), FALSE, dream_images[i], FALSE)
addtimer(CALLBACK(src, .proc/experience_dream, dream_images[i], FALSE), ((i - 1) * rand(30,60)))
return TRUE
@@ -33,7 +33,7 @@
dream_images += pick_n_take(nightmares)
nightmare++
for(var/i in 1 to dream_images.len)
addtimer(src, "experience_dream", ((i - 1) * rand(30,60)), FALSE, nightmares[i], TRUE)
addtimer(CALLBACK(src, .proc/experience_dream, nightmares[i], TRUE), ((i - 1) * rand(30,60)))
return TRUE
/mob/living/carbon/proc/handle_dreams()
+5 -5
View File
@@ -339,7 +339,7 @@ Gunshots/explosions/opening doors/less rare audio (done)
s.loc = get_step(get_turf(s), get_dir(s, target))
s.Show()
s.Eat()
addtimer(src, "wake_and_restore", rand(50, 100))
addtimer(CALLBACK(src, .proc/wake_and_restore), rand(50, 100))
qdel(s)
/obj/effect/hallucination/simple/singularity
@@ -365,9 +365,9 @@ Gunshots/explosions/opening doors/less rare audio (done)
for(var/i=0,i<hits,i++)
target.playsound_local(null, 'sound/weapons/Laser.ogg', 25, 1)
if(prob(75))
addtimer(target, "playsound_local", rand(10,20), null, 'sound/weapons/sear.ogg', 25, 1)
addtimer(CALLBACK(target, /mob/.proc/playsound_local, null, 'sound/weapons/sear.ogg', 25, 1), rand(10,20))
else
addtimer(target, "playsound_local", rand(10,20), null, 'sound/weapons/effects/searwall.ogg', 25, 1)
addtimer(CALLBACK(target, /mob/.proc/playsound_local, null, 'sound/weapons/effects/searwall.ogg', 25, 1), rand(10,20))
sleep(rand(CLICK_CD_RANGE, CLICK_CD_RANGE + 8))
target.playsound_local(null, get_sfx("bodyfall"), 25)
if(2) //Esword fight
@@ -381,9 +381,9 @@ Gunshots/explosions/opening doors/less rare audio (done)
for(var/i=0,i<hits,i++)
target.playsound_local(null, get_sfx("gunshot"), 25)
if(prob(75))
addtimer(target, "playsound_local", rand(10,20), null, 'sound/weapons/pierce.ogg', 25, 1)
addtimer(CALLBACK(target, /mob/.proc/playsound_local, null, 'sound/weapons/pierce.ogg', 25, 1), rand(10,20))
else
addtimer(target, "playsound_local", rand(10,20), null, "ricochet", 25, 1)
addtimer(CALLBACK(target, /mob/.proc/playsound_local, null, "ricochet", 25, 1), rand(10,20))
sleep(rand(CLICK_CD_RANGE, CLICK_CD_RANGE + 8))
target.playsound_local(null, get_sfx("bodyfall"), 25, 1)
if(4) //Stunprod + cablecuff
+1 -1
View File
@@ -117,7 +117,7 @@
C.throw_mode_on()
icon_state = "firelemon_active"
playsound(loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)
addtimer(src, "prime", rand(10, 60))
addtimer(CALLBACK(src, .proc/prime), rand(10, 60))
/obj/item/reagent_containers/food/snacks/grown/firelemon/burn()
prime()
+1 -1
View File
@@ -45,7 +45,7 @@
name = harvested_name
desc = harvested_desc
harvested = TRUE
addtimer(src, "regrow", rand(regrowth_time_low, regrowth_time_high))
addtimer(CALLBACK(src, .proc/regrow), rand(regrowth_time_low, regrowth_time_high))
return 1
/obj/structure/flora/ash/proc/regrow()
+1 -1
View File
@@ -793,7 +793,7 @@
/mob/living/proc/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash)
if(check_eye_prot() < intensity && (override_blindness_check || !(disabilities & BLIND)))
overlay_fullscreen("flash", type)
addtimer(src, "clear_fullscreen", 25, FALSE, "flash", 25)
addtimer(CALLBACK(src, .proc/clear_fullscreen, "flash", 25), 25)
return 1
/mob/living/proc/check_eye_prot()
@@ -527,7 +527,7 @@ Pass a positive integer as an argument to override a bot's default speed.
turn_on() //Saves the AI the hassle of having to activate a bot manually.
access_card = all_access //Give the bot all-access while under the AI's command.
if(client)
reset_access_timer_id = addtimer(src, "bot_reset", 600) //if the bot is player controlled, they get the extra access for a limited time
reset_access_timer_id = addtimer(CALLBACK (src, .proc/bot_reset), 600, TIMER_OVERRIDE|TIMER_STOPPABLE) //if the bot is player controlled, they get the extra access for a limited time
to_chat(src, "<span class='notice'><span class='big'>Priority waypoint set by [calling_ai] <b>[caller]</b>. Proceed to <b>[end_area.name]</b>.</span><br>[path.len-1] meters to destination. You have been granted additional door access for 60 seconds.</span>")
if(message)
to_chat(calling_ai, "<span class='notice'>[bicon(src)] [name] called to [end_area.name]. [path.len-1] meters to destination.</span>")
@@ -62,7 +62,7 @@
/obj/item/organ/internal/hivelord_core/New()
..()
addtimer(src, "inert_check", 2400)
addtimer(CALLBACK(src, .proc/inert_check), 2400)
/obj/item/organ/internal/hivelord_core/proc/inert_check()
if(!owner && !preserved)
@@ -151,7 +151,7 @@
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/New()
..()
addtimer(src, "death", 100)
addtimer(CALLBACK(src, .proc/death), 100)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood
name = "blood brood"
@@ -270,8 +270,8 @@ var/global/list/ts_spiderling_list = list()
else
ts_count_alive_station++
// after 30 seconds, assuming nobody took control of it yet, offer it to ghosts.
addtimer(src, "CheckFaction", 150)
addtimer(src, "announcetoghosts", 300)
addtimer(CALLBACK(src, .proc/CheckFaction), 100)
addtimer(CALLBACK(src, .proc/announcetoghosts), 300)
var/datum/atom_hud/U = huds[DATA_HUD_MEDICAL_ADVANCED]
U.add_hud_to(src)
@@ -22,7 +22,7 @@
for(var/turf/T in anchors)
var/datum/beam/B = Beam(T, "vine", time=INFINITY, maxdistance=5, beam_type=/obj/effect/ebeam/vine)
B.sleep_time = 10 //these shouldn't move, so let's slow down updates to 1 second (any slower and the deletion of the vines would be too slow)
addtimer(src, "bear_fruit", growth_time)
addtimer(CALLBACK(src, .proc/bear_fruit), growth_time)
/obj/structure/alien/resin/flower_bud_enemy/proc/bear_fruit()
visible_message("<span class='danger'>the plant has borne fruit!</span>")
+1 -2
View File
@@ -1004,8 +1004,7 @@
return
to_chat(malf, "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process.")
malf.malfhack = src
malf.malfhacking = addtimer(malf, "malfhacked", 600, FALSE, src)
malf.malfhacking = addtimer(CALLBACK(malf, /mob/living/silicon/ai/.proc/malfhacked, src), 600, TIMER_STOPPABLE)
var/obj/screen/alert/hackingapc/A
A = malf.throw_alert("hackingapc", /obj/screen/alert/hackingapc)
A.target = src
+1 -1
View File
@@ -66,7 +66,7 @@
flick("coilhit", src)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 100, 1, extrarange = 5)
tesla_zap(src, 5, power_produced)
addtimer(src, "reset_shocked", 10)
addtimer(CALLBACK(src, .proc/reset_shocked), 10)
else
..()
+1 -1
View File
@@ -83,7 +83,7 @@
energy_to_raise = energy_to_raise * 1.25
playsound(src.loc, 'sound/magic/lightning_chargeup.ogg', 100, 1, extrarange = 30)
addtimer(src, "new_mini_ball", 100)
addtimer(CALLBACK(src, .proc/new_mini_ball), 100)
else if(energy < energy_to_lower && orbiting_balls.len)
energy_to_raise = energy_to_raise / 1.25
+1 -1
View File
@@ -887,7 +887,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
//helper proc that guarantees the wait message will not freeze the UI
/obj/machinery/computer/rdconsole/proc/add_wait_message(message, delay)
wait_message = message
wait_message_timer = addtimer(src, "clear_wait_message", delay, TRUE)
wait_message_timer = addtimer(CALLBACK(src, .proc/clear_wait_message), delay, TIMER_UNIQUE | TIMER_STOPPABLE)
// This is here to guarantee that we never lock the console, so long as the timer
// process is running
+11 -11
View File
@@ -17,18 +17,18 @@
return 0
/obj/machinery/door/airlock/onShuttleMove()
. = ..()
if(!.)
return
addtimer(src, "close", 0, TRUE, 0, 1)
// Close any nearby airlocks as well
for(var/obj/machinery/door/airlock/D in orange(1, src))
addtimer(D, "close", 0, TRUE, 0, 1)
. = ..()
if(!.)
return
INVOKE_ASYNC(src, .proc/close, 0, 1)
// Close any nearby airlocks as well
for(var/obj/machinery/door/airlock/D in orange(1, src))
INVOKE_ASYNC(src, .proc/close, 0, 1)
/obj/machinery/door/airlock/onShuttleMove()
. = ..()
if(id_tag == "s_docking_airlock")
addtimer(src, "lock", 0, TRUE)
. = ..()
if(id_tag == "s_docking_airlock")
INVOKE_ASYNC(src, .proc/lock)
/mob/onShuttleMove()
if(!move_on_shuttle)
@@ -57,7 +57,7 @@
/obj/machinery/door/airlock/postDock(obj/docking_port/stationary/S1)
. = ..()
if(!S1.lock_shuttle_doors && id_tag == "s_docking_airlock")
addtimer(src, "unlock", 0, TRUE)
INVOKE_ASYNC(src, .proc/unlock)
// Shuttle Rotation //
/atom/proc/shuttleRotate(rotation)
+1 -1
View File
@@ -290,7 +290,7 @@
if(H.nutrition >= NUTRITION_LEVEL_WELL_FED)
to_chat(user, "<span class='warning'>You are already fully charged!</span>")
else
addtimer(src, "powerdraw_loop", 0, TRUE, A, H)
INVOKE_ASYNC(src, .proc/powerdraw_loop, A, H)
else
to_chat(user, "<span class='warning'>There is no charge to draw from that APC.</span>")
else
+1 -1
View File
@@ -7,7 +7,7 @@
return
else
bleedsuppress = TRUE
addtimer(src, "resume_bleeding", amount)
addtimer(CALLBACK(src, .proc/resume_bleeding), amount)
/mob/living/carbon/human/proc/resume_bleeding()
bleedsuppress = FALSE
+1 -1
View File
@@ -26,7 +26,7 @@ var/list/GPS_list = list()
emped = 1
overlays -= "working"
overlays += "emp"
addtimer(src, "reboot", 300)
addtimer(CALLBACK(src, .proc/reboot), 300)
/obj/item/gps/proc/reboot()
emped = FALSE