Axes do_mob and replaces with do_after (#18739)

* moooore do_afters

* theese

* Failsafe

* Update human_attackhand.dm
This commit is contained in:
Cameron Lennox
2025-11-07 20:01:23 -05:00
committed by GitHub
parent e889a5a9f9
commit 57d1d031da
28 changed files with 154 additions and 132 deletions
+2 -1
View File
@@ -209,7 +209,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
@@ -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)
+1 -1
View File
@@ -149,7 +149,7 @@
GLOB.global_announcer.autosay("[src] is treating <b>[H]</b> in <b>[location]</b>", "[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
+1 -1
View File
@@ -336,7 +336,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
+1 -1
View File
@@ -238,7 +238,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)
@@ -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
@@ -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
@@ -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()
@@ -66,7 +66,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
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -688,7 +688,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
+1 -1
View File
@@ -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
@@ -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)
@@ -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))
@@ -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
@@ -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
@@ -29,7 +29,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
@@ -133,24 +133,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
+11 -7
View File
@@ -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].") )
+1 -1
View File
@@ -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 stay focused on your patient!")