[MIRROR] Refactors do_after w/ TG's do_after (#11486)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-22 17:35:16 -07:00
committed by GitHub
parent c1fffe13f3
commit f85a202d80
91 changed files with 558 additions and 310 deletions

View File

@@ -176,7 +176,7 @@
CRASH("item add_item_action got a type or instance of something that wasn't an action.")
LAZYADD(actions, action)
RegisterSignal(action, COMSIG_PARENT_QDELETING, PROC_REF(on_action_deleted))
RegisterSignal(action, COMSIG_QDELETING, PROC_REF(on_action_deleted))
if(ismob(loc))
// We're being held or are equipped by someone while adding an action?
// Then they should also probably be granted the action, given it's in a correct slot
@@ -190,7 +190,7 @@
if(!action)
return
UnregisterSignal(action, COMSIG_PARENT_QDELETING)
UnregisterSignal(action, COMSIG_QDELETING)
LAZYREMOVE(actions, action)
qdel(action)

View File

@@ -155,7 +155,7 @@
return FALSE
if(!target.mind)
user.visible_message("[user] gently presses [src] to [target]...", runemessage = "presses [src] to [target]")
if(do_after(user, revive_time, exclusive = TASK_USER_EXCLUSIVE, target = target))
if(do_after(user, revive_time, target = target))
target.faction = user.faction
target.revivedby = user.name
target.ghostjoin = 1
@@ -176,7 +176,7 @@
/obj/item/denecrotizer/proc/ghostjoin_rez(mob/living/simple_mob/target, mob/living/user)
user.visible_message("[user] gently presses [src] to [target]...", runemessage = "presses [src] to [target]")
if(do_after(user, revive_time, exclusive = TASK_ALL_EXCLUSIVE, target = target))
if(do_after(user, revive_time, target = target))
target.faction = user.faction
target.revivedby = user.name
target.revive()
@@ -199,7 +199,7 @@
/obj/item/denecrotizer/proc/basic_rez(mob/living/simple_mob/target, mob/living/user) //so medical can have a way to bring back people's pets or whatever, does not change any settings about the mob or offer it to ghosts.
user.visible_message("[user] presses [src] to [target]...", runemessage = "presses [src] to [target]")
if(do_after(user, revive_time, exclusive = TASK_ALL_EXCLUSIVE, target = target))
if(do_after(user, revive_time, target = target))
target.revive()
target.sight = initial(target.sight)
target.see_in_dark = initial(target.see_in_dark)

View File

@@ -413,7 +413,7 @@
balloon_alert(user, "you can't apply a splint to the arm you're using!")
return
user.balloon_alert_visible("[user] starts to apply \the [src] to their [limb].", "applying \the [src] to your [limb].", "You hear something being wrapped.")
if(do_after(user, 50, M, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user, 50, M))
if(affecting.splinted)
balloon_alert(user, "[M]'s [limb] is already splinted!")
return

View File

@@ -17,7 +17,7 @@
if (istype(M,/mob/living/silicon/robot)) //Repairing cyborgs
var/mob/living/silicon/robot/R = M
if (R.getBruteLoss() || R.getFireLoss())
if(do_after(user, 7 * toolspeed, R, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 7 * toolspeed, R))
R.adjustBruteLoss(-15)
R.adjustFireLoss(-15)
R.updatehealth()
@@ -51,9 +51,9 @@
else if(can_use(1))
user.setClickCooldown(user.get_attack_speed(src))
if(S.open >= 2)
if(do_after(user, 5 * toolspeed, S, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 5 * toolspeed, S))
S.heal_damage(restoration_internal, restoration_internal, robo_repair = 1)
else if(do_after(user, 5 * toolspeed, S, exclusive = TASK_ALL_EXCLUSIVE))
else if(do_after(user, 5 * toolspeed, S))
S.heal_damage(restoration_external,restoration_external, robo_repair =1)
H.updatehealth()
use(1)

View File

