Makes uses of do_after sane (#18334)

* Prevents insta-actions

* Do_after sanity

NOTE: NUKE do_after_action

* Update bonfire.dm

* The  rest of them

Also fixes a tpyo

* no minitest :)

* .

* .

* Gets rid of the slowdown for now

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
Cameron Lennox
2025-09-08 02:25:08 +02:00
committed by GitHub
co-authored by Kashargul
parent 736fe6ef28
commit d73f6b8dbd
330 changed files with 682 additions and 690 deletions
@@ -105,7 +105,7 @@ AI MODULES
R.visible_message(span_danger("\The [user] slides a law module into \the [R]."))
to_chat(R, span_danger("Local law upload in progress."))
to_chat(user, span_notice("Uploading laws from board. This will take a moment..."))
if(do_after(user, 10 SECONDS))
if(do_after(user, 10 SECONDS, target = src))
transmitInstructions(R, user)
to_chat(R, "These are your laws now:")
R.show_laws()
+1 -1
View File
@@ -96,7 +96,7 @@ var/list/RMS_random_malfunction = list(/obj/item/fbp_backup_cell,
to_chat(user, span_notice("The battery has no charge."))
else
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2,target = C))
if(do_after(user, 2, target = C))
stored_charge += C.charge
if(C.charge > charge_needed) //We only drain what we need!
C.use(charge_needed)
+1 -1
View File
@@ -57,7 +57,7 @@
else
user.visible_message(span_warning("[user] begins to do [H]'s lips with \the [src]."), \
span_notice("You begin to apply \the [src]."))
if(do_after(user, 20, H)) //user needs to keep their active hand, H does not.
if(do_after(user, 2 SECONDS, target = H)) //user needs to keep their active hand, H does not.
user.visible_message(span_notice("[user] does [H]'s lips with \the [src]."), \
span_notice("You apply \the [src]."))
H.lip_style = colour
@@ -129,7 +129,7 @@
//addtimer(VARSET_CALLBACK(src, in_use , FALSE), 5 SECONDS, TIMER_DELETE_ME) //Leaving this for reference of how to do the timer here if do_after wasn't present.
if(!do_after(user,50))
if(!do_after(user, 5 SECONDS, target = src))
in_use = FALSE
return
@@ -53,7 +53,7 @@
to_chat(user, "Planting explosives...")
user.do_attack_animation(target)
if(do_after(user, 50) && in_range(user, target))
if(do_after(user, 5 SECONDS, target = target) && in_range(user, target))
user.drop_item()
src.target = target
loc = null
+2 -2
View File
@@ -79,7 +79,7 @@
user.visible_message(span_danger("\The [user] is attempting to put [cuff_type] on \the [H]!"))
if(!do_after(user,use_time))
if(!do_after(user, use_time, target = src))
return 0
if(!can_place(target, user)) //victim may have resisted out of the grab in the meantime
@@ -256,7 +256,7 @@ var/last_chew = 0
user.visible_message(span_danger("\The [user] is attempting to put [cuff_type] on \the [H]!"))
if(!do_after(user,use_time))
if(!do_after(user, use_time, target = src))
return 0
if(!can_place(target, user)) //victim may have resisted out of the grab in the meantime
@@ -54,7 +54,7 @@
user.do_attack_animation(M)
var/turf/T1 = get_turf(M)
if (T1 && ((M == user) || do_after(user, 50)))
if (T1 && ((M == user) || do_after(user, 5 SECONDS, target = M)))
if(user && M && (get_turf(M) == T1) && src && src.imp)
M.visible_message(span_warning("[M] has been implanted by [user]."))
@@ -30,12 +30,12 @@
visible_message("You start pulling the string on \the [src].", "[user] starts pulling the string on the [src].")
if(max_fuel <= 0)
if(do_after(user, 15))
if(do_after(user, 15, target = src))
to_chat(user, "\The [src] won't start!")
else
to_chat(user, "You fumble with the string.")
else
if(do_after(user, 15))
if(do_after(user, 15, target = src))
visible_message("You start \the [src] up with a loud grinding!", "[user] starts \the [src] up with a loud grinding!")
attack_verb = list("shredded", "ripped", "torn")
playsound(src, 'sound/weapons/chainsaw_startup.ogg',40,1)
@@ -89,7 +89,7 @@
Hyd.die()
if (istype(A, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,A) <= 1)
to_chat(user, span_notice("You begin filling the tank on the chainsaw."))
if(do_after(user, 15))
if(do_after(user, 15, target = src))
A.reagents.trans_to_obj(src, max_fuel)
playsound(src, 'sound/effects/refill.ogg', 50, 1, -6)
to_chat(user, span_notice("Chainsaw succesfully refueled."))
@@ -16,20 +16,20 @@
var/carving_1 = sanitizeSafe(tgui_input_text(user, "Who is \the [src.name] for?", "Gravestone Naming", null, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
if(carving_1)
user.visible_message("[user] starts carving \the [src.name].", "You start carving \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
if(do_after(user, material.hardness * W.toolspeed, target = src))
user.visible_message("[user] carves something into \the [src.name].", "You carve your message into \the [src.name].")
grave_name += carving_1
update_icon()
var/carving_2 = sanitizeSafe(tgui_input_text(user, "What message should \the [src.name] have?", "Epitaph Carving", null, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
if(carving_2)
user.visible_message("[user] starts carving \the [src.name].", "You start carving \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
if(do_after(user, material.hardness * W.toolspeed, target = src))
user.visible_message("[user] carves something into \the [src.name].", "You carve your message into \the [src.name].")
epitaph += carving_2
update_icon()
if(W.has_tool_quality(TOOL_WRENCH))
user.visible_message("[user] starts carving \the [src.name].", "You start carving \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
if(do_after(user, material.hardness * W.toolspeed, target = src))
material.place_dismantled_product(get_turf(src))
user.visible_message("[user] dismantles down \the [src.name].", "You dismantle \the [src.name].")
qdel(src)
@@ -66,7 +66,7 @@
return 0
else
to_chat(user, span_notice("You begin to place \the [src.name]."))
if(!do_after(user, 10))
if(!do_after(user, 1 SECOND, target = src))
return 0
var/obj/structure/gravemarker/G = new /obj/structure/gravemarker/(user.loc, src.get_material())
to_chat(user, span_notice("You place \the [src.name]."))
@@ -126,7 +126,7 @@
if(!fragile)
if(health < initial(health))
user.visible_message("[user] begins repairing \the [src].", "You begin repairing \the [src].")
if(do_after(user, repair_time))
if(do_after(user, repair_time, target = src))
user.visible_message("[user] has finished repairing \the [src]", "You finish repairing \the [src].")
health = min(health + repair_amount, initial(health))
dulled = 0
@@ -144,7 +144,7 @@
to_chat(M, "You should repair [src] first. Try using [kit] on it.")
return FALSE
M.visible_message("[M] begins to replace parts of [src] with [kit].", "You begin to replace parts of [src] with [kit].")
if(do_after(M, sharpen_time))
if(do_after(M, sharpen_time, target = src))
M.visible_message("[M] has finished replacing parts of [src].", "You finish replacing parts of [src].")
src.set_material(material)
return TRUE
@@ -93,7 +93,7 @@
user.put_in_hands(S)
else
to_chat(user, span_notice("You start compacting the snowball."))
if(do_after(user, 2 SECONDS))
if(do_after(user, 2 SECONDS, target = src))
var/atom/S = new /obj/item/material/snow/snowball/reinforced(user.loc)
qdel(src)
user.put_in_hands(S)
@@ -15,7 +15,7 @@
var/obj/item/stack/material/M = I
if(M.get_amount() >= 5)
to_chat(user, "You begin to refine the [src] with [M]...")
if(do_after(user, 70))
if(do_after(user, 7 SECONDS, target = src))
M.use(5)
var/obj/item/SK
SK = new /obj/item/material/sharpeningkit(get_turf(user), M.material.name)
@@ -198,7 +198,7 @@
if(!user.IsAdvancedToolUser())
return
if(!status && bcell && bcell.charge >= hitcost)
if(do_after(user, charge_time))
if(do_after(user, charge_time, target = src))
status = 1
user.visible_message(span_warning("[user] charges \the [src]!"),span_warning("You charge \the [src]. <b>It's hammer time!</b>"))
playsound(src, "sparks", 75, 1, -1)
+2 -2
View File
@@ -31,7 +31,7 @@ GLOBAL_LIST_BOILERPLATE(all_mops, /obj/item/mop)
user.visible_message(span_warning("[user] begins to clean \the [get_turf(A)]."))
if(do_after(user, 40))
if(do_after(user, 4 SECONDS, target = src))
var/turf/T = get_turf(A)
if(T)
T.wash(CLEAN_SCRUB)
@@ -73,7 +73,7 @@ GLOBAL_LIST_BOILERPLATE(all_mops, /obj/item/mop)
user.visible_message(span_warning("[user] begins to clean \the [get_turf(A)]."))
if(do_after(user, 20))
if(do_after(user, 2 SECONDS, target = src))
var/turf/T = get_turf(A)
if(T)
T.wash(CLEAN_SCRUB)
@@ -38,7 +38,7 @@
if(istype(A, /turf) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay) || istype(A, /obj/effect/rune))
user.visible_message(span_warning("[user] begins to clean \the [get_turf(A)]."))
if(do_after(user, 40))
if(do_after(user, 4 SECONDS, target = src))
var/turf/T = get_turf(A)
if(T)
T.clean_deploy(src)
@@ -528,7 +528,7 @@
H.visible_message(span_infoplain(span_bold("\The [H]") + " starts to pack \the [src]!"), \
span_notice("You start to pack \the [src]!"), \
span_infoplain("You hear the shuffling of cloth."))
if(do_after(H, 50))
if(do_after(H, 5 SECONDS, target = src))
H.visible_message(span_infoplain(span_bold("\The [H]") + " finishes packing \the [src]!"), \
span_notice("You finish packing \the [src]!"), \
span_infoplain("You hear the shuffling of cloth."))
@@ -541,7 +541,7 @@
H.visible_message(span_infoplain(span_bold("\The [src]") + " starts to unpack \the [src]!"), \
span_notice("You start to unpack \the [src]!"), \
span_infoplain("You hear the shuffling of cloth."))
if(do_after(H, 25))
if(do_after(H, 25, target = src))
H.visible_message(span_infoplain(span_bold("\The [src]") + " finishes unpacking \the [src]!"), \
span_notice("You finish unpacking \the [src]!"), \
span_infoplain("You hear the shuffling of cloth."))
@@ -29,7 +29,7 @@
/obj/item/storage/vore_egg/proc/hatch(mob/living/user as mob)
visible_message(span_danger("\The [src] begins to shake as something pushes out from within!"))
animate_shake()
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
if(use_sound)
playsound(src, src.use_sound, 50, 0, -5)
animate_shake()
@@ -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))
if(insert_delay && !do_after(user, insert_delay, target = 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))
if(remove_delay && !do_after(user, remove_delay, target = src))
return FALSE // Moved while there is a delay
if(W in src)
@@ -44,7 +44,7 @@
return
if (W.has_tool_quality(TOOL_SCREWDRIVER))
if (do_after(user, 20 * W.toolspeed))
if (do_after(user, 2 SECONDS * W.toolspeed, target = src))
src.open =! src.open
playsound(src, W.usesound, 50, 1)
user.show_message(span_notice("You [src.open ? "open" : "close"] the service panel."))
@@ -52,7 +52,7 @@
if (istype(W, /obj/item/multitool) && (src.open == 1)&& (!src.l_hacking))
user.show_message(span_notice("Now attempting to reset internal memory, please hold."), 1)
src.l_hacking = 1
if (do_after(user, 100))
if (do_after(user, 10 SECONDS, target = src))
if (prob(40))
src.l_setshort = 1
src.l_set = 0
@@ -134,7 +134,7 @@ var/list/global/tank_gauge_cache = list()
if(wired && src.proxyassembly.assembly)
to_chat(user, span_notice("You carefully begin clipping the wires that attach to the tank."))
if(do_after(user, 100,src))
if(do_after(user, 10 SECONDS, target = src))
wired = 0
cut_overlay("bomb_assembly")
to_chat(user, span_notice("You cut the wire and remove the device."))
@@ -161,7 +161,7 @@ var/list/global/tank_gauge_cache = list()
src.proxyassembly.receive_signal()
else if(wired)
if(do_after(user, 10, src))
if(do_after(user, 1 SECOND, target = src))
to_chat(user, span_notice("You quickly clip the wire from the tank."))
wired = 0
cut_overlay("bomb_assembly")
@@ -174,7 +174,7 @@ var/list/global/tank_gauge_cache = list()
if(istype(W, /obj/item/assembly_holder))
if(wired)
to_chat(user, span_notice("You begin attaching the assembly to \the [src]."))
if(do_after(user, 50, src))
if(do_after(user, 5 SECONDS, target = src))
to_chat(user, span_notice("You finish attaching the assembly to \the [src]."))
GLOB.bombers += "[key_name(user)] attached an assembly to a wired [src]. Temp: [src.air_contents.temperature-T0C]"
message_admins("[key_name_admin(user)] attached an assembly to a wired [src]. Temp: [src.air_contents.temperature-T0C]")
@@ -190,7 +190,7 @@ var/list/global/tank_gauge_cache = list()
if(WT.remove_fuel(1,user))
if(!valve_welded)
to_chat(user, span_notice("You begin welding the \the [src] emergency pressure relief valve."))
if(do_after(user, 40,src))
if(do_after(user, 4 SECONDS, target = src))
to_chat(user, span_notice("You carefully weld \the [src] emergency pressure relief valve shut.") + " " + span_warning("\The [src] may now rupture under pressure!"))
src.valve_welded = 1
src.leaking = 0
+2 -2
View File
@@ -43,7 +43,7 @@
return
user.visible_message(span_danger("\The [user] begins taping over \the [H]'s eyes!"))
if(!do_after(user, 30))
if(!do_after(user, 3 SECONDS, target = src))
return
if(!can_place(H, user))
@@ -72,7 +72,7 @@
return
user.visible_message(span_danger("\The [user] begins taping up \the [H]'s mouth!"))
if(!do_after(user, 30))
if(!do_after(user, 3 SECONDS, target = src))
return
if(!can_place(H, user))
+5 -5
View File
@@ -35,7 +35,7 @@
"You hear the slow creaking of a spring."
)
if (do_after(user, 60))
if (do_after(user, 6 SECONDS, target = src))
user.visible_message(
span_danger("[user] has deployed \the [src]."),
span_danger("You have deployed \the [src]!"),
@@ -55,7 +55,7 @@
span_notice("[user] begins freeing [victim] from \the [src]."),
span_notice("You carefully begin to free [victim] from \the [src]."),
)
if(do_after(user, 60))
if(do_after(user, 6 SECONDS, target = src))
user.visible_message(span_notice("[victim] has been freed from \the [src] by [user]."))
for(var/A in buckled_mobs)
unbuckle_mob(A)
@@ -68,7 +68,7 @@
)
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 60))
if(do_after(user, 6 SECONDS, target = src))
user.visible_message(
span_danger("[user] has disarmed \the [src]."),
span_notice("You have disarmed \the [src]!")
@@ -202,7 +202,7 @@
)
playsound(src, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, health))
if(do_after(user, health, target = src))
user.visible_message(
span_danger("[user] has collected \the [src]."),
span_notice("You have collected \the [src]!")
@@ -221,7 +221,7 @@
"You hear the rustling of [material.name]."
)
if (do_after(user, 60))
if (do_after(user, 6 SECONDS, target = src))
user.visible_message(
span_danger("[user] has deployed \the [src]."),
span_danger("You have deployed \the [src]!"),
+1 -1
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, timed_action_flags = IGNORE_INCAPACITATED))
if(do_after(user, escape_time, target = src, timed_action_flags = IGNORE_INCAPACITATED))
if(!has_buckled_mobs())
return
visible_message(span_danger("[user] manages to tear \the [src] apart!"))