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
+8 -8
View File
@@ -474,7 +474,7 @@ GLOBAL_LIST_EMPTY(apcs)
return
playsound(src, W.usesound, 50, 1)
to_chat(user, "You begin to remove the power control board...") //lpeters - fixed grammar issues //Ner - grrrrrr
if(do_after(user, 50 * W.toolspeed))
if(do_after(user, 5 SECONDS * W.toolspeed, target = src))
if(has_electronics == APC_HAS_ELECTRONICS_WIRED)
has_electronics = APC_HAS_ELECTRONICS_NONE
if((stat & BROKEN))
@@ -558,7 +558,7 @@ GLOBAL_LIST_EMPTY(apcs)
user.visible_message(span_warning("[user.name] adds cables to the APC frame."), \
"You start adding cables to the APC frame...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if(do_after(user, 2 SECONDS, target = src))
if(C.get_amount() >= 10 && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
var/obj/structure/cable/N = T.get_cable_node()
if(prob(50) && electrocute_mob(user, N, N))
@@ -581,7 +581,7 @@ GLOBAL_LIST_EMPTY(apcs)
user.visible_message(span_warning("[user.name] starts dismantling the [src]'s power terminal."), \
"You begin to cut the cables...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50 * W.toolspeed))
if(do_after(user, 5 SECONDS * W.toolspeed, target = src))
if(terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
if(prob(50) && electrocute_mob(user, terminal.powernet, terminal))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
@@ -596,7 +596,7 @@ GLOBAL_LIST_EMPTY(apcs)
user.visible_message(span_warning("[user.name] inserts the power control board into [src]."), \
"You start to insert the power control board into the frame...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 10))
if(do_after(user, 1 SECOND, target = src))
if(has_electronics == APC_HAS_ELECTRONICS_NONE)
has_electronics = APC_HAS_ELECTRONICS_WIRED
reboot()
@@ -614,7 +614,7 @@ GLOBAL_LIST_EMPTY(apcs)
"You start welding the APC frame...", \
"You hear welding.")
playsound(src, WT.usesound, 25, 1)
if(do_after(user, 50 * WT.toolspeed))
if(do_after(user, 5 SECONDS * WT.toolspeed, target = src))
if(!src || !WT.remove_fuel(3, user)) return
if(emagged || (stat & BROKEN) || opened==2)
new /obj/item/stack/material/steel(loc)
@@ -637,7 +637,7 @@ GLOBAL_LIST_EMPTY(apcs)
return
user.visible_message(span_warning("[user.name] begins replacing the damaged APC cover with a new one."),\
"You begin to replace the damaged APC cover...")
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
user.visible_message(span_notice("[user.name] has replaced the damaged APC cover with a new one."),\
"You replace the damaged APC cover with a new one.")
qdel(W)
@@ -652,7 +652,7 @@ GLOBAL_LIST_EMPTY(apcs)
return
user.visible_message(span_warning("[user.name] connects their [W.name] to the APC and begins resetting it."),\
"You begin resetting the APC...")
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
user.visible_message(span_notice("[user.name] resets the APC with a beep from their [W.name]."),\
"You finish resetting the APC.")
playsound(src, 'sound/machines/chime.ogg', 25, 1)
@@ -713,7 +713,7 @@ GLOBAL_LIST_EMPTY(apcs)
to_chat(user, "The [src] isn't working.")
else
flick("apc-spark", src)
if(do_after(user,6))
if(do_after(user, 6, target = src))
emagged = 1
locked = 0
to_chat(user, span_notice("You emag the APC interface."))
+1 -1
View File
@@ -13,7 +13,7 @@
/obj/item/module/power_control/attackby(var/obj/item/I, var/mob/user)
if(I.has_tool_quality(TOOL_MULTITOOL))
to_chat(user, span_notice("You begin tweaking the power control circuits to support a power cell rack."))
if(do_after(user, 50 * I.toolspeed))
if(do_after(user, 5 SECONDS * I.toolspeed, target = src))
var/obj/item/newcircuit = new/obj/item/circuitboard/batteryrack(get_turf(user))
qdel(src)
user.put_in_hands(newcircuit)
+2 -2
View File
@@ -62,7 +62,7 @@
busy = 1
to_chat(user, span_green("Updating power settings..."))
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
set_state(!on)
to_chat(user, span_green("Update Completed. New setting:[on ? "on": "off"]"))
update_locked = 1
@@ -84,7 +84,7 @@
for(var/mob/O in viewers(user))
O.show_message(span_red(text("[user] started reprogramming [src]!")), 1)
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
set_state(!on)
user.visible_message(\
span_notice("[user.name] [on ? "enabled" : "disabled"] the breaker box!"),\
+1 -1
View File
@@ -32,7 +32,7 @@
return
playsound(src, WT.usesound, 50, 1)
if(do_after(user, 250 * WT.toolspeed)) // Meant to be an obnoxiously long time due to these being intended as "mapper placed indestructable cables". However explosions can already break them if they turf change.
if(do_after(user, 25 SECONDS * WT.toolspeed, target = src)) // Meant to be an obnoxiously long time due to these being intended as "mapper placed indestructable cables". However explosions can already break them if they turf change.
var/obj/item/stack/cable_coil/heavyduty/CC
if(src.d1) // 0-X cables are 1 unit, X-X cables are 2 units long
CC = new/obj/item/stack/cable_coil/heavyduty(T, 2, color)
+1 -1
View File
@@ -103,7 +103,7 @@ GLOBAL_LIST_EMPTY(light_type_cache)
if (src.stage == 1)
playsound(src, W.usesound, 75, 1)
to_chat(user, "You begin deconstructing [src].")
if (!do_after(user, 30 * W.toolspeed))
if (!do_after(user, 3 SECONDS * W.toolspeed, target = src))
return
new /obj/item/stack/material/steel( get_turf(src.loc), sheets_refunded )
user.visible_message("[user.name] deconstructs [src].", \
+1 -1
View File
@@ -93,7 +93,7 @@
user.visible_message( \
span_warning("\The [user] begins deconstructing \the [src]."), \
span_notice("You start deconstructing \the [src]."))
if(do_after(user, 20 * WT.toolspeed, target = src) && WT.isOn())
if(do_after(user, 2 SECONDS * WT.toolspeed, target = src) && WT.isOn())
new /obj/item/stack/material/steel(get_turf(src), 2)
user.visible_message( \
span_warning("\The [user] has deconstructed \the [src]."), \
+3 -3
View File
@@ -196,7 +196,7 @@
user.visible_message("[user.name] starts to weld [src] to the floor.", \
"You start to weld [src] to the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user, 2 SECONDS * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld [src] to the floor.")
@@ -209,7 +209,7 @@
user.visible_message("[user.name] starts to cut [src] free from the floor.", \
"You start to cut [src] free from the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user, 2 SECONDS * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut [src] free from the floor.")
@@ -229,7 +229,7 @@
to_chat(user, span_warning("You don't have enough sheets to repair this! You need at least [amt] sheets."))
return
to_chat(user, span_notice("You begin repairing \the [src]..."))
if(do_after(user, 30))
if(do_after(user, 3 SECONDS, target = src))
if(P.use(amt))
to_chat(user, span_notice("You have repaired \the [src]."))
integrity = initial(integrity)
@@ -147,7 +147,7 @@
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user, 2 SECONDS * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld the field generator to the floor.")
@@ -159,7 +159,7 @@
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user, 2 SECONDS * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut the [src] free from the floor.")
+3 -3
View File
@@ -40,16 +40,16 @@
panel_open = !panel_open
playsound(src, W.usesound, 50, 1)
visible_message(span_infoplain(span_bold("\The [user]") + " adjusts \the [src]'s mechanisms."))
if(panel_open && do_after(user, 30))
if(panel_open && do_after(user, 3 SECONDS, target = src))
to_chat(user, span_notice("\The [src] looks like it could be modified."))
if(panel_open && do_after(user, 80 * W.toolspeed)) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
if(panel_open && do_after(user, 8 SECONDS * W.toolspeed, target = src)) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
playsound(src, W.usesound, 50, 1)
to_chat(user, span_cult("\The [src] looks like it could be adapted to forge advanced materials via particle acceleration, somehow.."))
else
to_chat(user, span_notice("\The [src]'s mechanisms look secure."))
if(istype(W, /obj/item/smes_coil/super_io) && panel_open)
visible_message(span_infoplain(span_bold("\The [user]") + " begins to modify \the [src] with \the [W]."))
if(do_after(user, 300))
if(do_after(user, 30 SECONDS, target = src))
user.drop_from_inventory(W)
visible_message(span_infoplain(span_bold("\The [user]") + " installs \the [W] onto \the [src]."))
qdel(W)
+3 -3
View File
@@ -272,7 +272,7 @@ GLOBAL_LIST_EMPTY(smeses)
if(check_terminal_exists(tempLoc, user, tempDir))
return 1
to_chat(user, span_filter_notice(span_notice("You start adding cable to the [src].")))
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
if(check_terminal_exists(tempLoc, user, tempDir))
return 1
var/obj/machinery/power/terminal/term = new/obj/machinery/power/terminal(tempLoc)
@@ -326,7 +326,7 @@ GLOBAL_LIST_EMPTY(smeses)
if(!damage)
to_chat(user, span_filter_notice("\The [src] is already fully repaired."))
return FALSE
if(WT.remove_fuel(0,user) && do_after(user, damage, src))
if(WT.remove_fuel(0,user) && do_after(user, damage, target = src))
to_chat(user, span_filter_notice("You repair all structural damage to \the [src]"))
damage = 0
return FALSE
@@ -368,7 +368,7 @@ GLOBAL_LIST_EMPTY(smeses)
else
to_chat(user, span_filter_notice(span_notice("You begin to cut the cables...")))
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50 * W.toolspeed))
if(do_after(user, 5 SECONDS * W.toolspeed, target = src))
if (prob(50) && electrocute_mob(user, term.powernet, term))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
+1 -1
View File
@@ -341,7 +341,7 @@
playsound(src, W.usesound, 50, 1)
to_chat(user, span_warning("You begin to disassemble the [src]!"))
if (do_after(user, (100 * cur_coils) * W.toolspeed)) // More coils = takes longer to disassemble. It's complex so largest one with 5 coils will take 50s with a normal crowbar
if (do_after(user, (10 SECONDS * cur_coils) * W.toolspeed, target = src)) // More coils = takes longer to disassemble. It's complex so largest one with 5 coils will take 50s with a normal crowbar
if (failure_probability && prob(failure_probability))
total_system_failure(failure_probability, user)
+2 -2
View File
@@ -62,7 +62,7 @@ GLOBAL_LIST_EMPTY(solars_list)
if(W.has_tool_quality(TOOL_CROWBAR))
playsound(src, 'sound/machines/click.ogg', 50, 1)
user.visible_message(span_notice("[user] begins to take the glass off the solar panel."))
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
var/obj/item/solar_assembly/S = new(loc)
S.anchored = TRUE
new glass_type(loc, 2)
@@ -416,7 +416,7 @@ GLOBAL_LIST_EMPTY(solars_list)
/obj/machinery/power/solar_control/attackby(obj/item/I, user as mob)
if(I.has_tool_quality(TOOL_SCREWDRIVER))
playsound(src, I.usesound, 50, 1)
if(do_after(user, 20))
if(do_after(user, 2 SECONDS, target = src))
if (src.stat & BROKEN)
to_chat(user, span_blue("The broken glass falls out."))
var/obj/structure/frame/A = new /obj/structure/frame/computer( src.loc )
+1 -1
View File
@@ -56,7 +56,7 @@
if(W.has_tool_quality(TOOL_CROWBAR))
playsound(src, 'sound/machines/click.ogg', 50, 1)
user.visible_message(span_notice("[user] begins to take the glass off the solar tracker."))
if(do_after(user, 50))
if(do_after(user, 5 SECONDS, target = src))
var/obj/item/solar_assembly/S = new(loc)
S.tracker = TRUE
S.anchored = TRUE