diff --git a/code/_helpers/legacy.dm b/code/_helpers/legacy.dm
new file mode 100644
index 0000000000..071cecbd9d
--- /dev/null
+++ b/code/_helpers/legacy.dm
@@ -0,0 +1,72 @@
+/*
+ * ## DO NOT BRING THIS BACK OR I WILL SMITE YOU
+ * This is the precursor to 'do_after'. It was very buggy, allowed spam, and very restrictive at the same time.
+ * Pretty much the worst of all worlds.
+ * It's been replaced entirely with do_after, now and is just being kept here as a showcase of the old code.
+ * The only thing it had different was a target_zone, which is now incorporated into do_after
+ *
+/proc/do_mob(mob/user , mob/target, time = 30, target_zone = 0, uninterruptible = FALSE, progress = TRUE, ignore_movement = FALSE, exclusive = FALSE)
+ if(!user || !target)
+ return FALSE
+ if(!time)
+ return TRUE //Done!
+ if(user.status_flags & DOING_TASK)
+ to_chat(user, span_warning("You're in the middle of doing something else already."))
+ return FALSE //Performing an exclusive do_after or do_mob already
+ if(target?.flags & IS_BUSY)
+ to_chat(user, span_warning("Someone is already doing something with \the [target]."))
+ return FALSE
+ var/user_loc = user.loc
+ var/target_loc = target.loc
+
+ var/holding = user.get_active_hand()
+ var/datum/progressbar/progbar
+ if (progress)
+ progbar = new(user, time, target)
+
+ var/endtime = world.time+time
+ var/starttime = world.time
+
+ if(exclusive & TASK_USER_EXCLUSIVE)
+ user.status_flags |= DOING_TASK
+ if(target && exclusive & TASK_TARGET_EXCLUSIVE)
+ target.flags |= IS_BUSY
+
+ . = TRUE
+ while (world.time < endtime)
+ stoplag(1)
+ if (progress)
+ progbar.update(world.time - starttime)
+ if(!user || !target)
+ . = FALSE
+ break
+ if(uninterruptible)
+ continue
+
+ if(!user || user.incapacitated())
+ . = FALSE
+ break
+
+ if(user.loc != user_loc && !ignore_movement)
+ . = FALSE
+ break
+
+ if(target.loc != target_loc && !ignore_movement)
+ . = FALSE
+ break
+
+ if(user.get_active_hand() != holding)
+ . = FALSE
+ break
+
+ if(target_zone && user.zone_sel?.selecting != target_zone)
+ . = FALSE
+ break
+
+ if(exclusive & TASK_USER_EXCLUSIVE)
+ user.status_flags &= ~DOING_TASK
+ if(exclusive & TASK_TARGET_EXCLUSIVE)
+ target?.status_flags &= ~IS_BUSY
+
+ if (progbar)
+ qdel(progbar)
diff --git a/code/_helpers/mobs.dm b/code/_helpers/mobs.dm
index 2f4263d520..01dcff61d8 100644
--- a/code/_helpers/mobs.dm
+++ b/code/_helpers/mobs.dm
@@ -182,72 +182,6 @@ Proc for attack log creation, because really why not
else
return pick(BP_TORSO, BP_GROIN)
-/proc/do_mob(mob/user , mob/target, time = 30, target_zone = 0, uninterruptible = FALSE, progress = TRUE, ignore_movement = FALSE, exclusive = FALSE)
- if(!user || !target)
- return FALSE
- if(!time)
- return TRUE //Done!
- if(user.status_flags & DOING_TASK)
- to_chat(user, span_warning("You're in the middle of doing something else already."))
- return FALSE //Performing an exclusive do_after or do_mob already
- if(target?.flags & IS_BUSY)
- to_chat(user, span_warning("Someone is already doing something with \the [target]."))
- return FALSE
- var/user_loc = user.loc
- var/target_loc = target.loc
-
- var/holding = user.get_active_hand()
- var/datum/progressbar/progbar
- if (progress)
- progbar = new(user, time, target)
-
- var/endtime = world.time+time
- var/starttime = world.time
-
- if(exclusive & TASK_USER_EXCLUSIVE)
- user.status_flags |= DOING_TASK
- if(target && exclusive & TASK_TARGET_EXCLUSIVE)
- target.flags |= IS_BUSY
-
- . = TRUE
- while (world.time < endtime)
- stoplag(1)
- if (progress)
- progbar.update(world.time - starttime)
- if(!user || !target)
- . = FALSE
- break
- if(uninterruptible)
- continue
-
- if(!user || user.incapacitated())
- . = FALSE
- break
-
- if(user.loc != user_loc && !ignore_movement)
- . = FALSE
- break
-
- if(target.loc != target_loc && !ignore_movement)
- . = FALSE
- break
-
- if(user.get_active_hand() != holding)
- . = FALSE
- break
-
- if(target_zone && user.zone_sel?.selecting != target_zone)
- . = FALSE
- break
-
- if(exclusive & TASK_USER_EXCLUSIVE)
- user.status_flags &= ~DOING_TASK
- if(exclusive & TASK_TARGET_EXCLUSIVE)
- target?.status_flags &= ~IS_BUSY
-
- if (progbar)
- qdel(progbar)
-
/**
* Timed action involving one mob user. Target is optional.
*
@@ -275,13 +209,20 @@ Proc for attack log creation, because really why not
* @param {icon} icon - The icon file of the cog. Default: 'icons/effects/progressbar.dmi'
*
* @param {iconstate} iconstate - The icon state of the cog. Default: "Cog"
+ *
+ * @param {string} target_zone - The target zone of the user. See _defines/mobs.dm. If the user swaps from this zone, we break the do_after
+ *
+ * @param {number} max_distance - The maximum distance we can be away from the target before the do_after breaks. Default to 1.
*/
-/proc/do_after(mob/user, delay, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1, hidden = FALSE, icon = 'icons/effects/progressbar.dmi', iconstate = "cog", max_distance = null)
+/proc/do_after(mob/user, delay, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1, hidden = FALSE, icon = 'icons/effects/progressbar.dmi', iconstate = "cog", target_zone, max_distance = null)
if(!user)
return FALSE
if(!isnum(delay))
CRASH("do_after was passed a non-number delay: [delay || "null"].")
+ if(!isatom(target))
+ CRASH("do_after was given a non-atom target! [target]")
+
if(!interaction_key && target)
interaction_key = target //Use the direct ref to the target
if(interaction_key) //Do we have a interaction_key now?
@@ -336,6 +277,7 @@ Proc for attack log creation, because really why not
|| (!(timed_action_flags & IGNORE_HELD_ITEM) && user.get_active_hand() != holding) \
|| (!(timed_action_flags & IGNORE_INCAPACITATED) && HAS_TRAIT(user, TRAIT_INCAPACITATED)) \
|| (max_distance && target && get_dist(user, target) > max_distance) \
+ || (target_zone && user.zone_sel?.selecting != target_zone) \
|| (extra_checks && !extra_checks.Invoke()))
. = FALSE
break
diff --git a/code/datums/components/antags/changeling/powers/absorb.dm b/code/datums/components/antags/changeling/powers/absorb.dm
index 451c5a889b..91f6286922 100644
--- a/code/datums/components/antags/changeling/powers/absorb.dm
+++ b/code/datums/components/antags/changeling/powers/absorb.dm
@@ -61,7 +61,7 @@
T.UpdateDamageIcon()
feedback_add_details("changeling_powers","A[stage]")
- if(!do_mob(src, T, 150) || G.state != GRAB_KILL)
+ if(!do_after(src, 15 SECONDS, T) || G.state != GRAB_KILL)
to_chat(src, span_warning("Our absorption of [T] has been interrupted!"))
changeling.isabsorbing = FALSE
return
diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm
index 11f02ec593..fbadb98b84 100644
--- a/code/game/machinery/oxygen_pump.dm
+++ b/code/game/machinery/oxygen_pump.dm
@@ -44,15 +44,15 @@
return ..()
if(CanMouseDrop(target, user))
- if(!can_apply_to_target(target, usr)) // There is no point in attempting to apply a mask if it's impossible.
+ if(!can_apply_to_target(target, user)) // There is no point in attempting to apply a mask if it's impossible.
return
- usr.visible_message("\The [usr] begins placing \the [contained] onto [target].")
- if(!do_mob(usr, target, 25) || !can_apply_to_target(target, usr))
+ user.visible_message("\The [user] begins placing \the [contained] onto [target].")
+ if(!do_after(user, 2.5 SECONDS, target) || !can_apply_to_target(target, user))
return
// place mask and add fingerprints
- usr.visible_message("\The [usr] has placed \the [contained] on [target]'s mouth.")
+ user.visible_message("\The [user] has placed \the [contained] on [target]'s mouth.")
attach_mask(target)
- src.add_fingerprint(usr)
+ src.add_fingerprint(user)
/obj/machinery/oxygen_pump/attack_hand(mob/user as mob)
if((stat & MAINT) && tank)
diff --git a/code/game/objects/items/leash.dm b/code/game/objects/items/leash.dm
index f0e4a09e95..fceabd4088 100644
--- a/code/game/objects/items/leash.dm
+++ b/code/game/objects/items/leash.dm
@@ -76,7 +76,7 @@
C.visible_message(span_danger("\The [user] is attempting to put the leash on \the [C]!"), span_danger("\The [user] tries to put a leash on you"))
add_attack_logs(user,C,"Leashed (attempt)")
- if(!do_mob(user, C, leashtime)) //do_mob adds a progress bar, but then we also check to see if they have a collar
+ if(!do_after(user, leashtime, C)) //do_mob adds a progress bar, but then we also check to see if they have a collar
return
if(tgui_alert(C, "Would you like to be leased by [user]? You can OOC escape to escape", "Become Leashed",list("No","Yes")) != "Yes")
return
@@ -190,7 +190,7 @@
leash_pet.visible_message(span_danger("\The [leash_pet] is attempting to unhook [leash_pet.p_their()] leash!"), span_danger("You attempt to unhook your leash"))
add_attack_logs(leash_master,leash_pet,"Self-unleash (attempt)")
- if(!do_mob(leash_pet, leash_pet, 35))
+ if(!do_after(leash_pet, 3.5 SECONDS, leash_pet))
return
to_chat(leash_pet, span_userdanger("You have been released!"))
@@ -200,7 +200,7 @@
leash_pet.visible_message(span_danger("\The [leash_master] is attempting to remove the leash on \the [leash_pet]!"), span_danger("\The [leash_master] tries to remove leash from you"))
add_attack_logs(leash_master,leash_pet,"Unleashed (attempt)")
- if(!do_mob(leash_master, leash_pet, 5))
+ if(!do_after(leash_master, 0.5 SECONDS, leash_pet))
return
to_chat(leash_pet, span_userdanger("You have been released!"))
diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm
index 0b13e86362..26e0c5b788 100644
--- a/code/game/objects/items/stacks/medical.dm
+++ b/code/game/objects/items/stacks/medical.dm
@@ -117,7 +117,7 @@
continue
if(used == amount)
break
- if(!do_mob(user, M, W.damage/3, exclusive = TRUE))
+ if(!do_after(user, W.damage/3, affecting))
balloon_alert(user, "stand still to bandage wounds.")
break
@@ -186,7 +186,7 @@
continue
if(used == amount)
break
- if(!do_mob(user, M, W.damage/5, exclusive = TRUE))
+ if(!do_after(user, W.damage/5, affecting))
balloon_alert(user, "stand still to bandage wounds.")
break
@@ -251,7 +251,7 @@
else
user.balloon_alert_visible("\the [user] starts salving wounds on [M]'s [affecting.name].", \
"salving the wounds on [M]'s [affecting.name]." )
- if(!do_mob(user, M, 10, exclusive = TRUE))
+ if(!do_after(user, 1 SECOND, affecting))
balloon_alert(user, "stand still to salve wounds.")
return 1
if(affecting.is_salved()) // We do a second check after the delay, in case it was bandaged after the first check.
@@ -305,7 +305,7 @@
continue
//if(used == amount)
// break
- if(!do_mob(user, M, W.damage/5, exclusive = TRUE))
+ if(!do_after(user, W.damage/5, affecting))
balloon_alert(user, "stand still to bandage wounds.")
break
if(affecting.is_bandaged() && affecting.is_disinfected()) // We do a second check after the delay, in case it was bandaged after the first check.
@@ -365,7 +365,7 @@
else
user.balloon_alert_visible("\the [user] starts salving wounds on [M]'s [affecting.name].", \
"salving the wounds on [M]'s [affecting.name]." )
- if(!do_mob(user, M, 10, exclusive = TRUE))
+ if(!do_after(user, 1 SECOND, affecting))
balloon_alert(user, "stand still to salve wounds.")
return 1
if(affecting.is_salved()) // We do a second check after the delay, in case it was bandaged after the first check.
@@ -413,7 +413,7 @@
balloon_alert(user, "you can't apply a splint to the arm you're using!")
return
user.balloon_alert_visible("[user] starts to apply \the [src] to their [limb].", "applying \the [src] to your [limb].", "You hear something being wrapped.")
- if(do_after(user, 5 SECONDS, target = M))
+ if(do_after(user, 5 SECONDS, affecting))
if(affecting.splinted)
balloon_alert(user, "[M]'s [limb] is already splinted!")
return
diff --git a/code/game/objects/items/weapons/material/kitchen.dm b/code/game/objects/items/weapons/material/kitchen.dm
index c35b1ceb31..90121422f8 100644
--- a/code/game/objects/items/weapons/material/kitchen.dm
+++ b/code/game/objects/items/weapons/material/kitchen.dm
@@ -111,7 +111,7 @@
M.visible_message(span_bold("\The [user]") + " eats some of [loaded] with \the [src].")
else
user.visible_message(span_warning("\The [user] begins to feed \the [M]!"))
- if(!(M.can_force_feed(user, loaded) && do_mob(user, M, 5 SECONDS)))
+ if(!(M.can_force_feed(user, loaded) && do_after(user, 5 SECONDS, M)))
return
M.visible_message(span_bold("\The [user]") + " feeds some of [loaded] to \the [M] with \the [src].")
playsound(src,'sound/items/eatfood.ogg', rand(10,40), 1)
diff --git a/code/game/objects/structures/medical_stand_vr.dm b/code/game/objects/structures/medical_stand_vr.dm
index 1e56650c7d..0f12674003 100644
--- a/code/game/objects/structures/medical_stand_vr.dm
+++ b/code/game/objects/structures/medical_stand_vr.dm
@@ -118,7 +118,7 @@
return
if (breather)
src.add_fingerprint(usr)
- if(!do_mob(usr, target, 30) || !can_apply_to_target(target, usr))
+ if(!do_after(usr, 3 SECONDS, target) || !can_apply_to_target(target, usr))
return
if(tank)
tank.forceMove(src)
@@ -134,7 +134,7 @@
return
usr.visible_message(span_infoplain(span_bold("\The [usr]") + " begins carefully placing the mask onto [target]."),
span_notice("You begin carefully placing the mask onto [target]."))
- if(!do_mob(usr, target, 100) || !can_apply_to_target(target, usr))
+ if(!do_after(usr, 10 SECONDS, target) || !can_apply_to_target(target, usr))
return
// place mask and add fingerprints
usr.visible_message(span_notice("\The [usr] has placed \the mask on [target]'s mouth."),
@@ -146,14 +146,14 @@
return
if("Drip needle")
if(attached)
- if(!do_mob(usr, target, 20))
+ if(!do_after(usr, 2 SECONDS, target))
return
visible_message("\The [attached] is taken off \the [src]")
attached = null
else if(ishuman(target))
usr.visible_message(span_infoplain(span_bold("\The [usr]") + " begins inserting needle into [target]'s vein."),
span_notice("You begin inserting needle into [target]'s vein."))
- if(!do_mob(usr, target, 50))
+ if(!do_after(usr, 5 SECONDS, target))
usr.visible_message(span_notice("\The [usr]'s hand slips and pricks \the [target]."),
span_notice("Your hand slips and pricks \the [target]."))
target.apply_damage(3, BRUTE, pick(BP_R_ARM, BP_L_ARM))
diff --git a/code/modules/food/food/snacks.dm b/code/modules/food/food/snacks.dm
index 42b5e01c1b..e4873356ea 100644
--- a/code/modules/food/food/snacks.dm
+++ b/code/modules/food/food/snacks.dm
@@ -234,7 +234,8 @@
feed_duration = 5 SECONDS
user.setClickCooldown(user.get_attack_speed(src))
- if(!do_mob(user, human_eater, feed_duration)) return
+ if(!do_after(user, feed_duration, human_eater)) return
+ if(!reagents || (reagents && !reagents.total_volume)) return
if(swallow_whole && !belly_target) return // Just in case we lost belly mid-feed
@@ -290,7 +291,7 @@
user.balloon_alert_visible("attempts to make [eater] consume [src] whole into their [belly_target].")// CHOMPEdit
var/feed_duration = 3 SECONDS
user.setClickCooldown(user.get_attack_speed(src))
- if(!do_mob(user, eater, feed_duration))
+ if(!do_after(user, feed_duration, eater))
return
if(!belly_target)
return
diff --git a/code/modules/food/kitchen/cooking_machines/fryer.dm b/code/modules/food/kitchen/cooking_machines/fryer.dm
index 0797e1ad4e..0682468818 100644
--- a/code/modules/food/kitchen/cooking_machines/fryer.dm
+++ b/code/modules/food/kitchen/cooking_machines/fryer.dm
@@ -188,7 +188,7 @@
fry_loop.start(src)
- if(!do_mob(user, victim, 20))
+ if(!do_after(user, 2 SECONDS, victim))
cooking = FALSE
icon_state = off_icon
fry_loop.stop(src)
diff --git a/code/modules/mob/living/bot/medbot.dm b/code/modules/mob/living/bot/medbot.dm
index 0e84a317d9..981943de6b 100644
--- a/code/modules/mob/living/bot/medbot.dm
+++ b/code/modules/mob/living/bot/medbot.dm
@@ -150,7 +150,7 @@
GLOB.global_announcer.autosay("[src] is treating [H] in [location]", "[src]", "Medical")
busy = 1
update_icons()
- if(do_mob(src, H, 30))
+ if(do_after(src, 3 SECONDS, H))
if(t == 1)
reagent_glass.reagents.trans_to_mob(H, injection_amount, CHEM_BLOOD)
else
diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm
index 1aedf0afe2..e8900f442b 100644
--- a/code/modules/mob/living/bot/secbot.dm
+++ b/code/modules/mob/living/bot/secbot.dm
@@ -337,7 +337,7 @@
playsound(src, 'sound/weapons/handcuffs.ogg', 30, 1, -2)
visible_message(span_warning("\The [src] is trying to put handcuffs on \the [H]!"))
busy = TRUE
- if(do_mob(src, H, 60))
+ if(do_after(src, 6 SECONDS, H))
if(!H.handcuffed)
if(istype(H.back, /obj/item/rig) && istype(H.gloves,/obj/item/clothing/gloves/gauntlets/rig))
H.handcuffed = new /obj/item/handcuffs/cable(H) // Better to be cable cuffed than stun-locked
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 7a545950aa..5c362e4e1d 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -239,7 +239,7 @@
else
M.visible_message(span_warning("[M] tries to pat out [src]'s flames!"),
span_warning("You try to pat out [src]'s flames! Hot!"))
- if(do_mob(M, src, 15))
+ if(do_after(M, 1.5 SECONDS, src))
src.adjust_fire_stacks(-0.5)
if (prob(10) && (M.fire_stacks <= 0))
M.adjust_fire_stacks(1)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index a28dfdcd69..3807039d2f 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -1220,7 +1220,7 @@
return
to_chat(usr, span_filter_notice("You must[self ? "" : " both"] remain still until counting is finished."))
- if(do_mob(usr, src, 60))
+ if(do_after(usr, 6 SECONDS, src))
var/message = span_notice("[self ? "Your" : "[src]'s"] pulse is [src.get_pulse(GETPULSE_HAND)].")
to_chat(usr,message)
else
diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm
index a27d4f02a7..cabe7b22a9 100644
--- a/code/modules/mob/living/carbon/human/human_attackhand.dm
+++ b/code/modules/mob/living/carbon/human/human_attackhand.dm
@@ -508,7 +508,10 @@
organ.applied_pressure = user
//apply pressure as long as they stay still and keep grabbing
- do_mob(user, src, INFINITY, target_zone, progress = 0)
+ //This USED to have a 'target_zone' check that never actually worked so whatever.
+ //Let it be said that it's a feature you can apply pressure to all sites on you all at once.
+ //You're already locking yourself down when you do so.
+ do_after(user, INFINITY, organ, hidden = TRUE)
organ.applied_pressure = null
diff --git a/code/modules/mob/living/carbon/human/species/station/station_special_abilities.dm b/code/modules/mob/living/carbon/human/species/station/station_special_abilities.dm
index e9d4f24335..6f176ebf62 100644
--- a/code/modules/mob/living/carbon/human/species/station/station_special_abilities.dm
+++ b/code/modules/mob/living/carbon/human/species/station/station_special_abilities.dm
@@ -199,15 +199,15 @@
T.nutrition = 0 //Completely drained of everything.
var/damage_to_be_applied = T.species.total_health //Get their max health.
T.apply_damage(damage_to_be_applied, HALLOSS) //Knock em out.
- C.absorbing_prey = 0
+ C.absorbing_prey = FALSE
to_chat(C, span_notice("You have completely drained [T], causing them to pass out."))
to_chat(T, span_danger("You feel weak, as if you have no control over your body whatsoever as [C] finishes draining you.!"))
add_attack_logs(C,T,"Succubus drained")
return
- if(!do_mob(src, T, 50) || G.state != GRAB_NECK) //One drain tick every 5 seconds.
+ if(!do_after(src, 5 SECONDS, T) || G.state != GRAB_NECK) //One drain tick every 5 seconds.
to_chat(src, span_warning("Your draining of [T] has been interrupted!"))
- C.absorbing_prey = 0
+ C.absorbing_prey = FALSE
return
/mob/living/carbon/human/proc/succubus_drain_lethal()
@@ -294,16 +294,16 @@
if(soulgem?.flag_check(SOULGEM_ACTIVE | SOULGEM_CATCHING_DRAIN, TRUE))
soulgem.catch_mob(T)
T.apply_damage(500, OXY) //Kill them.
- absorbing_prey = 0
+ absorbing_prey = FALSE
to_chat(src, span_notice("You have completely drained [T], killing them in the process."))
to_chat(T, span_danger(span_massive("You... Feel... So... Weak...")))
visible_message(span_danger("[src] seems to finish whatever they were doing to [T]."))
add_attack_logs(src,T,"Succubus drained (lethal)")
return
- if(!do_mob(src, T, 50) || G.state != GRAB_NECK) //One drain tick every 5 seconds.
+ if(!do_after(src, 5 SECONDS, T) || G.state != GRAB_NECK) //One drain tick every 5 seconds.
to_chat(src, span_warning("Your draining of [T] has been interrupted!"))
- absorbing_prey = 0
+ absorbing_prey = FALSE
return
/mob/living/carbon/human/proc/slime_feed()
@@ -355,16 +355,16 @@
if(100)
T.nutrition = (T.nutrition + C.nutrition)
C.nutrition = 0 //Completely drained of everything.
- C.absorbing_prey = 0
+ C.absorbing_prey = FALSE
to_chat(C, span_danger("You have completely fed [T] every part of your body!"))
to_chat(T, span_notice("You feel quite strong and well fed, as [C] finishes feeding \himself to you!"))
add_attack_logs(C,T,"Slime fed")
C.feed_grabbed_to_self_falling_nom(T,C) //Reused this proc instead of making a new one to cut down on code usage.
return
- if(!do_mob(src, T, 50) || !G.state) //One drain tick every 5 seconds.
+ if(!do_after(src, 5 SECONDS, T) || !G.state) //One drain tick every 5 seconds.
to_chat(src, span_warning("Your feeding of [T] has been interrupted!"))
- C.absorbing_prey = 0
+ C.absorbing_prey = FALSE
return
/mob/living/carbon/human/proc/succubus_drain_finalize()
diff --git a/code/modules/mob/living/carbon/lick_wounds.dm b/code/modules/mob/living/carbon/lick_wounds.dm
index 7cd81968f6..8e2bd250d9 100644
--- a/code/modules/mob/living/carbon/lick_wounds.dm
+++ b/code/modules/mob/living/carbon/lick_wounds.dm
@@ -70,7 +70,7 @@
if(W.bandaged && W.salved && W.disinfected)
continue
- if(!do_mob(src, M, W.damage/5))
+ if(!do_after(src, W.damage/5, W))
to_chat(src, span_notice("You must stand still to clean wounds."))
break
diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
index c6682c40bb..57b58fa0be 100644
--- a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm
@@ -108,7 +108,7 @@
// Get our AI to stay still.
set_AI_busy(TRUE)
- if(!do_mob(src, AM, 5 SECONDS))
+ if(!do_after(src,5 SECONDS, AM))
set_AI_busy(FALSE)
to_chat(src, span_warning("You need to stay still to spin a web around \the [AM]."))
return FALSE
@@ -174,7 +174,7 @@
// Get our AI to stay still.
set_AI_busy(TRUE)
- if(!do_mob(src, T, 5 SECONDS))
+ if(!do_after(src, 5 SECONDS, T))
set_AI_busy(FALSE)
to_chat(src, span_warning("You need to stay still to spin a web on \the [T]."))
return FALSE
@@ -208,7 +208,7 @@
// Stop players from spamming eggs.
laying_eggs = TRUE
- if(!do_mob(src, T, 5 SECONDS))
+ if(!do_after(src, 5 SECONDS, T))
set_AI_busy(FALSE)
to_chat(src, span_warning("You need to stay still to lay eggs on \the [T]."))
return FALSE
diff --git a/code/modules/mob/mob_grab_specials.dm b/code/modules/mob/mob_grab_specials.dm
index 47d08e79c6..6523559a6b 100644
--- a/code/modules/mob/mob_grab_specials.dm
+++ b/code/modules/mob/mob_grab_specials.dm
@@ -7,7 +7,7 @@
return
user.visible_message(span_notice("[user] starts inspecting [affecting]'s [E.name] carefully."))
- if(!do_mob(user,H, 10))
+ if(!do_after(user, 1 SECOND, H))
to_chat(user, span_notice("You must stand still to inspect [E] for wounds."))
else if(E.wounds.len)
to_chat(user, span_warning("You find [E.get_wounds_desc()]"))
@@ -15,7 +15,7 @@
to_chat(user, span_notice("You find no visible wounds."))
to_chat(user, span_notice("Checking bones now..."))
- if(!do_mob(user, H, 20))
+ if(!do_after(user, 2 SECONDS, H))
to_chat(user, span_notice("You must stand still to feel [E] for fractures."))
else if(E.status & ORGAN_BROKEN)
to_chat(user, span_warning("The [E.encased ? E.encased : "bone in the [E.name]"] moves slightly when you poke it!"))
@@ -24,7 +24,7 @@
to_chat(user, span_notice("The [E.encased ? E.encased : "bones in the [E.name]"] seem to be fine."))
to_chat(user, span_notice("Checking skin now..."))
- if(!do_mob(user, H, 10))
+ if(!do_after(user, 1 SECOND, H))
to_chat(user, span_notice("You must stand still to check [H]'s skin for abnormalities."))
else
var/bad = 0
diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm
index 86b018fba8..2c171b71fb 100644
--- a/code/modules/nifsoft/nif.dm
+++ b/code/modules/nifsoft/nif.dm
@@ -698,7 +698,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
U.visible_message(span_notice("[U] begins installing [src] into [T]'s chest by just stuffing it in."),
span_notice("You begin installing [src] into [T]'s chest by just stuffing it in."),
"There's a wet SQUISH noise.")
- if(do_mob(user = user, target = T, time = 200, target_zone = BP_TORSO))
+ if(do_after(user, 20 SECONDS, T, target_zone = BP_TORSO))
user.unEquip(src)
forceMove(eo)
eo.implants |= src
diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm
index 18303f9abc..4960052470 100644
--- a/code/modules/organs/organ_external.dm
+++ b/code/modules/organs/organ_external.dm
@@ -529,7 +529,7 @@
return 0
user.setClickCooldown(user.get_attack_speed(tool))
- if(!do_mob(user, owner, 10))
+ if(!do_after(user, 1 SECOND, src))
to_chat(user, span_warning("You must stand still to do that."))
return 0
diff --git a/code/modules/reagents/reagent_containers/_reagent_containers.dm b/code/modules/reagents/reagent_containers/_reagent_containers.dm
index eaea357c9d..5abedaac8a 100644
--- a/code/modules/reagents/reagent_containers/_reagent_containers.dm
+++ b/code/modules/reagents/reagent_containers/_reagent_containers.dm
@@ -127,7 +127,7 @@
else
other_feed_message_start(user, target)
- if(!do_mob(user, target))
+ if(!do_after(user, 3 SECONDS, target))
return FALSE
other_feed_message_finish(user, target)
diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm
index 506dec3660..10c5066771 100644
--- a/code/modules/reagents/reagent_containers/dropper.dm
+++ b/code/modules/reagents/reagent_containers/dropper.dm
@@ -43,7 +43,7 @@
var/time = 20 //2/3rds the time of a syringe
user.visible_message(span_warning("[user] is trying to squirt something into [target]'s eyes!"))
- if(!do_mob(user, target, time))
+ if(!do_after(user, time, target))
return
if(ishuman(target))
diff --git a/code/modules/reagents/reagent_containers/patch.dm b/code/modules/reagents/reagent_containers/patch.dm
index 09ef619e82..408027761e 100644
--- a/code/modules/reagents/reagent_containers/patch.dm
+++ b/code/modules/reagents/reagent_containers/patch.dm
@@ -61,7 +61,7 @@
user.visible_message(span_warning("[user] attempts to place \the [src] onto [H]`s [affecting]."))
user.setClickCooldown(user.get_attack_speed(src))
- if(!do_mob(user, M))
+ if(!do_after(user, 3 SECONDS, M))
return
user.drop_from_inventory(src) //icon update
diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm
index 60a5f7538b..899e699bc7 100644
--- a/code/modules/reagents/reagent_containers/pill.dm
+++ b/code/modules/reagents/reagent_containers/pill.dm
@@ -59,7 +59,7 @@
user.balloon_alert_visible("[user] attempts to force [M] to swallow \the [src].")
user.setClickCooldown(user.get_attack_speed(src))
- if(!do_mob(user, M))
+ if(!do_after(user, 3 SECONDS, M))
return
user.drop_from_inventory(src) //icon update
diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm
index e1de9e4fdf..544e6db62d 100644
--- a/code/modules/reagents/reagent_containers/syringes.dm
+++ b/code/modules/reagents/reagent_containers/syringes.dm
@@ -30,7 +30,7 @@
var/image/filling //holds a reference to the current filling overlay
var/visible_name = "a syringe"
var/time = 30
- var/drawing = 0
+ var/drawing = FALSE
var/used = FALSE
var/dirtiness = 0
var/list/targets
@@ -134,24 +134,24 @@
return
var/datum/reagent/B
- drawing = 1
+ drawing = TRUE
if(ishuman(T))
var/mob/living/carbon/human/H = T
if(H.species && !H.should_have_organ(O_HEART))
H.reagents.trans_to_obj(src, amount)
else
if(ismob(H) && H != user)
- if(!do_mob(user, target, time))
- drawing = 0
+ if(!do_after(user, time, target))
+ drawing = FALSE
return
B = T.take_blood(src, amount)
- drawing = 0
+ drawing = FALSE
else
- if(!do_mob(user, target, time))
- drawing = 0
+ if(!do_after(user, time, target))
+ drawing = FALSE
return
B = T.take_blood(src,amount)
- drawing = 0
+ drawing = FALSE
if (B)
reagents.reagent_list += B
diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm
index 149a9a10a8..05e85d6cff 100644
--- a/code/modules/surgery/implant.dm
+++ b/code/modules/surgery/implant.dm
@@ -216,8 +216,10 @@
/datum/surgery_step/cavity/implant_removal/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
-
- if (affected.implants.len)
+ var/range = 1
+ if(tool)
+ range = tool.reach
+ if(affected.implants.len)
var/obj/item/obj = tgui_input_list(user, "Which embedded item do you wish to remove?", "Surgery Select", affected.implants)
if(isnull(obj)) //They clicked cancel.
@@ -225,7 +227,7 @@
span_notice("You take \the [tool] out of the incision on [target]'s [affected.name].") )
user.balloon_alert_visible("Takes \the [tool] out of [target]'s [affected.name]", "\the [tool] taken out of the incison on \the [affected.name]")
return
- if(!do_mob(user, target, 1)) //They moved away
+ if(!do_after(user, 1, target, max_distance = range, hidden = TRUE))
to_chat(user, span_warning("You must remain close to and keep focused on your patient to conduct surgery."))
user.visible_message(span_notice("[user] fails to remove anything from [target]'s [affected.name] with \the [tool]!"), \
span_notice("You fail to remove the [obj] from [target]'s [affected.name]s with \the [tool]!") )
@@ -234,11 +236,11 @@
if(istype(obj,/obj/item/implant))
var/obj/item/implant/imp = obj
- if (!imp.islegal()) //ILLEGAL IMPLANT ALERT!!!!!!!!!!
+ if(!imp.islegal()) //ILLEGAL IMPLANT ALERT!!!!!!!!!!
user.visible_message(span_notice("[user] seems to be intently working on something within [target]'s [affected.name] with \the [tool]!"), \
span_notice("You intently begin to take [obj] out of the incision on [target]'s [affected.name]s with \the [tool]!") )
user.balloon_alert_visible("intently works on something within [target]'s [affected.name]", "intently taking \the [obj] out of the incision in \the [affected.name]")
- if(!do_after(user, min_duration, target))
+ if(!do_after(user, min_duration, target, max_distance = range))
user.visible_message(span_notice("[user] fails to remove anything from [target]'s [affected.name] with \the [tool]!"), \
span_notice("You fail to remove the [obj] from [target]'s [affected.name]s with \the [tool]!") )
user.balloon_alert_visible("fails to remove anything from [target]'s [affected.name]", "failed to remove \the [obj] from \the [affected.name]")
@@ -268,8 +270,10 @@
if(istype(obj,/obj/item/implant))
var/obj/item/implant/imp = obj
imp.imp_in = null
- imp.implanted = 0
- else if(istype(tool,/obj/item/nif)){var/obj/item/nif/N = tool;N.unimplant(target)} //VOREStation Add - NIF support
+ imp.implanted = FALSE
+ else if(istype(tool,/obj/item/nif))
+ var/obj/item/nif/N = tool
+ N.unimplant(target)
else
user.visible_message(span_notice("[user] could not find anything inside [target]'s [affected.name], and pulls \the [tool] out."), \
span_notice("You could not find anything inside [target]'s [affected.name].") )
diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm
index fe8a4d4adb..113644d137 100644
--- a/code/modules/surgery/surgery.dm
+++ b/code/modules/surgery/surgery.dm
@@ -215,7 +215,7 @@
// Not staying still fails you too.
if(success)
var/calc_duration = rand(selected_surgery.min_duration, selected_surgery.max_duration)
- if(!do_mob(user, M, calc_duration * toolspeed, zone, exclusive = TRUE))
+ if(!do_after(user, calc_duration * toolspeed, M, target_zone = zone, max_distance = reach))
success = FALSE
to_chat(user, span_warning("You must remain close to and keep focused on your patient to conduct surgery."))
user.balloon_alert(user, "you must remain close to and keep focused on your patent to conduct surgery") // CHOMPEdit
diff --git a/modular_chomp/code/modules/mob/living/simple_mob/subtypes/animal/tyr/ants.dm b/modular_chomp/code/modules/mob/living/simple_mob/subtypes/animal/tyr/ants.dm
index 10a3a8e6e1..ee984345db 100644
--- a/modular_chomp/code/modules/mob/living/simple_mob/subtypes/animal/tyr/ants.dm
+++ b/modular_chomp/code/modules/mob/living/simple_mob/subtypes/animal/tyr/ants.dm
@@ -223,7 +223,7 @@
// Get our AI to stay still.
set_AI_busy(TRUE)
- if(!do_mob(src, T, 5 SECONDS))
+ if(!do_after(src, 5 SECONDS, T))
set_AI_busy(FALSE)
to_chat(src, span_warning("You need to stay still to spin a web on \the [T]."))
return FALSE
@@ -269,7 +269,7 @@
// Get our AI to stay still.
set_AI_busy(TRUE)
- if(!do_mob(src, T, 5 SECONDS))
+ if(!do_after(src, 5 SECONDS, T))
set_AI_busy(FALSE)
to_chat(src, span_warning("You need to stay still to spin a web on \the [T]."))
return FALSE