@@ -31,11 +31,11 @@
if(bound_mob in contents)
unleash()
to_chat(bound_mob, span_notice("You feel like yourself again. You are no longer under the influence of \the [src]'s command."))
UnregisterSignal(bound_mob, COMSIG_PARENT_QDELETING)
UnregisterSignal(bound_mob, COMSIG_QDELETING)
bound_mob.capture_caught = FALSE
bound_mob = null
if(owner)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
UnregisterSignal(owner, COMSIG_QDELETING)
owner = null
return ..()
@@ -156,7 +156,7 @@
else
M.visible_message("\The [src] flickers in \the [M]'s hand and emits a little tone.", "\The [src] flickers in your hand and emits a little tone.")
playsound(src, 'sound/effects/capture-crystal-out.ogg', 75, 1, -1)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
UnregisterSignal(owner, COMSIG_QDELETING)
owner = null
//Let's make inviting ghosts be an option you can do instead of an automatic thing!
@@ -251,8 +251,8 @@
//Make it so the crystal knows if its mob references get deleted to make sure things get cleaned up
/obj/item/capture_crystal/proc/knowyoursignals(mob/living/M, mob/living/U)
RegisterSignal(M, COMSIG_PARENT_QDELETING, PROC_REF(mob_was_deleted), TRUE)
RegisterSignal(U, COMSIG_PARENT_QDELETING, PROC_REF(owner_was_deleted), TRUE)
RegisterSignal(M, COMSIG_QDELETING, PROC_REF(mob_was_deleted), TRUE)
RegisterSignal(U, COMSIG_QDELETING, PROC_REF(owner_was_deleted), TRUE)
//The basic capture command does most of the registration work.
/obj/item/capture_crystal/proc/capture(mob/living/M, mob/living/U)
@@ -337,8 +337,8 @@
//The clean up procs!
/obj/item/capture_crystal/proc/mob_was_deleted()
SIGNAL_HANDLER
UnregisterSignal(bound_mob, COMSIG_PARENT_QDELETING)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
UnregisterSignal(bound_mob, COMSIG_QDELETING)
UnregisterSignal(owner, COMSIG_QDELETING)
bound_mob.capture_caught = FALSE
bound_mob = null
owner = null
@@ -348,7 +348,7 @@
/obj/item/capture_crystal/proc/owner_was_deleted()
SIGNAL_HANDLER
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
UnregisterSignal(owner, COMSIG_QDELETING)
owner = null
active = FALSE
update_icon()

View File

@@ -23,7 +23,7 @@
if(user.get_active_hand() == src || user.get_inactive_hand() == src)
return TRUE // Skip delay
if(insert_delay && !do_after(user, insert_delay, src, needhand = TRUE, exclusive = TASK_USER_EXCLUSIVE))
if(insert_delay && !do_after(user, insert_delay, src))
return FALSE // Moved while there is a delay
return TRUE //Now we're allowed to put the item in the pouch
@@ -33,7 +33,7 @@
if(user.get_active_hand() == src || user.get_inactive_hand() == src)
return TRUE // Skip delay
if(remove_delay && !do_after(user, remove_delay, src, needhand = TRUE, exclusive = TASK_USER_EXCLUSIVE))
if(remove_delay && !do_after(user, remove_delay, src))
return FALSE // Moved while there is a delay
if(W in src)

View File

@@ -121,7 +121,7 @@
/obj/effect/energy_net/user_unbuckle_mob(mob/living/buckled_mob, mob/user)
user.setClickCooldown(user.get_attack_speed())
visible_message(span_danger("[user] begins to tear at \the [src]!"))
if(do_after(user, escape_time, src, incapacitation_flags = INCAPACITATION_DEFAULT & ~(INCAPACITATION_RESTRAINED | INCAPACITATION_BUCKLED_FULLY)))
if(do_after(user, escape_time, src, timed_action_flags = IGNORE_INCAPACITATED))
if(!has_buckled_mobs())
return
visible_message(span_danger("[user] manages to tear \the [src] apart!"))

View File

@@ -145,7 +145,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
if(!choice)
return
to_chat(user,span_notice("You begin moving..."))
if(!do_after(user, 10 SECONDS, exclusive = TRUE))
if(!do_after(user, 10 SECONDS))
return
user.forceMove(choice)
user.cancel_camera()
@@ -179,7 +179,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
if(!can_enter(user))
user.visible_message(span_warning("\The [user] reaches into \the [src]. . ."),span_warning("You reach into \the [src]. . ."))
if(!do_after(user, 3 SECONDS, exclusive = TRUE))
if(!do_after(user, 3 SECONDS))
user.visible_message(span_notice("\The [user] pulls their hand out of \the [src]."),span_warning("You pull your hand out of \the [src]"))
return
if(!src.contents.len)
@@ -218,7 +218,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
return
user.visible_message(span_notice("\The [user] begins climbing into \the [src]!"))
if(!do_after(user, 10 SECONDS, exclusive = TRUE))
if(!do_after(user, 10 SECONDS))
to_chat(user, span_warning("You didn't go into \the [src]!"))
return
@@ -245,7 +245,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
var/mob/living/k = M
k.visible_message(span_notice("\The [k] begins climbing into \the [src]!"))
if(!do_after(k, 3 SECONDS, exclusive = TRUE))
if(!do_after(k, 3 SECONDS))
to_chat(k, span_warning("You didn't go into \the [src]!"))
return
@@ -341,7 +341,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
if(!choice)
return
to_chat(usr,span_notice("You begin moving..."))
if(!do_after(usr, 10 SECONDS, exclusive = TRUE))
if(!do_after(usr, 10 SECONDS))
return
if(QDELETED(src))
return
@@ -379,7 +379,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
if(!(usr.mob_size <= MOB_TINY || usr.get_effective_size(TRUE) <= micro_accepted_scale))
usr.visible_message(span_warning("\The [usr] reaches into \the [src]. . ."),span_warning("You reach into \the [src]. . ."))
if(!do_after(usr, 3 SECONDS, exclusive = TRUE))
if(!do_after(usr, 3 SECONDS))
usr.visible_message(span_notice("\The [usr] pulls their hand out of \the [src]."),span_warning("You pull your hand out of \the [src]"))
return
@@ -420,7 +420,7 @@ GLOBAL_LIST_EMPTY(micro_tunnels)
return
usr.visible_message(span_notice("\The [usr] begins climbing into \the [src]!"))
if(!do_after(usr, 10 SECONDS, exclusive = TRUE))
if(!do_after(usr, 10 SECONDS))
to_chat(usr, span_warning("You didn't go into \the [src]!"))
return

