diff --git a/code/__DEFINES/do_afters.dm b/code/__DEFINES/do_afters.dm
new file mode 100644
index 000000000000..456cf9404004
--- /dev/null
+++ b/code/__DEFINES/do_afters.dm
@@ -0,0 +1,4 @@
+#define DOAFTER_SOURCE_SURGERY "doafter_surgery"
+#define DOAFTER_SOURCE_MECHADRILL "doafter_mechadrill"
+#define DOAFTER_SOURCE_SURVIVALPEN "doafter_survivalpen"
+#define DOAFTER_SOURCE_GETTING_UP "doafter_gettingup"
diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm
index d1d782c84876..8026f9635a97 100644
--- a/code/__DEFINES/mobs.dm
+++ b/code/__DEFINES/mobs.dm
@@ -396,7 +396,11 @@
#define WABBAJACK (1<<6)
#define SLEEP_CHECK_DEATH(X) sleep(X); if(QDELETED(src) || stat == DEAD) return;
-#define INTERACTING_WITH(X, Y) (Y in X.do_afters)
+
+#define DOING_INTERACTION(user, interaction_key) (LAZYACCESS(user.do_afters, interaction_key))
+#define DOING_INTERACTION_LIMIT(user, interaction_key, max_interaction_count) ((LAZYACCESS(user.do_afters, interaction_key) || 0) >= max_interaction_count)
+#define DOING_INTERACTION_WITH_TARGET(user, target) (LAZYACCESS(user.do_afters, target))
+#define DOING_INTERACTION_WITH_TARGET_LIMIT(user, target, max_interaction_count) ((LAZYACCESS(user.do_afters, target) || 0) >= max_interaction_count)
/// If you examine the same atom twice in this timeframe, we call examine_more() instead of examine()
#define EXAMINE_MORE_TIME 1 SECONDS
diff --git a/code/__DEFINES/timed_action.dm b/code/__DEFINES/timed_action.dm
new file mode 100644
index 000000000000..90572cdc5416
--- /dev/null
+++ b/code/__DEFINES/timed_action.dm
@@ -0,0 +1,10 @@
+// timed_action_flags parameter for 'proc/do_after'
+
+// The user can move freely without canceling the do_after
+#define IGNORE_USER_LOC_CHANGE (1<<0)
+// The target can move freely without canceling the do_after
+#define IGNORE_TARGET_LOC_CHANGE (1<<1)
+/// Can do the action even if the item is no longer being held
+#define IGNORE_HELD_ITEM (1<<2)
+/// Can do the action even if the mob is incapacitated
+#define IGNORE_INCAPACITATED (1<<3)
diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm
index 81ba9ec06dd2..63990e61ee33 100644
--- a/code/__HELPERS/mobs.dm
+++ b/code/__HELPERS/mobs.dm
@@ -241,66 +241,6 @@ GLOBAL_LIST_EMPTY(species_list)
else
return "unknown"
-///Timed action involving two mobs, the user and the target.
-/proc/do_mob(mob/user , mob/target, time = 3 SECONDS, uninterruptible = FALSE, progress = TRUE, datum/callback/extra_checks = null, ignore_loc_change = FALSE, hidden = FALSE)
- if(!user || !target)
- return FALSE
-
- if(target && INTERACTING_WITH(user, target))
- to_chat(user, "You're already interacting with [target]!")
- return
-
- var/user_loc = user.loc
-
- var/drifting = FALSE
- if(!user.Process_Spacemove(0) && user.inertia_dir)
- drifting = TRUE
-
- var/target_loc = target.loc
-
- LAZYADD(user.do_afters, target)
- LAZYADD(target.targeted_by, user)
- var/holding = user.get_active_held_item()
- var/datum/progressbar/progbar
- var/datum/cogbar/cog
- if (progress)
- progbar = new(user, time, target)
- if(!hidden && time >= 1 SECONDS)
- cog = new(user)
-
- var/endtime = world.time+time
- var/starttime = world.time
- . = TRUE
- while (world.time < endtime)
- stoplag(1)
- if(!QDELETED(progbar))
- progbar.update(world.time - starttime)
- if(QDELETED(user) || QDELETED(target))
- . = FALSE
- break
- if(uninterruptible)
- continue
-
- if(drifting && !user.inertia_dir)
- drifting = FALSE
- user_loc = user.loc
-
-
- if(!ignore_loc_change && ((!drifting && user.loc != user_loc) || target.loc != target_loc))
- . = FALSE
- break
-
- if(user.get_active_held_item() != holding || user.incapacitated() || (extra_checks && !extra_checks.Invoke()))
- . = FALSE
- break
- if(!QDELETED(progbar))
- progbar.end_progress()
-
- cog?.remove()
- if(!QDELETED(target))
- LAZYREMOVE(user.do_afters, target)
- LAZYREMOVE(target.targeted_by, user)
-
//some additional checks as a callback for for do_afters that want to break on losing health or on the mob taking action
/mob/proc/break_do_after_checks(list/checked_health, check_clicks)
if(check_clicks && next_move > world.time)
@@ -315,24 +255,40 @@ GLOBAL_LIST_EMPTY(species_list)
checked_health["health"] = health
return ..()
-///Timed action involving one mob user. Target is optional.
-/proc/do_after(mob/user, delay, needhand = TRUE, atom/target = null, progress = TRUE, datum/callback/extra_checks = null, hidden = FALSE)
+/**
+ * Timed action involving one mob user. A target can also be specified, but it is optional.
+ *
+ * Checks that `user` does not move, change hands, get stunned, etc. for the
+ * given `delay`. Returns `TRUE` on success or `FALSE` on failure.
+ *
+ * Arguments:
+ * * user - the primary "user" of the do_after.
+ * * delay - how long the do_after takes. Defaults to 3 SECONDS.
+ * * target - the (optional) target mob of the do_after. If they move/cease to exist, the do_after is cancelled.
+ * * timed_action_flags - optional flags to override certain do_after checks (see DEFINES/timed_action.dm).
+ * * progress - if TRUE, a progress bar is displayed.
+ * * extra_checks - a callback that can be used to add extra checks to the do_after. Returning false in this callback will cancel the do_after.
+ */
+/proc/do_after(mob/user, delay = 3 SECONDS, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1, hidden = FALSE)
if(!user)
return FALSE
+ if(!isnum(delay))
+ CRASH("do_after was passed a non-number delay: [delay || "null"].")
- if(target && INTERACTING_WITH(user, target))
+ if(target && DOING_INTERACTION_WITH_TARGET(user, target))
to_chat(user, "You're already interacting with [target]!")
return
- var/atom/Tloc = null
- if(target && !isturf(target))
- Tloc = target.loc
-
- if(target)
- LAZYADD(user.do_afters, target)
- LAZYADD(target.targeted_by, user)
+ if(!interaction_key && target)
+ interaction_key = target //Use the direct ref to the target
+ if(interaction_key) //Do we have a interaction_key now?
+ var/current_interaction_count = LAZYACCESS(user.do_afters, interaction_key) || 0
+ if(current_interaction_count >= max_interact_count) //We are at our peak
+ return
+ LAZYSET(user.do_afters, interaction_key, current_interaction_count + 1)
- var/atom/Uloc = user.loc
+ var/atom/user_loc = user.loc
+ var/atom/target_loc = target?.loc
var/drifting = FALSE
if(!user.Process_Spacemove(0) && user.inertia_dir)
@@ -340,136 +296,59 @@ GLOBAL_LIST_EMPTY(species_list)
var/holding = user.get_active_held_item()
- var/holdingnull = TRUE //User's hand started out empty, check for an empty hand
- if(holding)
- holdingnull = FALSE //Users hand started holding something, check to see if it's still holding that
-
delay *= user.do_after_coefficent()
var/datum/progressbar/progbar
var/datum/cogbar/cog
+
if(progress)
- progbar = new(user, delay, target || user)
+ if(user.client)
+ progbar = new(user, delay, target || user)
+
if(!hidden && delay >= 1 SECONDS)
cog = new(user)
+
var/endtime = world.time + delay
var/starttime = world.time
. = TRUE
while (world.time < endtime)
stoplag(1)
+
if(!QDELETED(progbar))
progbar.update(world.time - starttime)
if(drifting && !user.inertia_dir)
drifting = FALSE
- Uloc = user.loc
+ user_loc = user.loc
- if(QDELETED(user) || user.stat || (!drifting && user.loc != Uloc) || (extra_checks && !extra_checks.Invoke()))
+ // Check flags
+ if(QDELETED(user) \
+ || (!(timed_action_flags & IGNORE_USER_LOC_CHANGE) && !drifting && user.loc != user_loc) \
+ || (!(timed_action_flags & IGNORE_HELD_ITEM) && user.get_active_held_item() != holding) \
+ || (!(timed_action_flags & IGNORE_INCAPACITATED) && HAS_TRAIT(user, TRAIT_INCAPACITATED)) \
+ || (extra_checks && !extra_checks.Invoke()))
. = FALSE
break
- if(isliving(user))
- var/mob/living/L = user
- if(L.IsStun() || L.IsParalyzed())
- . = FALSE
- break
-
- if(!QDELETED(Tloc) && (QDELETED(target) || Tloc != target.loc))
- if((Uloc != Tloc || Tloc != user) && !drifting)
- . = FALSE
- break
-
- if(target && !(target in user.do_afters))
+ // If we have a target, we check for them moving here. We don't care about it if we're drifting or we ignore target loc change
+ if(target && (user != target) && \
+ (QDELETED(target) \
+ || (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && target.loc != target_loc)))
. = FALSE
break
- if(needhand)
- //This might seem like an odd check, but you can still need a hand even when it's empty
- //i.e the hand is used to pull some item/tool out of the construction
- if(!holdingnull)
- if(!holding)
- . = FALSE
- break
- if(user.get_active_held_item() != holding)
- . = FALSE
- break
if(!QDELETED(progbar))
progbar.end_progress()
cog?.remove()
- if(!QDELETED(target))
- LAZYREMOVE(user.do_afters, target)
- LAZYREMOVE(target.targeted_by, user)
+ if(interaction_key)
+ LAZYREMOVE(user.do_afters, interaction_key)
/mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1
. = 1
return
-///Timed action involving at least one mob user and a list of targets.
-/proc/do_after_mob(mob/user, list/targets, time = 3 SECONDS, uninterruptible = FALSE, progress = TRUE, datum/callback/extra_checks)
- if(!user)
- return FALSE
- if(!islist(targets))
- targets = list(targets)
- if(!length(targets))
- return FALSE
-
- for(var/i in targets)
- var/mob/living/target = i
- if(INTERACTING_WITH(user, target))
- to_chat(user, "You're already interacting with [target]!")
- return
-
-
- var/user_loc = user.loc
-
- var/drifting = FALSE
- if(!user.Process_Spacemove(0) && user.inertia_dir)
- drifting = TRUE
-
- var/list/originalloc = list()
- for(var/atom/target in targets)
- originalloc[target] = target.loc
- LAZYADD(user.do_afters, target)
- LAZYADD(target.targeted_by, user)
-
- var/holding = user.get_active_held_item()
- var/datum/progressbar/progbar
- if(progress)
- progbar = new(user, time, targets[1])
-
- var/endtime = world.time + time
- var/starttime = world.time
- . = TRUE
- mainloop:
- while(world.time < endtime)
- stoplag(1)
- if(!QDELETED(progbar))
- progbar.update(world.time - starttime)
- if(QDELETED(user) || !targets)
- . = FALSE
- break
- if(uninterruptible)
- continue
-
- if(drifting && !user.inertia_dir)
- drifting = FALSE
- user_loc = user.loc
-
- for(var/atom/target in targets)
- if((!drifting && user_loc != user.loc) || QDELETED(target) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || (extra_checks && !extra_checks.Invoke()))
- . = FALSE
- break mainloop
- if(!QDELETED(progbar))
- progbar.end_progress()
-
- for(var/thing in targets)
- var/atom/target = thing
- if(!QDELETED(target))
- LAZYREMOVE(user.do_afters, target)
- LAZYREMOVE(target.targeted_by, user)
-
/proc/is_species(A, species_datum)
. = FALSE
if(ishuman(A))
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 8e9a1dbc9979..c8c7b63d0a09 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -1329,44 +1329,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
temp = ((temp + (temp>>3))&29127) % 63 //070707
return temp
-//same as do_mob except for movables and it allows both to drift and doesn't draw progressbar
-/proc/do_atom(atom/movable/user , atom/movable/target, time = 30, uninterruptible = 0,datum/callback/extra_checks = null)
- if(!user || !target)
- return TRUE
- var/user_loc = user.loc
-
- var/drifting = FALSE
- if(!user.Process_Spacemove(0) && user.inertia_dir)
- drifting = TRUE
-
- var/target_drifting = FALSE
- if(!target.Process_Spacemove(0) && target.inertia_dir)
- target_drifting = TRUE
-
- var/target_loc = target.loc
-
- var/endtime = world.time+time
- . = TRUE
- while (world.time < endtime)
- stoplag(1)
- if(QDELETED(user) || QDELETED(target))
- . = 0
- break
- if(uninterruptible)
- continue
-
- if(drifting && !user.inertia_dir)
- drifting = FALSE
- user_loc = user.loc
-
- if(target_drifting && !target.inertia_dir)
- target_drifting = FALSE
- target_loc = target.loc
-
- if((!drifting && user.loc != user_loc) || (!target_drifting && target.loc != target_loc) || (extra_checks && !extra_checks.Invoke()))
- . = FALSE
- break
-
//returns a GUID like identifier (using a mostly made up record format)
//guids are not on their own suitable for access or security tokens, as most of their bits are predictable.
// (But may make a nice salt to one)
diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm
index 6923760a7705..55ba84fb5f7d 100644
--- a/code/datums/components/butchering.dm
+++ b/code/datums/components/butchering.dm
@@ -51,10 +51,14 @@
/datum/component/butchering/proc/startButcher(obj/item/source, mob/living/M, mob/living/user)
to_chat(user, "You begin to butcher [M]...")
playsound(M.loc, butcher_sound, 50, TRUE, -1)
- if(do_mob(user, M, speed) && M.Adjacent(source))
+ if(do_after(user, speed, M) && M.Adjacent(source))
Butcher(user, M)
/datum/component/butchering/proc/startNeckSlice(obj/item/source, mob/living/carbon/human/H, mob/living/user)
+ if(DOING_INTERACTION_WITH_TARGET(user, H))
+ to_chat(user, "You're already interacting with [H]!")
+ return
+
user.visible_message("[user] is slitting [H]'s throat!", \
"You start slicing [H]'s throat!", \
"You hear a cutting noise!", ignored_mobs = H)
@@ -63,7 +67,7 @@
log_combat(user, H, "starts slicing the throat of")
playsound(H.loc, butcher_sound, 50, TRUE, -1)
- if(do_mob(user, H, clamp(500 / source.force, 30, 100)) && H.Adjacent(source))
+ if(do_after(user, clamp(500 / source.force, 30, 100), H) && H.Adjacent(source))
if(H.has_status_effect(/datum/status_effect/neck_slice))
user.show_message("[H]'s neck has already been already cut, you can't make the bleeding any worse!", MSG_VISUAL, \
"Their neck has already been already cut, you can't make the bleeding any worse!")
diff --git a/code/datums/components/edible.dm b/code/datums/components/edible.dm
index 3a047d082868..cf0199d05e18 100644
--- a/code/datums/components/edible.dm
+++ b/code/datums/components/edible.dm
@@ -115,7 +115,7 @@ Behavior that's still missing from this component that original food items had t
. = COMPONENT_ITEM_NO_ATTACK //Point of no return I suppose
if(eater == feeder)//If you're eating it yourself.
- if(!do_mob(feeder, eater, eat_time)) //Gotta pass the minimal eat time
+ if(!do_after(feeder, eat_time, eater)) //Gotta pass the minimal eat time
return
var/eatverb = pick(eatverbs)
if(junkiness && eater.satiety < -150 && eater.nutrition > NUTRITION_LEVEL_STARVING + 50 && !HAS_TRAIT(eater, TRAIT_VORACIOUS))
@@ -143,7 +143,7 @@ Behavior that's still missing from this component that original food items had t
eater.visible_message("[feeder] cannot force any more of [parent] down [eater]'s throat!", \
"[feeder] cannot force any more of [parent] down your throat!")
return
- if(!do_mob(feeder, eater)) //Wait 3 seconds before you can feed
+ if(!do_after(feeder, target = eater)) //Wait 3 seconds before you can feed
return
log_combat(feeder, eater, "fed", owner.reagents.log_list())
diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm
index 4728e15cc205..5724d4327bee 100644
--- a/code/datums/components/storage/storage.dm
+++ b/code/datums/components/storage/storage.dm
@@ -316,7 +316,7 @@
var/turf/T = get_turf(A)
var/list/things = contents()
var/datum/progressbar/progress = new(M, length(things), T)
- while (do_after(M, 10, TRUE, T, FALSE, CALLBACK(src, PROC_REF(mass_remove_from_storage), T, things, progress)))
+ while (do_after(M, 1 SECONDS, T, NONE, FALSE, CALLBACK(src, PROC_REF(mass_remove_from_storage), T, things, progress)))
stoplag(1)
progress.end_progress()
diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm
index 11037374b9b3..cc6a91b2f267 100644
--- a/code/datums/status_effects/gas.dm
+++ b/code/datums/status_effects/gas.dm
@@ -38,7 +38,7 @@
/datum/status_effect/freon/proc/do_resist()
to_chat(owner, "You start breaking out of the ice cube...")
- if(do_mob(owner, owner, 40))
+ if(do_after(owner, 40))
if(!QDELETED(src))
to_chat(owner, "You break out of the ice cube!")
owner.remove_status_effect(/datum/status_effect/freon)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 44d5de773f94..7ffa3255ada1 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -84,9 +84,6 @@
var/list/alternate_appearances
- ///Mobs that are currently do_after'ing this atom, to be cleared from on Destroy()
- var/list/targeted_by
-
/// Last appearance of the atom for demo saving purposes
var/image/demo_last_appearance
@@ -310,11 +307,6 @@
LAZYCLEARLIST(overlays)
LAZYCLEARLIST(managed_overlays)
- for(var/i in targeted_by)
- var/mob/M = i
- LAZYREMOVE(M.do_afters, src)
-
- targeted_by = null
QDEL_NULL(light)
if(smoothing_flags & SMOOTH_QUEUED)
@@ -976,7 +968,7 @@
var/list/things = src_object.contents()
var/datum/progressbar/progress = new(user, things.len, src)
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
- while (do_after(user, 10, TRUE, src, FALSE, CALLBACK(STR, TYPE_PROC_REF(/datum/component/storage, handle_mass_item_insertion), things, src_object, user, progress)))
+ while (do_after(user, 1 SECONDS, src, NONE, FALSE, CALLBACK(STR, TYPE_PROC_REF(/datum/component/storage, handle_mass_item_insertion), things, src_object, user, progress)))
stoplag(1)
progress.end_progress()
to_chat(user, "You dump as much of [src_object.parent]'s contents [STR.insert_preposition]to [src] as you can.")
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 6bb5a4bab561..121c93a07353 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -958,7 +958,7 @@
to_chat(user, "You need at least 2 metal sheets to reinforce [src].")
return
to_chat(user, "You start reinforcing [src].")
- if(do_after(user, 20, TRUE, src))
+ if(do_after(user, 20, src))
if(!panel_open || !S.use(2))
return
user.visible_message("[user] reinforces \the [src] with metal.",
@@ -972,7 +972,7 @@
to_chat(user, "You need at least 2 plasteel sheets to reinforce [src].")
return
to_chat(user, "You start reinforcing [src].")
- if(do_after(user, 20, TRUE, src))
+ if(do_after(user, 20, src))
if(!panel_open || !S.use(2))
return
user.visible_message("[user] reinforces \the [src] with plasteel.",
@@ -1226,7 +1226,7 @@
var/time_to_open = 50
playsound(src, pry_sound, 100, TRUE, mono_adj = TRUE) //is it aliens or just the CE being a dick?
prying_so_hard = TRUE
- if(do_after(user, time_to_open, TRUE, src))
+ if(do_after(user, time_to_open, src))
open(2)
if(density && !open(2))
to_chat(user, "Despite your attempts, [src] refuses to open.")
@@ -1414,7 +1414,7 @@
playsound(src, 'sound/machines/creaking.ogg', 100, TRUE, mono_adj = TRUE)
- if(do_after(user, time_to_open, TRUE, src))
+ if(do_after(user, time_to_open, src))
if(density && !open(2)) //The airlock is still closed, but something prevented it opening. (Another player noticed and bolted/welded the airlock in time!)
to_chat(user, "Despite your efforts, [src] managed to resist your attempts to open it!")
diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm
index ce705c71e434..7e3febcc482c 100644
--- a/code/game/machinery/doors/poddoor.dm
+++ b/code/game/machinery/doors/poddoor.dm
@@ -157,7 +157,7 @@
if(hasPower())
time_to_open = 15 SECONDS
- if(do_after(user, time_to_open, TRUE, src))
+ if(do_after(user, time_to_open, src))
if(density && !open(TRUE)) //The airlock is still closed, but something prevented it opening. (Another player noticed and bolted/welded the airlock in time!)
to_chat(user, span_warning("Despite your efforts, [src] managed to resist your attempts to open it!"))
diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm
index ed734453202b..7db02250ce94 100644
--- a/code/game/machinery/suit_storage_unit.dm
+++ b/code/game/machinery/suit_storage_unit.dm
@@ -406,7 +406,7 @@
else
target.visible_message(span_warning("[user] starts shoving [target] into [src]!"), span_userdanger("[user] starts shoving you into [src]!"))
- if(do_mob(user, target, 30))
+ if(do_after(user, 30, target))
if(occupant || helmet || suit || storage)
return
if(target == user)
diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm
index 63d308f69558..3882fe8d5a6f 100644
--- a/code/game/mecha/equipment/mecha_equipment.dm
+++ b/code/game/mecha/equipment/mecha_equipment.dm
@@ -101,13 +101,13 @@
chassis.use_power(energy_drain)
addtimer(CALLBACK(src, PROC_REF(set_ready_state), 1), equip_cooldown)
-/obj/item/mecha_parts/mecha_equipment/proc/do_after_cooldown(atom/target)
+/obj/item/mecha_parts/mecha_equipment/proc/do_after_cooldown(atom/target, mob/user, interaction_key)
if(!chassis)
return
var/C = chassis.loc
set_ready_state(0)
chassis.use_power(energy_drain)
- . = do_after(chassis.occupant, equip_cooldown, target=target)
+ . = do_after(user, equip_cooldown, target=target, interaction_key = interaction_key)
set_ready_state(1)
if(!chassis || chassis.loc != C || src != chassis.selected || !(get_dir(chassis, target)&chassis.dir))
return 0
diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm
index 42c32e04fa98..fbe90058fc3e 100644
--- a/code/game/objects/buckling.dm
+++ b/code/game/objects/buckling.dm
@@ -210,7 +210,7 @@
M.visible_message("[user] starts buckling [M] to [src]!",\
"[user] starts buckling you to [src]!",\
"You hear metal clanking.")
- if(!do_after(user, 2 SECONDS, TRUE, M))
+ if(!do_after(user, 2 SECONDS, M))
return FALSE
// Sanity check before we attempt to buckle. Is everything still in a kosher state for buckling after the 3 seconds have elapsed?
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 7e64ce658e8b..033307e5472f 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -395,7 +395,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
if(grav > STANDARD_GRAVITY)
var/grav_power = min(3,grav - STANDARD_GRAVITY)
to_chat(user,"You start picking up [src]...")
- if(!do_mob(user,src,30*grav_power))
+ if(!do_after(user, 30*grav_power, src))
return
@@ -926,7 +926,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
var/datum/callback/tool_check = CALLBACK(src, PROC_REF(tool_check_callback), user, amount, extra_checks)
if(ismob(target))
- if(!do_mob(user, target, delay, extra_checks=tool_check))
+ if(!do_after(user, delay, target, extra_checks=tool_check))
return
else
diff --git a/code/game/objects/items/cardboard_cutouts.dm b/code/game/objects/items/cardboard_cutouts.dm
index f44359ca656c..31af53aa3fc7 100644
--- a/code/game/objects/items/cardboard_cutouts.dm
+++ b/code/game/objects/items/cardboard_cutouts.dm
@@ -104,7 +104,7 @@
var/new_appearance = show_radial_menu(user, src, possible_appearances, custom_check = CALLBACK(src, PROC_REF(check_menu), user, crayon), radius = 36, require_near = TRUE)
if(!new_appearance)
return FALSE
- if(!do_after(user, 10, FALSE, src, TRUE))
+ if(!do_after(user, 10, src, progress = TRUE))
return FALSE
if(!check_menu(user, crayon))
return FALSE
diff --git a/code/game/objects/items/dna_injector.dm b/code/game/objects/items/dna_injector.dm
index 34563d5e649c..1f78839ae40f 100644
--- a/code/game/objects/items/dna_injector.dm
+++ b/code/game/objects/items/dna_injector.dm
@@ -62,7 +62,7 @@
if(target != user)
target.visible_message("[user] is trying to inject [target] with [src]!", \
"[user] is trying to inject you with [src]!")
- if(!do_mob(user, target) || used)
+ if(!do_after(user, target = target) || used)
return
target.visible_message("[user] injects [target] with the syringe with [src]!", \
"[user] injects you with the syringe with [src]!")
diff --git a/code/game/objects/items/eightball.dm b/code/game/objects/items/eightball.dm
index 111dd3aa96bc..1396521aaf9a 100644
--- a/code/game/objects/items/eightball.dm
+++ b/code/game/objects/items/eightball.dm
@@ -59,7 +59,7 @@
shaking = TRUE
start_shaking(user)
- if(do_after(user, shake_time, needhand=TRUE, target=user, progress=TRUE))
+ if(do_after(user, shake_time, target=user))
var/answer = get_answer()
say(answer)
diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm
index f41deb5598a6..9fece4feedd4 100644
--- a/code/game/objects/items/handcuffs.dm
+++ b/code/game/objects/items/handcuffs.dm
@@ -57,7 +57,8 @@
"[user] is trying to put [src.name] on you!")
playsound(loc, cuffsound, 30, TRUE, -2)
- if(do_mob(user, C, 30) && C.canBeHandcuffed())
+ log_combat(user, C, "attempted to handcuff")
+ if(do_after(user, 3 SECONDS, C) && C.canBeHandcuffed())
if(iscyborg(user))
apply_cuffs(C, user, TRUE)
else
diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm
index 5b8db550a87d..6de461954cb2 100644
--- a/code/game/objects/items/implants/implanter.dm
+++ b/code/game/objects/items/implants/implanter.dm
@@ -27,7 +27,7 @@
M.visible_message("[user] is attempting to implant [M].")
var/turf/T = get_turf(M)
- if(T && (M == user || do_mob(user, M, 50)))
+ if(T && (M == user || do_after(user, 5 SECONDS, M)))
if(src && imp)
if(imp.implant(M, user))
if (M == user)
diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm
index d9311f5e2b43..a08b1398aad8 100644
--- a/code/game/objects/items/pet_carrier.dm
+++ b/code/game/objects/items/pet_carrier.dm
@@ -165,7 +165,7 @@
user.visible_message("[user] starts loading [target] into [src].", \
"You start loading [target] into [src]...", null, null, target)
to_chat(target, "[user] starts loading you into [user.p_their()] [name]!")
- if(!do_mob(user, target, 30))
+ if(!do_after(user, 3 SECONDS, target))
return
if(target in occupants)
return
diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm
index 32d923eef985..ca3b1e184168 100644
--- a/code/game/objects/items/stacks/medical.dm
+++ b/code/game/objects/items/stacks/medical.dm
@@ -31,17 +31,17 @@
return
if(target == user)
playsound(src, islist(apply_sounds) ? pick(apply_sounds) : apply_sounds, 25)
- if(!do_mob(user, target, self_delay, extra_checks=CALLBACK(target, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
- return
if(!silent)
user.visible_message("[user] starts to apply \the [src] on [user.p_them()]self...", "You begin applying \the [src] on yourself...")
+ if(!do_after(user, self_delay, target, extra_checks=CALLBACK(target, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ return
else if(other_delay)
playsound(src, islist(apply_sounds) ? pick(apply_sounds) : apply_sounds, 25)
- if(!do_mob(user, target, other_delay, extra_checks=CALLBACK(target, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
- return
if(!silent)
user.visible_message("[user] starts to apply \the [src] on [target].", "You begin applying \the [src] on [target]...")
+ if(!do_after(user, other_delay, target, extra_checks=CALLBACK(target, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ return
if(heal(target, user))
diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm
index 68a6772bb4e4..ead6b8aeb8f1 100644
--- a/code/game/objects/items/stacks/sheets/sheet_types.dm
+++ b/code/game/objects/items/stacks/sheets/sheet_types.dm
@@ -221,9 +221,9 @@ GLOBAL_LIST_INIT(bamboo_recipes, list ( \
force = 0
throwforce = 0
merge_type = /obj/item/stack/sheet/cotton
- var/pull_effort = 30
- var/loom_result = /obj/item/stack/sheet/cotton/cloth
grind_results = list(/datum/reagent/cellulose = 20)
+ var/pull_effort = 10
+ var/loom_result = /obj/item/stack/sheet/cotton/cloth
GLOBAL_LIST_INIT(cloth_recipes, list ( \
new/datum/stack_recipe("white jumpskirt", /obj/item/clothing/under/color/jumpskirt/white, 3), /*Ladies first*/ \
@@ -339,7 +339,6 @@ GLOBAL_LIST_INIT(durathread_recipes, list ( \
singular_name = "raw durathread ball"
icon_state = "sheet-durathreadraw"
merge_type = /obj/item/stack/sheet/cotton/durathread
- pull_effort = 70
loom_result = /obj/item/stack/sheet/durathread
grind_results = list()
diff --git a/code/game/objects/items/stacks/tape.dm b/code/game/objects/items/stacks/tape.dm
index d22b1be85344..6a984c021a26 100644
--- a/code/game/objects/items/stacks/tape.dm
+++ b/code/game/objects/items/stacks/tape.dm
@@ -114,7 +114,7 @@
return
if(use(1))
playsound(loc, usesound, 30, TRUE, -2)
- if(do_mob(user, C, other_delay) && (!C.is_mouth_covered() || !C.is_muzzled()))
+ if(do_after(user, other_delay, C) && (!C.is_mouth_covered() || !C.is_muzzled()))
apply_gag(C, user)
C.visible_message("[user] tapes [C]s mouth shut.", \
"[user] taped your mouth shut!")
@@ -134,7 +134,7 @@
"[user] is trying to put [src.name] on you!")
playsound(loc, usesound, 30, TRUE, -2)
- if(do_mob(user, C, self_delay) && (C.canBeHandcuffed()))
+ if(do_after(user, self_delay, C) && (C.canBeHandcuffed()))
apply_tapecuffs(C, user)
C.visible_message("[user] tapecuffs [C].", \
"[user] tapecuffs you.")
@@ -152,11 +152,11 @@
if(C == user)
playsound(loc, usesound, 30, TRUE, -2)
user.visible_message("[user] starts to apply \the [src] on [user.p_them()]self...", "You begin applying \the [src] on yourself...")
- if(!do_mob(user, C, self_delay, extra_checks=CALLBACK(C, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ if(!do_after(user, self_delay, C, extra_checks=CALLBACK(C, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
return
else if(other_delay)
user.visible_message("[user] starts to apply \the [src] on [C].", "You begin applying \the [src] on [C]...")
- if(!do_mob(user, C, other_delay, extra_checks=CALLBACK(C, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ if(!do_after(user, other_delay, C, extra_checks=CALLBACK(C, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
return
if(heal(C, user))
diff --git a/code/game/objects/items/survery_handheld.dm b/code/game/objects/items/survery_handheld.dm
index 79523b574030..547bdc150237 100644
--- a/code/game/objects/items/survery_handheld.dm
+++ b/code/game/objects/items/survery_handheld.dm
@@ -51,7 +51,7 @@
src_turf.visible_message("Warning: unable to locate valuable information in current sector.")
break
- if(!do_after_mob(user, list(src), survey_delay / penalty))
+ if(!do_after(user, list(src), survey_delay / penalty))
flick(icon_state + "-corrupted", src)
playsound(src, 'sound/machines/buzz-sigh.ogg', 20)
src_turf.visible_message("Warning: results corrupted. Please try again.")
diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm
index 69efcd42af15..971ba3cbedce 100644
--- a/code/game/objects/structures.dm
+++ b/code/game/objects/structures.dm
@@ -93,7 +93,7 @@
if(HAS_TRAIT(user, TRAIT_FREERUNNING)) //do you have any idea how fast I am???
adjusted_climb_time *= 0.8
structureclimber = user
- if(do_mob(user, user, adjusted_climb_time))
+ if(do_after(user, adjusted_climb_time))
if(src.loc) //Checking if structure has been destroyed
if(do_climb(user))
user.visible_message("[user] climbs onto [src].", \
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 417a1f8d86a6..714129498e4c 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -343,7 +343,7 @@
"You [actuallyismob ? "try to ":""]stuff [O] into [src].", \
"You hear clanging.")
if(actuallyismob)
- if(do_after_mob(user, targets, 40))
+ if(do_after(user, 40, targets))
user.visible_message(
"[user] stuffs [O] into [src].", \
"You stuff [O] into [src].", \
diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm
index d863b693604f..6512a0683947 100644
--- a/code/game/objects/structures/kitchen_spike.dm
+++ b/code/game/objects/structures/kitchen_spike.dm
@@ -64,7 +64,7 @@
/obj/structure/kitchenspike/attack_hand(mob/user)
if(VIABLE_MOB_CHECK(user.pulling) && user.a_intent == INTENT_GRAB && !has_buckled_mobs())
var/mob/living/L = user.pulling
- if(do_mob(user, src, 120))
+ if(do_after(user, 12 SECONDS, src))
if(has_buckled_mobs()) //to prevent spam/queing up attacks
return
if(L.buckled)
diff --git a/code/game/objects/structures/loom.dm b/code/game/objects/structures/loom.dm
index 28ff5a8de732..e2c3b8909913 100644
--- a/code/game/objects/structures/loom.dm
+++ b/code/game/objects/structures/loom.dm
@@ -31,11 +31,9 @@
user.show_message("You need at least [FABRIC_PER_SHEET] units of fabric before using this.", MSG_VISUAL)
return FALSE
user.show_message("You start weaving \the [W.name] through the loom..", MSG_VISUAL)
- if(W.use_tool(src, user, W.pull_effort))
- if(W.amount >= FABRIC_PER_SHEET)
- new W.loom_result(drop_location())
- W.use(FABRIC_PER_SHEET)
- user.show_message("You weave \the [W.name] into a workable fabric.", MSG_VISUAL)
+ while(W.use_tool(src, user, W.pull_effort) && W.use(FABRIC_PER_SHEET))
+ new W.loom_result(drop_location())
+ user.show_message("You weave \the [W.name] into a workable fabric.", MSG_VISUAL)
return TRUE
#undef FABRIC_PER_SHEET
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index fa964a55619b..ffd4e021086a 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -336,7 +336,7 @@
if((user.a_intent != INTENT_HARM) && istype(I, /obj/item/paper) && (obj_integrity < max_integrity))
user.visible_message("[user] starts to patch the holes in [src].", "You start patching some of the holes in [src]!")
- if(do_after(user, 20, TRUE, src))
+ if(do_after(user, 20, src))
obj_integrity = min(obj_integrity+4,max_integrity)
qdel(I)
user.visible_message("[user] patches some of the holes in [src].", "You patch some of the holes in [src]!")
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index 2257a3c10c3a..27c10f244c37 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -746,7 +746,7 @@
return
building = TRUE
to_chat(user, "You start assembling [src]...")
- if(do_after(user, 50, target = user, progress=TRUE))
+ if(do_after(user, 50, target = user))
if(!user.temporarilyRemoveItemFromInventory(src))
return
var/obj/structure/R = new construction_type(user.loc)
diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm
index 377c40d4e7ce..c22858ea591d 100644
--- a/code/game/objects/structures/watercloset.dm
+++ b/code/game/objects/structures/watercloset.dm
@@ -40,7 +40,7 @@
GM.visible_message("[user] starts to give [GM] a swirlie!", "[user] starts to give you a swirlie...")
swirlie = GM
var/was_alive = (swirlie.stat != DEAD)
- if(do_after(user, 30, 0, target = src))
+ if(do_after(user, 30, target = src, timed_action_flags = IGNORE_HELD_ITEM))
GM.visible_message("[user] gives [GM] a swirlie!", "[user] gives you a swirlie!", "You hear a toilet flushing.")
if(iscarbon(GM))
var/mob/living/carbon/C = GM
diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
index 5efddfb3cf8c..1245e2585462 100644
--- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm
+++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
@@ -577,9 +577,11 @@ Congratulations! You are now trained for invasive xenobiology research!"}
if(!C.handcuffed)
if(C.canBeHandcuffed())
playsound(src, 'sound/weapons/cablecuff.ogg', 30, TRUE, -2)
- C.visible_message("[user] begins restraining [C] with [src]!", \
- "[user] begins shaping an energy field around your hands!")
- if(do_mob(user, C, time_to_cuff) && C.canBeHandcuffed())
+ C.visible_message(
+ "[user] begins restraining [C] with [src]!", \
+ "[user] begins shaping an energy field around your hands!"
+ )
+ if(do_after(user, time_to_cuff, C) && C.canBeHandcuffed())
if(!C.handcuffed)
C.set_handcuffed(new /obj/item/restraints/handcuffs/energy/used(C))
C.update_handcuffed()
diff --git a/code/modules/antagonists/borer/borer.dm b/code/modules/antagonists/borer/borer.dm
index 511bbbec1fd5..92a1e728dc8b 100644
--- a/code/modules/antagonists/borer/borer.dm
+++ b/code/modules/antagonists/borer/borer.dm
@@ -422,7 +422,7 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 3)
"[src] tears [H.ears] off of your ear!") //coz, you know, they go in the ear holes
to_chat(src, "You slither up [H] and begin probing at their ear canal...")
- if(!do_mob(src, H, 30))
+ if(!do_after(src, 3 SECONDS, H))
to_chat(src, "As [H] moves away, you are dislodged and fall to the ground.")
return
diff --git a/code/modules/antagonists/changeling/powers/absorb.dm b/code/modules/antagonists/changeling/powers/absorb.dm
index 33e0a8f75d48..a54cdc4cd09c 100644
--- a/code/modules/antagonists/changeling/powers/absorb.dm
+++ b/code/modules/antagonists/changeling/powers/absorb.dm
@@ -43,7 +43,7 @@
target.take_overall_damage(40)
SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("Absorb DNA", "[i]"))
- if(!do_mob(user, target, 150))
+ if(!do_after(user, 15 SECONDS, target))
to_chat(user, "Our absorption of [target] has been interrupted!")
changeling.isabsorbing = 0
return
diff --git a/code/modules/antagonists/changeling/powers/linglink.dm b/code/modules/antagonists/changeling/powers/linglink.dm
index a0008dec26de..6036ae1d00f6 100644
--- a/code/modules/antagonists/changeling/powers/linglink.dm
+++ b/code/modules/antagonists/changeling/powers/linglink.dm
@@ -58,7 +58,7 @@
target.say("[MODE_TOKEN_CHANGELING] AAAAARRRRGGGGGHHHHH!!")
to_chat(target, "You can now communicate in the changeling hivemind, say \"[MODE_TOKEN_CHANGELING] message\" to communicate!")
SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("[name]", "[i]"))
- if(!do_mob(user, target, 20))
+ if(!do_after(user, 2 SECONDS, target))
to_chat(user, "Our link with [target] has ended!")
changeling.islinking = 0
target.mind.linglink = 0
@@ -67,7 +67,7 @@
to_chat(user, "We must keep holding on to [target] to sustain the link. ")
while(user.pulling && user.grab_state >= GRAB_NECK)
target.reagents.add_reagent(/datum/reagent/medicine/salbutamol, 0.5) // So they don't choke to death while you interrogate them
- do_mob(user, target, 100, TRUE)
+ do_after(user, 10 SECONDS, target, TRUE)
changeling.islinking = 0
target.mind.linglink = 0
diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm
index 00dc550c11ce..cf1562d8c289 100644
--- a/code/modules/antagonists/cult/blood_magic.dm
+++ b/code/modules/antagonists/cult/blood_magic.dm
@@ -535,7 +535,7 @@
playsound(loc, 'sound/weapons/cablecuff.ogg', 30, TRUE, -2)
C.visible_message("[user] begins restraining [C] with dark magic!", \
"[user] begins shaping dark magic shackles around your wrists!")
- if(do_mob(user, C, 30))
+ if(do_after(user, 3 SECONDS, C))
if(!C.handcuffed)
C.set_handcuffed(new /obj/item/restraints/handcuffs/energy/cult/used(C))
C.update_handcuffed()
diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm
index b235199ed750..ca568bce6316 100644
--- a/code/modules/antagonists/revenant/revenant_abilities.dm
+++ b/code/modules/antagonists/revenant/revenant_abilities.dm
@@ -34,7 +34,7 @@
draining = TRUE
essence_drained += rand(15, 20)
to_chat(src, "You search for the soul of [target].")
- if(do_after(src, rand(10, 20), 0, target)) //did they get deleted in that second?
+ if(do_after(src, rand(10, 20), target, timed_action_flags = IGNORE_HELD_ITEM)) //did they get deleted in that second?
if(target.ckey)
to_chat(src, "[target.p_their(TRUE)] soul burns with intelligence.")
essence_drained += rand(20, 30)
@@ -43,7 +43,7 @@
essence_drained += rand(40, 50)
else
to_chat(src, "[target.p_their(TRUE)] soul is weak and faltering.")
- if(do_after(src, rand(15, 20), 0, target)) //did they get deleted NOW?
+ if(do_after(src, rand(15, 20), target, timed_action_flags = IGNORE_HELD_ITEM)) //did they get deleted NOW?
switch(essence_drained)
if(1 to 30)
to_chat(src, "[target] will not yield much essence. Still, every bit counts.")
@@ -53,7 +53,7 @@
to_chat(src, "Such a feast! [target] will yield much essence to you.")
if(90 to INFINITY)
to_chat(src, "Ah, the perfect soul. [target] will yield massive amounts of essence to you.")
- if(do_after(src, rand(15, 25), 0, target)) //how about now
+ if(do_after(src, rand(15, 25), target, timed_action_flags = IGNORE_HELD_ITEM)) //how about now
if(!target.stat)
to_chat(src, "[target.p_theyre(TRUE)] now powerful enough to fight off your draining.")
to_chat(target, "You feel something tugging across your body before subsiding.")
@@ -76,7 +76,7 @@
draining = FALSE
return
var/datum/beam/B = Beam(target,icon_state="drain_life",time=INFINITY)
- if(do_after(src, 46, 0, target)) //As one cannot prove the existance of ghosts, ghosts cannot prove the existance of the target they were draining.
+ if(do_after(src, 46, target, timed_action_flags = IGNORE_HELD_ITEM)) //As one cannot prove the existence of ghosts, ghosts cannot prove the existence of the target they were draining.
change_essence_amount(essence_drained, FALSE, target)
if(essence_drained <= 90 && target.stat != DEAD)
essence_regen_cap += 5
diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm
index 6fec09373797..ea6fe83c8a07 100644
--- a/code/modules/antagonists/swarmer/swarmer.dm
+++ b/code/modules/antagonists/swarmer/swarmer.dm
@@ -456,7 +456,7 @@
to_chat(src, "Attempting to remove this being from our presence.")
- if(!do_mob(src, target, 30))
+ if(!do_after(src, 3 SECONDS, target))
return
var/turf/open/floor/F
@@ -491,7 +491,7 @@
D.pixel_x = target.pixel_x
D.pixel_y = target.pixel_y
D.pixel_z = target.pixel_z
- if(do_mob(src, target, 100))
+ if(do_after(src, 10 SECONDS, target))
to_chat(src, "Dismantling complete.")
var/atom/Tsec = target.drop_location()
new /obj/item/stack/sheet/metal(Tsec, 5)
@@ -604,7 +604,7 @@
if(resources < 5)
to_chat(src, "We do not have the resources for this!")
return
- if(do_mob(src, src, 10))
+ if(do_after(src, 1 SECONDS))
Fabricate(/obj/structure/swarmer/blockade, 5)
@@ -633,7 +633,7 @@
if(!isturf(loc))
to_chat(src, "This is not a suitable location for replicating ourselves. We need more room.")
return
- if(do_mob(src, src, 100))
+ if(do_after(src, 10 SECONDS))
var/createtype = SwarmerTypeToCreate()
if(createtype && Fabricate(createtype, 50))
playsound(loc,'sound/items/poster_being_created.ogg',50, TRUE, -1)
@@ -650,7 +650,7 @@
if(!isturf(loc))
return
to_chat(src, "Attempting to repair damage to our body, stand by...")
- if(do_mob(src, src, 100))
+ if(do_after(src, 10 SECONDS))
adjustHealth(-100)
to_chat(src, "We successfully repaired ourselves.")
diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm
index 1b5f0ae58fae..336ac43c7d4d 100644
--- a/code/modules/clothing/shoes/_shoes.dm
+++ b/code/modules/clothing/shoes/_shoes.dm
@@ -134,9 +134,12 @@
return
if(user == loc && tied != SHOES_TIED) // if they're our own shoes, go tie-wards
+ if(DOING_INTERACTION_WITH_TARGET(user, our_guy))
+ to_chat(user, span_warning("You're already interacting with [src]!"))
+ return
user.visible_message("[user] begins [tied ? "unknotting" : "tying"] the laces of [user.p_their()] [src.name].", "You begin [tied ? "unknotting" : "tying"] the laces of your [src.name]...")
- if(do_after(user, lace_time, needhand=TRUE, target=our_guy, extra_checks=CALLBACK(src, PROC_REF(still_shoed), our_guy)))
+ if(do_after(user, lace_time, target = our_guy, extra_checks = CALLBACK(src, PROC_REF(still_shoed), our_guy)))
to_chat(user, "You [tied ? "unknot" : "tie"] the laces of your [src.name].")
if(tied == SHOES_UNTIED)
adjust_laces(SHOES_TIED, user)
@@ -151,13 +154,16 @@
if(tied == SHOES_KNOTTED)
to_chat(user, "The laces on [loc]'s [src.name] are already a hopelessly tangled mess!")
return
+ if(DOING_INTERACTION_WITH_TARGET(user, our_guy))
+ to_chat(user, span_warning("You're already interacting with [src]!"))
+ return
var/mod_time = lace_time
to_chat(user, "You quietly set to work [tied ? "untying" : "knotting"] [loc]'s [src.name]...")
if(HAS_TRAIT(user, TRAIT_CLUMSY)) // based clowns trained their whole lives for this
mod_time *= 0.75
- if(do_after(user, mod_time, needhand=TRUE, target=our_guy, extra_checks=CALLBACK(src, PROC_REF(still_shoed), our_guy), hidden = TRUE))
+ if(do_after(user, mod_time, target = our_guy, extra_checks = CALLBACK(src, PROC_REF(still_shoed), our_guy)))
to_chat(user, "You [tied ? "untie" : "knot"] the laces on [loc]'s [src.name].")
if(tied == SHOES_UNTIED)
adjust_laces(SHOES_KNOTTED, user)
@@ -232,8 +238,12 @@
/obj/item/clothing/shoes/attack_self(mob/user)
. = ..()
+ if(DOING_INTERACTION_WITH_TARGET(user, src))
+ to_chat(user, "You're already interacting with [src]!")
+ return
+
to_chat(user, "You begin [tied ? "untying" : "tying"] the laces on [src]...")
- if(do_after(user, lace_time, needhand=TRUE, target=src,extra_checks=CALLBACK(src, PROC_REF(still_shoed), user)))
+ if(do_after(user, lace_time, target = src,extra_checks = CALLBACK(src, PROC_REF(still_shoed), user)))
to_chat(user, "You [tied ? "untie" : "tie"] the laces on [src].")
adjust_laces(tied ? SHOES_TIED : SHOES_UNTIED, user)
diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm
index aa2830daee92..d6a281a2b925 100644
--- a/code/modules/food_and_drinks/drinks/drinks.dm
+++ b/code/modules/food_and_drinks/drinks/drinks.dm
@@ -39,7 +39,7 @@
else
M.visible_message("[user] attempts to feed [M] the contents of [src].", \
"[user] attempts to feed you the contents of [src].")
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return
if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding
diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm
index 589e986aaeeb..615ec2785f82 100644
--- a/code/modules/food_and_drinks/food/condiment.dm
+++ b/code/modules/food_and_drinks/food/condiment.dm
@@ -79,7 +79,7 @@
else
M.visible_message("[user] attempts to feed [M] from [src].", \
"[user] attempts to feed you from [src].")
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return
if(!reagents || !reagents.total_volume)
return // The condiment might be empty after the delay.
diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm
index 2dd04174ba85..b64d52eea54a 100644
--- a/code/modules/food_and_drinks/food/snacks.dm
+++ b/code/modules/food_and_drinks/food/snacks.dm
@@ -126,7 +126,7 @@ All foods are distributed among various categories. Use common sense.
"[user] cannot force any more of [src] down your throat!")
return FALSE
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return
log_combat(user, M, "fed", reagents.log_list())
M.visible_message("[user] forces [M] to eat [src]!", \
diff --git a/code/modules/hydroponics/grown/kudzu.dm b/code/modules/hydroponics/grown/kudzu.dm
index a8b9d5f8d034..a93d706a99b9 100644
--- a/code/modules/hydroponics/grown/kudzu.dm
+++ b/code/modules/hydroponics/grown/kudzu.dm
@@ -39,7 +39,7 @@
/obj/item/seeds/kudzu/attack_self(mob/user)
user.visible_message("[user] begins throwing seeds on the ground...")
- if(do_after(user, 50, needhand = TRUE, target = user.drop_location(), progress = TRUE))
+ if(do_after(user, 50, target = user.drop_location(), progress = TRUE))
plant(user)
to_chat(user, "You plant the kudzu. You monster.")
diff --git a/code/modules/library/lib_codex_gigas.dm b/code/modules/library/lib_codex_gigas.dm
index 707f7a7647b7..69155c9230d8 100644
--- a/code/modules/library/lib_codex_gigas.dm
+++ b/code/modules/library/lib_codex_gigas.dm
@@ -48,7 +48,7 @@
correctness = 100
correctness -= U.getOrganLoss(ORGAN_SLOT_BRAIN) * 0.5 //Brain damage makes researching hard.
speed += U.getOrganLoss(ORGAN_SLOT_BRAIN) * 3
- if(do_after(user, speed, 0, user))
+ if(do_after(user, speed, user, timed_action_flags = IGNORE_HELD_ITEM))
var/usedName = devilName
if(!prob(correctness))
usedName += "x"
diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm
index a70520462f39..8629d01650d4 100644
--- a/code/modules/mob/living/brain/brain_item.dm
+++ b/code/modules/mob/living/brain/brain_item.dm
@@ -113,7 +113,7 @@
return
user.visible_message("[user] starts to pour the contents of [O] onto [src].", "You start to slowly pour the contents of [O] onto [src].")
- if(!do_after(user, 60, TRUE, src))
+ if(!do_after(user, 60, src))
to_chat(user, "You failed to pour [O] onto [src]!")
return
diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm
index 651ea4c6d0ee..dcb44af19cca 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm
@@ -63,7 +63,7 @@
if(href_list["pouches"] && usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY))
visible_message("[usr] tries to empty [src]'s pouches.", \
"[usr] tries to empty your pouches.")
- if(do_mob(usr, src, POCKET_STRIP_DELAY * 0.5))
+ if(do_after(usr, POCKET_STRIP_DELAY * 0.5, src))
dropItemToGround(r_store)
dropItemToGround(l_store)
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 36fd8e1e6704..dd5b29059085 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -202,7 +202,7 @@
visible_message("[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name].", \
"[usr] tries to [internal ? "close" : "open"] the valve on your [ITEM.name].", null, null, usr)
to_chat(usr, "You try to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name]...")
- if(do_mob(usr, src, POCKET_STRIP_DELAY))
+ if(do_after(usr, POCKET_STRIP_DELAY, src))
if(internal)
internal = null
update_internals_hud_icon(0)
@@ -255,7 +255,7 @@
buckle_cd = O.breakouttime
visible_message("[src] attempts to unbuckle [p_them()]self!", \
"You attempt to unbuckle yourself... (This will take around [round(buckle_cd/600,1)] minute\s, and you need to stay still.)")
- if(do_after(src, buckle_cd, 0, target = src, hidden = TRUE))
+ if(do_after(src, buckle_cd, target = src, timed_action_flags = IGNORE_HELD_ITEM))
if(!buckled)
return
buckled.user_unbuckle_mob(src,src)
@@ -306,7 +306,7 @@
if(!cuff_break)
visible_message("[src] attempts to remove [I]!")
to_chat(src, "You attempt to remove [I]... (This will take around [DisplayTimeText(breakouttime)] and you need to stand still.)")
- if(do_after(src, breakouttime, 0, target = src))
+ if(do_after(src, breakouttime, target = src, timed_action_flags = IGNORE_HELD_ITEM))
. = clear_cuffs(I, cuff_break)
else
to_chat(src, "You fail to remove [I]!")
@@ -315,7 +315,7 @@
breakouttime = 50
visible_message("[src] is trying to break [I]!")
to_chat(src, "You attempt to break [I]... (This will take around 5 seconds and you need to stand still.)")
- if(do_after(src, breakouttime, 0, target = src))
+ if(do_after(src, breakouttime, target = src, timed_action_flags = IGNORE_HELD_ITEM))
. = clear_cuffs(I, cuff_break)
else
to_chat(src, "You fail to break [I]!")
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 528d8500ea46..27fa569de7cd 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -245,7 +245,7 @@
else
return
- if(do_mob(usr, src, POCKET_STRIP_DELAY/delay_denominator, hidden = TRUE)) //placing an item into the pocket is 4 times faster
+ if(do_after(usr, POCKET_STRIP_DELAY/delay_denominator, src, hidden = TRUE)) //placing an item into the pocket is 4 times faster
if(pocket_item)
if(pocket_item == (pocket_id == ITEM_SLOT_RPOCKET ? r_store : l_store)) //item still in the pocket we search
dropItemToGround(pocket_item)
@@ -263,7 +263,7 @@
if(href_list["toggle_uniform"] && usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY))
var/obj/item/clothing/under/U = get_item_by_slot(ITEM_SLOT_ICLOTHING)
to_chat(src, "[usr.name] is trying to adjust your [U].")
- if(do_mob(usr, src, U.strip_delay/2))
+ if(do_after(usr, U.strip_delay/2, src))
to_chat(src, "[usr.name] successfully adjusted your [U].")
U.toggle_jumpsuit_adjust()
update_inv_w_uniform()
@@ -612,10 +612,13 @@
/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/target)
var/panicking = FALSE
+ if(target == src) //Sanity check, in case spacetime crumbles and allows us to perform cpr on ourselves
+ return
+
do
CHECK_DNA_AND_SPECIES(target)
- if (INTERACTING_WITH(src, target))
+ if (DOING_INTERACTION_WITH_TARGET(src,target))
return FALSE
if (target.stat == DEAD || HAS_TRAIT(target, TRAIT_FAKEDEATH))
@@ -641,7 +644,7 @@
visible_message("[src] is trying to perform CPR on [target.name]!", \
"You try to perform CPR on [target.name]... Hold still!")
- if (!do_mob(src, target, time = panicking ? CPR_PANIC_SPEED : (3 SECONDS)))
+ if (!do_after(src, delay = panicking ? CPR_PANIC_SPEED : (3 SECONDS), target = target))
to_chat(src, "You fail to perform CPR on [target]!")
return FALSE
@@ -1063,7 +1066,7 @@
if(!src.is_busy && (src.zone_selected == BODY_ZONE_HEAD || src.zone_selected == BODY_ZONE_PRECISE_GROIN) && get_turf(src) == get_turf(T) && !(T.mobility_flags & MOBILITY_STAND) && src.a_intent != INTENT_HELP) //all the stars align, time to curbstomp
src.is_busy = TRUE
- if (!do_mob(src,T,25) || get_turf(src) != get_turf(T) || (T.mobility_flags & MOBILITY_STAND) || src.a_intent == INTENT_HELP || src == T) //wait 30ds and make sure the stars still align (Body zone check removed after PR #958)
+ if (!do_after(src, 2.5 SECONDS, T) || get_turf(src) != get_turf(T) || (T.mobility_flags & MOBILITY_STAND) || src.a_intent == INTENT_HELP || src == T) //wait 30ds and make sure the stars still align (Body zone check removed after PR #958)
src.is_busy = FALSE
return
@@ -1151,7 +1154,7 @@
//Joe Medic starts quickly/expertly lifting Grey Tider onto their back..
"[carrydelay < 35 ? "Using your gloves' nanochips, you" : "You"] [skills_space] start to lift [target] onto your back[carrydelay == 40 ? ", while assisted by the nanochips in your gloves.." : "..."]")
//(Using your gloves' nanochips, you/You) (/quickly/expertly) start to lift Grey Tider onto your back(, while assisted by the nanochips in your gloves../...)
- if(do_after(src, carrydelay, TRUE, target))
+ if(do_after(src, carrydelay, target))
//Second check to make sure they're still valid to be carried
if(can_be_firemanned(target) && !incapacitated(FALSE, TRUE) && !target.buckled)
buckle_mob(target, TRUE, TRUE, 90, 1, 0)
@@ -1174,7 +1177,7 @@
//Joe Medic starts quickly/expertly scooping Grey Tider into their arms..
"[carrydelay < 11 ? "Using your gloves' nanochips, you" : "You"] [skills_space] start to scoop [target] into your arms[carrydelay == 15 ? ", while assisted by the nanochips in your gloves.." : "..."]")
//(Using your gloves' nanochips, you/You) ( /quickly/expertly) start to scoop Grey Tider into your arms(, while assisted by the nanochips in your gloves../...)
- if(do_after(src, carrydelay, TRUE, target))
+ if(do_after(src, carrydelay, target))
//Second check to make sure they're still valid to be carried
if(!incapacitated(FALSE, TRUE) && !target.buckled)
buckle_mob(target, TRUE, TRUE, 90, 1, 0)
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index c276b44947c2..166d2d4e83a0 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1445,7 +1445,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
user.visible_message("[user] starts stealing [target]'s [I.name]!",
"You start stealing [target]'s [I.name]...", null, null, target)
to_chat(target, "[user] starts stealing your [I.name]!")
- if(do_after(user, I.strip_delay, TRUE, target, TRUE))
+ if(do_after(user, I.strip_delay, target))
target.dropItemToGround(I, TRUE)
user.put_in_hands(I)
user.visible_message("[user] stole [target]'s [I.name]!",
diff --git a/code/modules/mob/living/carbon/human/species_types/ethereal.dm b/code/modules/mob/living/carbon/human/species_types/ethereal.dm
index 12b824f5eac4..4ad5297b73d9 100644
--- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm
+++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm
@@ -271,7 +271,7 @@
var/static/mutable_appearance/overcharge //shameless copycode from lightning spell
overcharge = overcharge || mutable_appearance('icons/effects/effects.dmi', "electricity", EFFECTS_LAYER)
_human.add_overlay(overcharge)
- if(do_mob(_human, _human, 50, 1))
+ if(do_after(_human, 50, _human, 1))
_human.flash_lighting_fx(5, 7, current_color)
var/obj/item/organ/stomach/ethereal/stomach = _human.getorganslot(ORGAN_SLOT_STOMACH)
playsound(_human, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
index eb78ef131644..30f3d5f74b58 100644
--- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
+++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
@@ -313,7 +313,7 @@
H.notransform = TRUE
- if(do_after(owner, delay=60, needhand=FALSE, target=owner, progress=TRUE))
+ if(do_after(owner, delay=60, target=owner, progress=TRUE, timed_action_flags = IGNORE_HELD_ITEM))
if(H.blood_volume >= BLOOD_VOLUME_SLIME_SPLIT)
make_dupe()
else
diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm
index 1f730de799d0..8fd4e89566c7 100644
--- a/code/modules/mob/living/carbon/monkey/combat.dm
+++ b/code/modules/mob/living/carbon/monkey/combat.dm
@@ -296,7 +296,7 @@
return IsStandingStill()
/mob/living/carbon/monkey/proc/pickpocket(mob/M)
- if(do_mob(src, M, MONKEY_ITEM_SNATCH_DELAY) && pickupTarget)
+ if(do_after(src, MONKEY_ITEM_SNATCH_DELAY, M) && pickupTarget)
for(var/obj/item/I in M.held_items)
if(I == pickupTarget)
M.visible_message("[src] snatches [pickupTarget] from [M].", "[src] snatched [pickupTarget]!")
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 4e220fd18cff..cb0ec02ced34 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -507,7 +507,7 @@
/mob/living/proc/get_up(instant = FALSE)
set waitfor = FALSE
- if(!instant && !do_mob(src, src, 2 SECONDS, uninterruptible = TRUE, extra_checks = CALLBACK(src, TYPE_PROC_REF(/mob/living, rest_checks_callback))))
+ if(!instant && !do_after(src, 1 SECONDS, src, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM), extra_checks = CALLBACK(src, TYPE_PROC_REF(/mob/living, rest_checks_callback)), interaction_key = DOAFTER_SOURCE_GETTING_UP))
return
if(resting || body_position == STANDING_UP || HAS_TRAIT(src, TRAIT_FLOORED))
return
@@ -977,7 +977,7 @@
"[src] tries to remove your [what.name].", null, null, src)
to_chat(src, "You try to remove [who]'s [what.name]...")
what.add_fingerprint(src)
- if(do_mob(src, who, what.strip_delay))
+ if(do_after(src, what.strip_delay, who, interaction_key = what))
if(what && Adjacent(who))
if(islist(where))
var/list/L = where
@@ -1024,7 +1024,7 @@
who.visible_message("[src] tries to put [what] on [who].", \
"[src] tries to put [what] on you.", null, null, src)
to_chat(src, "You try to put [what] on [who]...")
- if(do_mob(src, who, what.equip_delay_other))
+ if(do_after(src, what.equip_delay_other, who))
if(what && Adjacent(who) && what.mob_can_equip(who, src, final_where, TRUE, TRUE))
if(temporarilyRemoveItemFromInventory(what))
if(where_list)
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 977cb220568e..c1c4cd668792 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -182,7 +182,7 @@
log_combat(user, src, "attempted to neck grab", addition="neck grab")
if(GRAB_NECK)
log_combat(user, src, "attempted to strangle", addition="kill grab")
- if(!do_mob(user, src, grab_upgrade_time))
+ if(!do_after(user, grab_upgrade_time, src))
return 0
if(!user.pulling || user.pulling != src || user.grab_state != old_grab_state)
return 0
diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm
index 3a07ffc4cb8d..22d68c8a6190 100644
--- a/code/modules/mob/living/simple_animal/bot/medbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/medbot.dm
@@ -488,6 +488,9 @@
return TRUE
/mob/living/simple_animal/bot/medbot/attack_hand(mob/living/carbon/human/H)
+ if(DOING_INTERACTION_WITH_TARGET(H, src))
+ to_chat(H, "You're already interacting with [src].")
+ return
if(H.a_intent == INTENT_DISARM && mode != BOT_TIPPED)
H.visible_message("[H] begins tipping over [src].", "You begin tipping over [src]...")
@@ -574,7 +577,7 @@
C.visible_message("[src] is trying to tend the wounds of [patient]!", \
"[src] is trying to tend your wounds!")
- if(do_mob(src, patient, 20)) //Slightly faster than default tend wounds, but does less HPS
+ if(do_after(src, 2 SECONDS, patient)) //Slightly faster than default tend wounds, but does less HPS
if((get_dist(src, patient) <= 1) && (on) && assess_patient(patient))
var/healies = heal_amount
var/obj/item/storage/firstaid/FA = firstaid
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
index 8aeb3b64a8cd..104d4363bc3b 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
@@ -79,7 +79,7 @@
to_chat(user, "You can't seem to find the [pick(faux_gadgets)]! Without it, [src] [pick(faux_problems)].")
return
user.visible_message("[user] begins to reactivate [src].", "You begin to reactivate [src]...")
- if(do_after(user, 30, 1, target = src))
+ if(do_after(user, 30, target = src))
revive(full_heal = TRUE, admin_revive = FALSE)
user.visible_message("[user] reactivates [src]!", "You reactivate [src].")
alert_drones(DRONE_NET_CONNECT)
diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm
index 1e02c89c81f7..57f1b1892f9d 100644
--- a/code/modules/mob/living/simple_animal/guardian/types/support.dm
+++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm
@@ -134,7 +134,7 @@
"You start to faintly glow, and you feel strangely weightless!")
do_attack_animation(A)
- if(!do_mob(src, A, 60)) //now start the channel
+ if(!do_after(src, 6 SECONDS, A)) //now start the channel
to_chat(src, "You need to hold still!")
return
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 2f79b2a13d69..c7070a66bcdf 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -522,7 +522,7 @@
to_chat(src, "You don't have a free hand to examine this!")
return FALSE
//can only queue up one examine on something at a time
- if(examined_thing in do_afters)
+ if(DOING_INTERACTION_WITH_TARGET(src, examined_thing))
return FALSE
to_chat(src, "You start feeling around for something...")
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index 6873ee602dac..def2bde930e0 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -191,7 +191,7 @@
///List of progress bars this mob is currently seeing for actions
var/list/progressbars = null //for stacking do_after bars
- ///For storing what do_after's someone has, in case we want to restrict them to only one of a certain do_after at a time
+ ///For storing what do_after's someone has, key = string, value = amount of interactions of that type happening.
var/list/do_afters
///Allows a datum to intercept all click calls this mob is the source of
diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm
index 59fdee827907..5b1f27fa2cb9 100644
--- a/code/modules/overmap/helm.dm
+++ b/code/modules/overmap/helm.dm
@@ -388,11 +388,11 @@
return
to_chat(user, "You begin to manually override the local database...")
- if(!do_after_mob(user, list(src), 2 SECONDS))
+ if(!do_after(user, 2 SECONDS, list(src)))
return COMPONENT_BLOCK_TOOL_ATTACK
priority_announce("Illegal access to local ship database detected.", sender_override="[src.name]", zlevel=virtual_z())
- if(!do_after_mob(user, list(src), 10 SECONDS))
+ if(!do_after(user, 10 SECONDS, list(src)))
return COMPONENT_BLOCK_TOOL_ATTACK
say("Warning, database corruption present, resetting local database state.")
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index 3f85acdddfe6..283d41524f79 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -542,7 +542,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain
if(affecting && (!IS_ORGANIC_LIMB(affecting)))
if(user == H)
user.visible_message("[user] starts to fix some of the wires in [H]'s [parse_zone(affecting.body_zone)].", "You start fixing some of the wires in [H == user ? "your" : "[H]'s"] [parse_zone(affecting.body_zone)].")
- if(!do_mob(user, H, 50))
+ if(!do_after(user, 0.5 SECONDS, H))
return
if(item_heal_robotic(H, user, 0, 15))
use(1)
diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm
index 08a87e017aad..4c3c8b736c4d 100644
--- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm
+++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm
@@ -98,7 +98,7 @@
if(istype(attacking_obj, /obj/item/ammo_box))
var/obj/item/ammo_box/attacking_box = attacking_obj
for(var/obj/item/ammo_casing/casing_to_insert in attacking_box.stored_ammo)
- if(!((instant_load && attacking_box.instant_load) || (stored_ammo.len >= max_ammo) || do_after_mob(user, list(attacking_box), 1 SECONDS)))
+ if(!((instant_load && attacking_box.instant_load) || (stored_ammo.len >= max_ammo) || do_after(user, 1 SECONDS, list(attacking_box))))
break
var/did_load = give_round(casing_to_insert, replace_spent)
if(!did_load)
diff --git a/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm b/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm
index 160e1bd5066d..f8ce8223748d 100644
--- a/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm
+++ b/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm
@@ -66,7 +66,7 @@
var/list/ammo_list_no_empty = ammo_list(FALSE)
listclearnulls(ammo_list_no_empty)
for(var/obj/item/ammo_casing/casing_to_insert in attacking_box.stored_ammo)
- if(!((instant_load && attacking_box.instant_load) || (ammo_list_no_empty.len >= max_ammo) || do_after_mob(user, list(attacking_box), 1 SECONDS))) //stupid work around for revolvers
+ if(!((instant_load && attacking_box.instant_load) || (ammo_list_no_empty.len >= max_ammo) || do_after(user, 1 SECONDS, list(attacking_box)))) //stupid work around for revolvers
break
var/did_load = give_round(casing_to_insert, replace_spent)
if(!did_load)
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index ca4d0217b380..892a914b88c5 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -141,7 +141,16 @@
user.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/gun, multiplicative_slowdown = wield_slowdown)
wield_time = world.time + wield_delay
if(wield_time > 0)
- if(do_mob(user, user, wield_delay, FALSE, TRUE, CALLBACK(src, PROC_REF(is_wielded)), ignore_loc_change = TRUE))
+ if(do_after(
+ user,
+ wield_delay,
+ user,
+ FALSE,
+ TRUE,
+ CALLBACK(src, PROC_REF(is_wielded)),
+ timed_action_flags = IGNORE_USER_LOC_CHANGE
+ )
+ )
wielded_fully = TRUE
else
wielded_fully = TRUE
@@ -673,7 +682,7 @@
semicd = TRUE
- if(!bypass_timer && (!do_mob(user, target, 100) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH))
+ if(!bypass_timer && (!do_after(user, 100, target) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH))
if(user)
if(user == target)
user.visible_message(span_notice("[user] decided not to shoot."))
diff --git a/code/modules/projectiles/guns/ballistic/hmg.dm b/code/modules/projectiles/guns/ballistic/hmg.dm
index 3bd143e98b43..359a9e13e31e 100644
--- a/code/modules/projectiles/guns/ballistic/hmg.dm
+++ b/code/modules/projectiles/guns/ballistic/hmg.dm
@@ -85,7 +85,7 @@
if(!can_deploy)
to_chat(user, "You need to brace against something to deploy [src]'s bipod! Either lie on the floor or stand next to a waist high object like a table!")
return
- if(!do_mob(user, src, deploy_time, FALSE, TRUE, CALLBACK(src, PROC_REF(is_wielded))))
+ if(!do_after(user, deploy_time, src, FALSE, TRUE, CALLBACK(src, PROC_REF(is_wielded))))
to_chat(user, "You need to hold still to deploy [src]'s bipod!")
return
playsound(src, 'sound/machines/click.ogg', 75, TRUE)
diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm
index 7fcc3c4b500c..6579e3077734 100644
--- a/code/modules/projectiles/guns/ballistic/revolver.dm
+++ b/code/modules/projectiles/guns/ballistic/revolver.dm
@@ -98,13 +98,13 @@
for(var/i in 1 to num_to_unload)
var/doafter_time = 0.4 SECONDS
- if(!do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
break
if(!eject_casing(user))
doafter_time = 0 SECONDS
else
num_unloaded++
- if(!do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
break
chamber_round(TRUE, TRUE)
@@ -170,7 +170,7 @@
else
if(slot)
if(!slot.BB && allow_ejection)
- if(do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
eject_casing(user)
rounds = magazine.ammo_list()
@@ -214,7 +214,7 @@
var/doafter_time = 0.8 SECONDS
if(magazine.instant_load && attacking_box.instant_load)
doafter_time = 0 SECONDS
- if(!do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
break
if(!insert_casing(user, casing_to_insert, FALSE))
break
@@ -231,7 +231,7 @@
if(!casing_to_insert || (magazine.caliber && casing_to_insert.caliber != magazine.caliber) || (!magazine.caliber && casing_to_insert.type != magazine.ammo_type))
break
var/doafter_time = 0.4 SECONDS
- if(!do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
break
if(!insert_casing(null, casing_to_insert, FALSE))
doafter_time = 0 SECONDS
@@ -239,7 +239,7 @@
num_loaded++
attacking_box.update_appearance()
attacking_box.stored_ammo -= casing_to_insert
- if(!do_mob(user,user,doafter_time))
+ if(!do_after(user, doafter_time, user))
break
switch(gate_load_direction)
if(REVOLVER_AUTO_ROTATE_RIGHT_LOADING)
diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm
index 58e46dcb1048..b0c949d122f9 100644
--- a/code/modules/reagents/reagent_containers/glass.dm
+++ b/code/modules/reagents/reagent_containers/glass.dm
@@ -40,7 +40,7 @@
if(M != user)
M.visible_message("[user] attempts to feed [M] something from [src].", \
"[user] attempts to feed you something from [src].")
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return
if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding
diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm
index 7efe82893918..11cbd03c9787 100644
--- a/code/modules/reagents/reagent_containers/hypospray.dm
+++ b/code/modules/reagents/reagent_containers/hypospray.dm
@@ -490,7 +490,7 @@
if(L != user)
L.visible_message("[user] is trying to inject [L] with [src]!", \
"[user] is trying to inject [L] with [src]!")
- if(!do_mob(user, L, inject_wait))
+ if(!do_after(user, inject_wait, L))
return
if(!penetrates && !L.can_inject(user, 1))
return
@@ -501,7 +501,7 @@
L.visible_message("[user] uses the [src] on [L]!", \
"[user] uses the [src] on [L]!")
else
- if(!do_mob(user, L, inject_self))
+ if(!do_after(user, inject_self, L))
return
if(!penetrates && !L.can_inject(user, 1))
return
@@ -526,7 +526,7 @@
if(L != user)
L.visible_message("[user] is trying to spray [L] with [src]!", \
"[user] is trying to spray [L] with [src]!")
- if(!do_mob(user, L, spray_wait))
+ if(!do_after(user, spray_wait, L))
return
if(!penetrates && !L.can_inject(user, 1))
return
@@ -537,7 +537,7 @@
L.visible_message("[user] uses the [src] on [L]!", \
"[user] uses the [src] on [L]!")
else
- if(!do_mob(user, L, spray_self))
+ if(!do_after(user, spray_self, L))
return
if(!penetrates && !L.can_inject(user, 1))
return
diff --git a/code/modules/reagents/reagent_containers/medigel.dm b/code/modules/reagents/reagent_containers/medigel.dm
index 193d588bcbb5..7e85c0c6d1ca 100644
--- a/code/modules/reagents/reagent_containers/medigel.dm
+++ b/code/modules/reagents/reagent_containers/medigel.dm
@@ -48,7 +48,7 @@
if(M == user)
M.visible_message("[user] attempts to [apply_method] [src] on [user.p_them()]self.")
if(self_delay)
- if(!do_mob(user, M, self_delay))
+ if(!do_after(user, self_delay, M))
return
if(!reagents || !reagents.total_volume)
return
@@ -58,7 +58,7 @@
log_combat(user, M, "attempted to apply", src, reagents.log_list())
M.visible_message("[user] attempts to [apply_method] [src] on [M].", \
"[user] attempts to [apply_method] [src] on you.")
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return
if(!reagents || !reagents.total_volume)
return
diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm
index 77b8bc8f318c..9cac6c3a52a2 100644
--- a/code/modules/reagents/reagent_containers/pill.dm
+++ b/code/modules/reagents/reagent_containers/pill.dm
@@ -34,14 +34,14 @@
if(M == user)
M.visible_message("[user] attempts to [apply_method] [src].")
if(self_delay)
- if(!do_mob(user, M, self_delay))
+ if(!do_after(user, self_delay, M))
return FALSE
to_chat(M, "You [apply_method] [src].")
else
M.visible_message("[user] attempts to force [M] to [apply_method] [src].", \
"[user] attempts to force you to [apply_method] [src].")
- if(!do_mob(user, M))
+ if(!do_after(user, target = M))
return FALSE
M.visible_message("[user] forces [M] to [apply_method] [src].", \
"[user] forces you to [apply_method] [src].")
diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm
index f0901e416b25..5d11dcb720ee 100644
--- a/code/modules/reagents/reagent_containers/syringes.dm
+++ b/code/modules/reagents/reagent_containers/syringes.dm
@@ -86,7 +86,7 @@
target.visible_message("[user] is trying to take a blood sample from [target]!", \
"[user] is trying to take a blood sample from you!")
busy = TRUE
- if(!do_mob(user, target, extra_checks=CALLBACK(L, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ if(!do_after(user, target = target, extra_checks=CALLBACK(L, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
busy = FALSE
return
if(reagents.total_volume >= reagents.maximum_volume)
@@ -136,7 +136,7 @@
if(L != user)
L.visible_message("[user] is trying to inject [L]!", \
"[user] is trying to inject you!")
- if(!do_mob(user, L, extra_checks=CALLBACK(L, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
+ if(!do_after(user, target = L, extra_checks=CALLBACK(L, TYPE_PROC_REF(/mob/living, can_inject), user, TRUE)))
return
if(!reagents.total_volume)
return
diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm
index 9f2861218418..111428528242 100644
--- a/code/modules/recycling/disposal/bin.dm
+++ b/code/modules/recycling/disposal/bin.dm
@@ -131,7 +131,7 @@
user.visible_message("[user] starts climbing into [src].", "You start climbing into [src]...")
else
target.visible_message("[user] starts putting [target] into [src].", "[user] starts putting you into [src]!")
- if(do_mob(user, target, 20))
+ if(do_after(user, 2 SECONDS, target))
if (!loc)
return
target.forceMove(src)
diff --git a/code/modules/religion/rites.dm b/code/modules/religion/rites.dm
index 1c1caa5de1d6..67b337400315 100644
--- a/code/modules/religion/rites.dm
+++ b/code/modules/religion/rites.dm
@@ -18,7 +18,7 @@
return FALSE
to_chat(user, "You begin to perform the rite of [name]...")
if(!ritual_invocations)
- if(do_after(user, target = user, delay = ritual_length))
+ if(do_after(user, ritual_length))
return TRUE
return FALSE
var/first_invoke = TRUE
diff --git a/code/modules/research/xenobiology/crossbreeding/regenerative.dm b/code/modules/research/xenobiology/crossbreeding/regenerative.dm
index 7cb7f8677408..75a1201d924a 100644
--- a/code/modules/research/xenobiology/crossbreeding/regenerative.dm
+++ b/code/modules/research/xenobiology/crossbreeding/regenerative.dm
@@ -41,12 +41,12 @@ Regenerative extracts:
to_chat(user, "[src] will not work on the dead!")
return
if(H != user)
- if(!do_mob(user, H, slime_delay)) // 1 second delay
+ if(!do_after(user, slime_delay, H)) // 1 second delay
return FALSE
user.visible_message("[user] crushes the [src] over [H], the milky goo quickly regenerating some of [H.p_their()] injuries!",
"You squeeze the [src], and it bursts over [H], the milky goo regenerating some of [H.p_their()] injuries.")
else
- if(!do_mob(user, H, (slime_delay * 1.5))) // 1.5 second delay
+ if(!do_after(user, (slime_delay * 1.5), H)) // 1.5 second delay
return FALSE
user.visible_message("[user] crushes the [src] over [user.p_them()]self, the milky goo quickly regenerating some of [user.p_their()] injuries!",
"You squeeze the [src], and it bursts in your hand, splashing you with milky goo which quickly regenerates some of your injuries!")
diff --git a/code/modules/spells/spell_types/devil.dm b/code/modules/spells/spell_types/devil.dm
index 6631d943a3aa..b7da88dfe790 100644
--- a/code/modules/spells/spell_types/devil.dm
+++ b/code/modules/spells/spell_types/devil.dm
@@ -107,7 +107,7 @@
if(istype(user.loc, /obj/effect/dummy/phased_mob/slaughter/))
if(valid_location(user))
to_chat(user, "You are now phasing in.")
- if(do_mob(user,user,150))
+ if(do_after(user, 1.5 SECONDS, user))
if(valid_location(user))
user.infernalphasein()
else
@@ -121,7 +121,7 @@
user.notransform = TRUE
user.fakefire()
to_chat(src, "You begin to phase back into sinful flames.")
- if(do_mob(user,user,150))
+ if(do_after(user, 1.5 SECONDS, user))
user.infernalphaseout()
else
to_chat(user, "You must remain still while exiting.")
diff --git a/code/modules/spells/spell_types/lichdom.dm b/code/modules/spells/spell_types/lichdom.dm
index c8d1c4a7c027..720670e3fc21 100644
--- a/code/modules/spells/spell_types/lichdom.dm
+++ b/code/modules/spells/spell_types/lichdom.dm
@@ -49,7 +49,7 @@
playsound(user, 'sound/effects/pope_entry.ogg', 100)
- if(!do_after(M, 50, needhand=FALSE, target=marked_item))
+ if(!do_after(M, 50, target=marked_item, timed_action_flags = IGNORE_HELD_ITEM))
to_chat(M, "Your soul snaps back to your body as you stop ensouling [marked_item]!")
return
diff --git a/code/modules/spells/spell_types/lightning.dm b/code/modules/spells/spell_types/lightning.dm
index 3231d22170e1..85f211511135 100644
--- a/code/modules/spells/spell_types/lightning.dm
+++ b/code/modules/spells/spell_types/lightning.dm
@@ -28,7 +28,7 @@
halo = halo || mutable_appearance('icons/effects/effects.dmi', "electricity", EFFECTS_LAYER)
user.add_overlay(halo)
playsound(get_turf(user), Snd, 50, FALSE)
- if(do_mob(user,user,100,1))
+ if(do_after(user, 10 SECONDS, user, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM)))
if(ready && cast_check(skipcharge=1))
choose_targets()
else
diff --git a/code/modules/surgery/surgery_helpers.dm b/code/modules/surgery/surgery_helpers.dm
index c4a769c43ed5..c28ce0855933 100644
--- a/code/modules/surgery/surgery_helpers.dm
+++ b/code/modules/surgery/surgery_helpers.dm
@@ -85,7 +85,7 @@
/proc/attempt_cancel_surgery(datum/surgery/S, obj/item/I, mob/living/M, mob/user)
var/selected_zone = user.zone_selected
to_chat(user, "You begin to cancel \the [S].")
- if (!do_mob(user, M, 3 SECONDS))
+ if (!do_after(user, 3 SECONDS, M))
return
if(S.status == 1)
diff --git a/code/modules/vehicles/cars/car.dm b/code/modules/vehicles/cars/car.dm
index 6b53fa9a02c3..d3040f862863 100644
--- a/code/modules/vehicles/cars/car.dm
+++ b/code/modules/vehicles/cars/car.dm
@@ -80,7 +80,7 @@
if(occupant_amount() >= max_occupants)
return FALSE
var/atom/old_loc = loc
- if(do_mob(forcer, M, get_enter_delay(M), extra_checks=CALLBACK(src, TYPE_PROC_REF(/obj/vehicle/sealed/car, is_car_stationary), old_loc)))
+ if(do_after(forcer, get_enter_delay(M), M, extra_checks=CALLBACK(src, TYPE_PROC_REF(/obj/vehicle/sealed/car, is_car_stationary), old_loc)))
mob_forced_enter(M, silent)
return TRUE
return FALSE
diff --git a/code/modules/vehicles/sealed.dm b/code/modules/vehicles/sealed.dm
index 6751ddfe3580..22b1eb42becb 100644
--- a/code/modules/vehicles/sealed.dm
+++ b/code/modules/vehicles/sealed.dm
@@ -29,7 +29,7 @@
return FALSE
if(occupant_amount() >= max_occupants)
return FALSE
- if(do_after(M, get_enter_delay(M), FALSE, src, TRUE))
+ if(do_after(M, get_enter_delay(M), src, progress = TRUE, timed_action_flags = IGNORE_HELD_ITEM))
mob_enter(M)
return TRUE
return FALSE
diff --git a/shiptest.dme b/shiptest.dme
index 6574a98b5a1e..67c643cd7977 100644
--- a/shiptest.dme
+++ b/shiptest.dme
@@ -52,6 +52,7 @@
#include "code\__DEFINES\directional.dm"
#include "code\__DEFINES\diseases.dm"
#include "code\__DEFINES\DNA.dm"
+#include "code\__DEFINES\do_afters.dm"
#include "code\__DEFINES\dye_keys.dm"
#include "code\__DEFINES\economy.dm"
#include "code\__DEFINES\events.dm"
@@ -142,6 +143,7 @@
#include "code\__DEFINES\tgs.dm"
#include "code\__DEFINES\tgui.dm"
#include "code\__DEFINES\time.dm"
+#include "code\__DEFINES\timed_action.dm"
#include "code\__DEFINES\tools.dm"
#include "code\__DEFINES\traits.dm"
#include "code\__DEFINES\turfs.dm"