View File

@@ -177,7 +177,7 @@
playsound(src, WT.usesound, 50, 1)
if(istext(glass))
user.visible_message("[user] welds the [glass] plating off the airlock assembly.", "You start to weld the [glass] plating off the airlock assembly.")
if(do_after(user, 4 SECONDS * WT.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * WT.toolspeed, src))
if(!src || !WT.isOn()) return
to_chat(user, span_notice("You welded the [glass] plating off!"))
var/M = text2path("/obj/item/stack/material/[glass]")
@@ -185,14 +185,14 @@
glass = 0
else if(glass == 1)
user.visible_message("[user] welds the glass panel out of the airlock assembly.", "You start to weld the glass panel out of the airlock assembly.")
if(do_after(user, 4 SECONDS * WT.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * WT.toolspeed, src))
if(!src || !WT.isOn()) return
to_chat(user, span_notice("You welded the glass panel out!"))
new /obj/item/stack/material/glass/reinforced(src.loc)
glass = 0
else if(!anchored)
user.visible_message("[user] dissassembles the airlock assembly.", "You start to dissassemble the airlock assembly.")
if(do_after(user, 4 SECONDS * WT.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * WT.toolspeed, src))
if(!src || !WT.isOn()) return
to_chat(user, span_notice("You dissasembled the airlock assembly!"))
new /obj/item/stack/material/steel(src.loc, 4)
@@ -208,7 +208,7 @@
else
user.visible_message("[user] begins securing the airlock assembly to the floor.", "You starts securing the airlock assembly to the floor.")
if(do_after(user, 4 SECONDS * W.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * W.toolspeed, src))
if(!src) return
to_chat(user, span_notice("You [anchored? "un" : ""]secured the airlock assembly!"))
anchored = !anchored
@@ -219,7 +219,7 @@
to_chat(user, span_warning("You need one length of coil to wire the airlock assembly."))
return
user.visible_message("[user] wires the airlock assembly.", "You start to wire the airlock assembly.")
if(do_after(user, 4 SECONDS, src, exclusive = TASK_ALL_EXCLUSIVE) && state == 0 && anchored)
if(do_after(user, 4 SECONDS, src) && state == 0 && anchored)
if (C.use(1))
src.state = 1
to_chat(user, span_notice("You wire the airlock."))
@@ -228,7 +228,7 @@
playsound(src, W.usesound, 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
if(do_after(user, 4 SECONDS * W.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * W.toolspeed, src))
if(!src) return
to_chat(user, span_notice("You cut the airlock wires.!"))
new/obj/item/stack/cable_coil(src.loc, 1)
@@ -238,7 +238,7 @@
playsound(src, W.usesound, 100, 1)
user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly.")
if(do_after(user, 4 SECONDS, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS, src))
if(!src) return
user.drop_item()
W.loc = src
@@ -256,7 +256,7 @@
playsound(src, W.usesound, 100, 1)
user.visible_message("\The [user] starts removing the electronics from the airlock assembly.", "You start removing the electronics from the airlock assembly.")
if(do_after(user, 4 SECONDS * W.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * W.toolspeed, src))
if(!src) return
to_chat(user, span_notice("You removed the airlock electronics!"))
src.state = 1
@@ -271,7 +271,7 @@
if(material_name == MAT_RGLASS)
playsound(src, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 4 SECONDS, src, exclusive = TASK_ALL_EXCLUSIVE) && !glass)
if(do_after(user, 4 SECONDS, src) && !glass)
if (S.use(1))
to_chat(user, span_notice("You installed reinforced glass windows into the airlock assembly."))
glass = 1
@@ -283,7 +283,7 @@
if(S.get_amount() >= 2)
playsound(src, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 4 SECONDS, src, exclusive = TASK_ALL_EXCLUSIVE) && !glass)
if(do_after(user, 4 SECONDS, src) && !glass)
if (S.use(2))
to_chat(user, span_notice("You installed [material_display_name(material_name)] plating into the airlock assembly."))
glass = material_name
@@ -292,7 +292,7 @@
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now finishing the airlock."))
if(do_after(user, 4 SECONDS * W.toolspeed, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 4 SECONDS * W.toolspeed, src))
if(!src) return
to_chat(user, span_notice("You finish the airlock!"))
var/path

View File

@@ -120,7 +120,7 @@
if(O.has_tool_quality(TOOL_WRENCH))
if(finished)
to_chat(user, span_notice("You start breaking down \the [src]."))
if(do_after(user, 10 SECONDS, src, exclusive = TASK_ALL_EXCLUSIVE))
if(do_after(user, 10 SECONDS, src))
new /obj/item/stack/material/plasteel(loc, 10)
playsound(user, O.usesound, 50, 1)
qdel(src)

View File

@@ -152,20 +152,20 @@
if(anchored && !reinf_material)
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now disassembling the girder..."))
if(do_after(user,(35 + round(max_health/50)) * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,(35 + round(max_health/50)) * W.toolspeed))
if(!src) return
to_chat(user, span_notice("You dissasembled the girder!"))
dismantle()
else if(!anchored)
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now securing the girder..."))
if(do_after(user, 40 * W.toolspeed, src, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user, 40 * W.toolspeed, src))
to_chat(user, span_notice("You secured the girder!"))
reset_girder()
else if(istype(W, /obj/item/pickaxe/plasmacutter))
to_chat(user, span_notice("Now slicing apart the girder..."))
if(do_after(user,30 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,30 * W.toolspeed))
if(!src) return
to_chat(user, span_notice("You slice apart the girder!"))
dismantle()
@@ -178,7 +178,7 @@
if(state == 2)
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now unsecuring support struts..."))
if(do_after(user,40 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,40 * W.toolspeed))
if(!src) return
to_chat(user, span_notice("You unsecured the support struts!"))
state = 1
@@ -190,7 +190,7 @@
else if(W.has_tool_quality(TOOL_WIRECUTTER) && state == 1)
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now removing support struts..."))
if(do_after(user,40 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,40 * W.toolspeed))
if(!src) return
to_chat(user, span_notice("You removed the support struts!"))
reinf_material.place_dismantled_product(get_turf(src))
@@ -200,7 +200,7 @@
else if(W.has_tool_quality(TOOL_CROWBAR) && state == 0 && anchored)
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now dislodging the girder..."))
if(do_after(user, 40 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user, 40 * W.toolspeed))
if(!src) return
to_chat(user, span_notice("You dislodged the girder!"))
displace()
@@ -251,7 +251,7 @@
to_chat(user, span_notice("You begin adding the plating..."))
if(!do_after(user,time_to_reinforce, exclusive = TASK_USER_EXCLUSIVE) || !S.use(amount_to_use))
if(!do_after(user,time_to_reinforce) || !S.use(amount_to_use))
return TRUE //once we've gotten this far don't call parent attackby()
if(anchored)
@@ -285,7 +285,7 @@
return 0
to_chat(user, span_notice("Now reinforcing..."))
if (!do_after(user,40, exclusive = TASK_USER_EXCLUSIVE) || !S.use(1))
if (!do_after(user,40) || !S.use(1))
return 1 //don't call parent attackby() past this point
to_chat(user, span_notice("You added reinforcement!"))
@@ -351,13 +351,13 @@
if(W.has_tool_quality(TOOL_WRENCH))
playsound(src, W.usesound, 100, 1)
to_chat(user, span_notice("Now disassembling the girder..."))
if(do_after(user,40 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,40 * W.toolspeed))
to_chat(user, span_notice("You dissasembled the girder!"))
dismantle()
else if(istype(W, /obj/item/pickaxe/plasmacutter))
to_chat(user, span_notice("Now slicing apart the girder..."))
if(do_after(user,30 * W.toolspeed, exclusive = TASK_USER_EXCLUSIVE))
if(do_after(user,30 * W.toolspeed))
to_chat(user, span_notice("You slice apart the girder!"))
dismantle()

View File

@@ -172,7 +172,7 @@
to_chat(user, span_warning("You need at least two rods to do this."))
return
to_chat(user, span_notice("Assembling grille..."))
if(!do_after(user, 1 SECONDS, R, exclusive = TASK_ALL_EXCLUSIVE))
if(!do_after(user, 1 SECONDS, R))
return
if(!R.use(2))
return
@@ -192,7 +192,7 @@
to_chat(user, span_warning("You need at least four sheets of glass to do this."))
return
to_chat(user, span_notice("Assembling window..."))
if(!do_after(user, 4 SECONDS, G, exclusive = TASK_ALL_EXCLUSIVE))
if(!do_after(user, 4 SECONDS, G))
return
if(!G.use(4))
return