Implements timed_action_flags for do_after-like procs (#54409)

Originally I wanted to fix an issue where the `get_up()` `do_after()` would ignore the callback checks, because it was `uninterruptible`, so that made me refactor these procs to allow for higher granularity on checks and standardize behavior a bit more.
There's more work to be done for them, but one thing at a time.

* Removes the `uninterruptible` check in favor of the more granular `timed_action_flags`
* Cleans code on the `do_atom`, `do_after_mob`, `do_mob` and `do_after` procs to standardize them a little better.
This commit is contained in:
Rohesie
2020-10-19 18:06:49 -03:00
committed by GitHub
parent 2ae02bced0
commit 29ec525147
42 changed files with 154 additions and 129 deletions
+8
View File
@@ -518,3 +518,11 @@ GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE)))
/// Possible value of [/atom/movable/buckle_lying]. If set to a different (positive-or-zero) value than this, the buckling thing will force a lying angle on the buckled.
#define NO_BUCKLE_LYING -1
// timed_action_flags parameter for `/proc/do_atom`, `/proc/do_after_mob`, `/proc/do_mob` and `/proc/do_after`
#define IGNORE_TARGET_IN_DOAFTERS (1<<0)
#define IGNORE_USER_LOC_CHANGE (1<<1)
#define IGNORE_TARGET_LOC_CHANGE (1<<2)
#define IGNORE_HELD_ITEM (1<<3)
#define IGNORE_INCAPACITATED (1<<4)
+74 -58
View File
@@ -179,8 +179,9 @@ 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)
/proc/do_mob(mob/user, mob/target, time = 3 SECONDS, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks)
if(!user || !target)
return FALSE
var/user_loc = user.loc
@@ -203,31 +204,37 @@ GLOBAL_LIST_EMPTY(species_list)
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(!(target in user.do_afters))
. = FALSE
break
if(drifting && !user.inertia_dir)
drifting = FALSE
user_loc = user.loc
if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_held_item() != holding || user.incapacitated() || (extra_checks && !extra_checks.Invoke()))
if(
QDELETED(user) || QDELETED(target) \
|| (!(timed_action_flags & IGNORE_TARGET_IN_DOAFTERS) && !(target in user.do_afters)) \
|| (!(timed_action_flags & IGNORE_USER_LOC_CHANGE) && !drifting && user.loc != user_loc) \
|| (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && target.loc != target_loc) \
|| (!(timed_action_flags & IGNORE_HELD_ITEM) && user.get_active_held_item() != holding) \
|| (!(timed_action_flags & IGNORE_INCAPACITATED) && user.incapacitated()) \
|| (extra_checks && !extra_checks.Invoke()) \
)
. = FALSE
break
if(!QDELETED(progbar))
progbar.end_progress()
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)
@@ -242,19 +249,20 @@ 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)
/proc/do_after(mob/user, delay, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks)
if(!user)
return FALSE
var/atom/Tloc = null
var/atom/target_loc = null
if(target && !isturf(target))
Tloc = target.loc
target_loc = target.loc
if(target)
LAZYADD(user.do_afters, target)
LAZYADD(target.targeted_by, user)
var/atom/Uloc = user.loc
var/atom/user_loc = user.loc
var/drifting = FALSE
if(!user.Process_Spacemove(0) && user.inertia_dir)
@@ -262,10 +270,6 @@ 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.cached_multiplicative_actions_slowdown
var/datum/progressbar/progbar
@@ -277,42 +281,38 @@ GLOBAL_LIST_EMPTY(species_list)
. = 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()))
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) && user.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(
!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) \
&& !drifting \
&& !QDELETED(target_loc) \
&& (QDELETED(target) || target_loc != target.loc) \
&& ((user_loc != target_loc || target_loc != user)) \
)
. = FALSE
break
if(target && !(timed_action_flags & IGNORE_TARGET_IN_DOAFTERS) && !(target in user.do_afters))
. = 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()
@@ -322,7 +322,7 @@ GLOBAL_LIST_EMPTY(species_list)
///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)
/proc/do_after_mob(mob/user, list/targets, time = 3 SECONDS, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks)
if(!user)
return FALSE
if(!islist(targets))
@@ -351,25 +351,40 @@ GLOBAL_LIST_EMPTY(species_list)
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)
while(world.time < endtime)
stoplag(1)
if(!QDELETED(progbar))
progbar.update(world.time - starttime)
if(QDELETED(user) || !length(targets))
. = FALSE
break
if(drifting && !user.inertia_dir)
drifting = FALSE
user_loc = user.loc
if(
!((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) && user.incapacitated()) \
|| (extra_checks && !extra_checks.Invoke()) \
)
. = FALSE
break
for(var/t in targets)
var/atom/target = t
if(
(QDELETED(target)) \
|| (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && originalloc[target] != target.loc) \
)
. = FALSE
break
if(uninterruptible)
continue
if(drifting && !user.inertia_dir)
drifting = FALSE
user_loc = user.loc
if(!.) // In case the for-loop found a reason to break out of the while.
break
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()
@@ -379,6 +394,7 @@ GLOBAL_LIST_EMPTY(species_list)
LAZYREMOVE(user.do_afters, target)
LAZYREMOVE(target.targeted_by, user)
/proc/is_species(A, species_datum)
. = FALSE
if(ishuman(A))
+8 -5
View File
@@ -1251,7 +1251,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
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)
/proc/do_atom(atom/movable/user, atom/movable/target, time = 3 SECONDS, timed_action_flags = NONE, datum/callback/extra_checks)
if(!user || !target)
return TRUE
var/user_loc = user.loc
@@ -1270,11 +1270,10 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
. = TRUE
while (world.time < endtime)
stoplag(1)
if(QDELETED(user) || QDELETED(target))
. = 0
. = FALSE
break
if(uninterruptible)
continue
if(drifting && !user.inertia_dir)
drifting = FALSE
@@ -1284,7 +1283,11 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
target_drifting = FALSE
target_loc = target.loc
if((!drifting && user.loc != user_loc) || (!target_drifting && target.loc != target_loc) || (extra_checks && !extra_checks.Invoke()))
if(
(!(timed_action_flags & IGNORE_USER_LOC_CHANGE) && !drifting && user.loc != user_loc) \
|| (!(timed_action_flags& IGNORE_TARGET_LOC_CHANGE) && !target_drifting && target.loc != target_loc) \
|| (extra_checks && !extra_checks.Invoke()) \
)
. = FALSE
break
+2 -2
View File
@@ -215,7 +215,7 @@
return
var/datum/progressbar/progress = new(M, len, I.loc)
var/list/rejections = list()
while(do_after(M, 10, TRUE, parent, FALSE, CALLBACK(src, .proc/handle_mass_pickup, things, I.loc, rejections, progress)))
while(do_after(M, 1 SECONDS, parent, NONE, FALSE, CALLBACK(src, .proc/handle_mass_pickup, things, I.loc, rejections, progress)))
stoplag(1)
progress.end_progress()
to_chat(M, "<span class='notice'>You put everything you could [insert_preposition] [parent].</span>")
@@ -273,7 +273,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/mass_remove_from_storage, T, things, progress)))
while (do_after(M, 1 SECONDS, T, NONE, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress)))
stoplag(1)
progress.end_progress()
+1 -1
View File
@@ -96,7 +96,7 @@ This component is used in vat growing to swab for microbiological samples which
return
to_chat(user, "<span class='notice'>You start swabbing [target] for samples!</span>")
if(!do_after(user, 3 SECONDS, TRUE, target)) // Start swabbing boi
if(!do_after(user, 3 SECONDS, target)) // Start swabbing boi
return
LAZYINITLIST(swabbed_items) //If it isn't initialized, initialize it. As we need to pass it by reference
+1 -1
View File
@@ -270,7 +270,7 @@
if(usr != owner)
return
to_chat(owner, "<span class='notice'>You attempt to remove the durathread strand from around your neck.</span>")
if(do_after(owner, 35, null, owner))
if(do_after(owner, 3.5 SECONDS, owner))
if(isliving(owner))
var/mob/living/L = owner
to_chat(owner, "<span class='notice'>You succesfuly remove the durathread strand.</span>")
+1 -1
View File
@@ -871,7 +871,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, /datum/component/storage.proc/handle_mass_item_insertion, things, src_object, user, progress)))
while (do_after(user, 1 SECONDS, src, NONE, FALSE, CALLBACK(STR, /datum/component/storage.proc/handle_mass_item_insertion, things, src_object, user, progress)))
stoplag(1)
progress.end_progress()
to_chat(user, "<span class='notice'>You dump as much of [src_object.parent]'s contents [STR.insert_preposition]to [src] as you can.</span>")
+4 -4
View File
@@ -810,7 +810,7 @@
to_chat(user, "<span class='warning'>You need at least 2 metal sheets to reinforce [src].</span>")
return
to_chat(user, "<span class='notice'>You start reinforcing [src].</span>")
if(do_after(user, 20, TRUE, src))
if(do_after(user, 2 SECONDS, src))
if(!panel_open || !S.use(2))
return
user.visible_message("<span class='notice'>[user] reinforces \the [src] with metal.</span>",
@@ -824,7 +824,7 @@
to_chat(user, "<span class='warning'>You need at least 2 plasteel sheets to reinforce [src].</span>")
return
to_chat(user, "<span class='notice'>You start reinforcing [src].</span>")
if(do_after(user, 20, TRUE, src))
if(do_after(user, 2 SECONDS, src))
if(!panel_open || !S.use(2))
return
user.visible_message("<span class='notice'>[user] reinforces \the [src] with plasteel.</span>",
@@ -1076,7 +1076,7 @@
var/time_to_open = 50
playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 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))
if(check_electrified && shock(user,100))
prying_so_hard = FALSE
return
@@ -1269,7 +1269,7 @@
playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 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, "<span class='warning'>Despite your efforts, [src] managed to resist your attempts to open it!</span>")
+1 -1
View File
@@ -107,7 +107,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 class='warning'>Despite your efforts, [src] managed to resist your attempts to open it!</span>")
+1 -1
View File
@@ -249,7 +249,7 @@
M.visible_message("<span class='warning'>[user] starts buckling [M] to [src]!</span>",\
"<span class='userdanger'>[user] starts buckling you to [src]!</span>",\
"<span class='hear'>You hear metal clanking.</span>")
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?
+9 -10
View File
@@ -77,13 +77,12 @@
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "<span class='notice'>You claw at the fabric of [src], trying to tear it open...</span>")
to_chat(loc, "<span class='warning'>Someone starts trying to break free of [src]!</span>")
if(do_after_mob(user, src, 12 SECONDS, TRUE))
if(user.loc != src)
return
// you are still in the bag? time to go unless you KO'd, honey!
// if they escape during this time and you rebag them the timer is still clocking down and does NOT reset so they can very easily get out.
if(user.incapacitated())
to_chat(loc, "<span class='warning'>The pressure subsides. It seems that they've stopped resisting...</span>")
return
loc.visible_message("<span class='warning'>[user] suddenly appears in front of [loc]!</span>", "<span class='userdanger'>[user] breaks free of [src]!</span>")
qdel(src)
if(!do_mob(user, src, 12 SECONDS, timed_action_flags = (IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM)))
return
// you are still in the bag? time to go unless you KO'd, honey!
// if they escape during this time and you rebag them the timer is still clocking down and does NOT reset so they can very easily get out.
if(user.incapacitated())
to_chat(loc, "<span class='warning'>The pressure subsides. It seems that they've stopped resisting...</span>")
return
loc.visible_message("<span class='warning'>[user] suddenly appears in front of [loc]!</span>", "<span class='userdanger'>[user] breaks free of [src]!</span>")
qdel(src)
+1 -1
View File
@@ -104,7 +104,7 @@
var/new_appearance = show_radial_menu(user, src, possible_appearances, custom_check = CALLBACK(src, .proc/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, 1 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM))
return FALSE
if(!check_menu(user, crayon))
return FALSE
+4 -4
View File
@@ -498,7 +498,7 @@
"<span class='warning'>You overcharge the paddles and begin to place them onto [H]'s chest...</span>")
busy = TRUE
update_icon()
if(do_after(user, 15, TRUE, H))
if(do_after(user, 1.5 SECONDS, H))
user.visible_message("<span class='notice'>[user] places [src] on [H]'s chest.</span>",
"<span class='warning'>You place [src] on [H]'s chest and begin to charge them.</span>")
var/turf/T = get_turf(defib)
@@ -507,7 +507,7 @@
T.audible_message("<span class='warning'>\The [defib] lets out an urgent beep and lets out a steadily rising hum...</span>")
else
user.audible_message("<span class='warning'>[src] let out an urgent beep.</span>")
if(do_after(user, 15, TRUE, H)) //Takes longer due to overcharging
if(do_after(user, 1.5 SECONDS, H)) //Takes longer due to overcharging
if(!H)
busy = FALSE
update_icon()
@@ -548,11 +548,11 @@
user.visible_message("<span class='warning'>[user] begins to place [src] on [H]'s chest.</span>", "<span class='warning'>You begin to place [src] on [H]'s chest...</span>")
busy = TRUE
update_icon()
if(do_after(user, 30, TRUE, H)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
if(do_after(user, 3 SECONDS, H)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
user.visible_message("<span class='notice'>[user] places [src] on [H]'s chest.</span>", "<span class='warning'>You place [src] on [H]'s chest.</span>")
playsound(src, 'sound/machines/defib_charge.ogg', 75, FALSE)
var/obj/item/organ/heart = H.getorgan(/obj/item/organ/heart)
if(do_after(user, 20, TRUE, H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
if(do_after(user, 2 SECONDS, H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
if((!combat && !req_defib) || (req_defib && !defib.combat))
for(var/obj/item/clothing/C in H.get_equipped_items())
if((C.body_parts_covered & CHEST) && (C.clothing_flags & THICKMATERIAL)) //check to see if something is obscuring their chest.
+1 -1
View File
@@ -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))
var/answer = get_answer()
say(answer)
+1 -1
View File
@@ -165,7 +165,7 @@
/obj/item/food/monkeycube/suicide_act(mob/living/M)
M.visible_message("<span class='suicide'>[M] is putting [src] in [M.p_their()] mouth! It looks like [M.p_theyre()] trying to commit suicide!</span>")
var/eating_success = do_after(M, 10, TRUE, src, TRUE)
var/eating_success = do_after(M, 1 SECONDS, src)
if(QDELETED(M)) //qdeletion: the nuclear option of self-harm
return SHAME
if(!eating_success || QDELETED(src)) //checks if src is gone or if they failed to wait for a second
+2 -2
View File
@@ -12,7 +12,7 @@
/obj/item/book/granter/proc/turn_page(mob/user)
playsound(user, pick('sound/effects/pageturn1.ogg','sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg'), 30, TRUE)
if(do_after(user, 50, TRUE, src))
if(do_after(user, 5 SECONDS, src))
if(remarks.len)
to_chat(user, "<span class='notice'>[pick(remarks)]</span>")
else
@@ -57,7 +57,7 @@
on_reading_stopped()
reading = FALSE
return
if(do_after(user, 50, TRUE, src))
if(do_after(user, 5 SECONDS, src))
on_reading_finished(user)
reading = FALSE
return TRUE
+1 -1
View File
@@ -330,7 +330,7 @@
if(staffcooldown + staffwait > world.time)
return
user.visible_message("<span class='notice'>[user] chants deeply and waves [user.p_their()] staff!</span>")
if(do_after(user, 20,1,src))
if(do_after(user, 2 SECONDS, src))
target.add_atom_colour(conversion_color, WASHABLE_COLOUR_PRIORITY) //wololo
staffcooldown = world.time
+1 -1
View File
@@ -58,7 +58,7 @@
return
else if(istype(C) && C.has_status_effect(STATUS_EFFECT_CHOKINGSTRAND))
to_chat(C, "<span class='notice'>You attempt to remove the durathread strand from around your neck.</span>")
if(do_after(user, 15, null, C))
if(do_after(user, 1.5 SECONDS, C))
to_chat(C, "<span class='notice'>You succesfuly remove the durathread strand.</span>")
C.remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND)
else
@@ -466,7 +466,7 @@
/obj/structure/chair/plastic/proc/snap_check(mob/living/carbon/Mob)
if (Mob.nutrition >= NUTRITION_LEVEL_FAT)
to_chat(Mob, "<span class='warning'>The chair begins to pop and crack, you're too heavy!</span>")
if(do_after(Mob, 60, 1, Mob, 0))
if(do_after(Mob, 6 SECONDS, progress = FALSE))
Mob.visible_message("<span class='notice'>The plastic chair snaps under [Mob]'s weight!</span>")
new /obj/effect/decal/cleanable/plastic(loc)
qdel(src)
@@ -335,7 +335,7 @@
if((user.a_intent != INTENT_HARM) && istype(I, /obj/item/paper) && (obj_integrity < max_integrity))
user.visible_message("<span class='notice'>[user] starts to patch the holes in [src].</span>", "<span class='notice'>You start patching some of the holes in [src]!</span>")
if(do_after(user, 20, TRUE, src))
if(do_after(user, 2 SECONDS, src))
obj_integrity = min(obj_integrity+4,max_integrity)
qdel(I)
user.visible_message("<span class='notice'>[user] patches some of the holes in [src].</span>", "<span class='notice'>You patch some of the holes in [src]!</span>")
+1 -1
View File
@@ -40,7 +40,7 @@
GM.visible_message("<span class='danger'>[user] starts to give [GM] a swirlie!</span>", "<span class='userdanger'>[user] starts to give you a swirlie...</span>")
swirlie = GM
var/was_alive = (swirlie.stat != DEAD)
if(do_after(user, 30, 0, target = src))
if(do_after(user, 3 SECONDS, target = src, timed_action_flags = IGNORE_HELD_ITEM))
GM.visible_message("<span class='danger'>[user] gives [GM] a swirlie!</span>", "<span class='userdanger'>[user] gives you a swirlie!</span>", "<span class='hear'>You hear a toilet flushing.</span>")
if(iscarbon(GM))
var/mob/living/carbon/C = GM
@@ -63,11 +63,11 @@
changeling.islinking = 0
target.mind.linglink = 0
return
to_chat(user, "<span class='notice'>We must keep holding on to [target] to sustain the link. </span>")
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_mob(user, target, 10 SECONDS, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM))
changeling.islinking = 0
target.mind.linglink = 0
@@ -41,7 +41,7 @@
/obj/item/forbidden_book/proc/get_power_from_influence(atom/target, mob/user)
var/obj/effect/reality_smash/RS = target
to_chat(user, "<span class='danger'>You start drawing power from influence...</span>")
if(do_after(user,10 SECONDS,TRUE,RS))
if(do_after(user, 10 SECONDS, RS))
qdel(RS)
charge += 1
@@ -31,7 +31,7 @@
draining = TRUE
essence_drained += rand(15, 20)
to_chat(src, "<span class='revennotice'>You search for the soul of [target].</span>")
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, "<span class='revennotice'>[target.p_their(TRUE)] soul burns with intelligence.</span>")
essence_drained += rand(20, 30)
@@ -40,7 +40,7 @@
essence_drained += rand(40, 50)
else
to_chat(src, "<span class='revennotice'>[target.p_their(TRUE)] soul is weak and faltering.</span>")
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, "<span class='revennotice'>[target] will not yield much essence. Still, every bit counts.</span>")
@@ -50,7 +50,7 @@
to_chat(src, "<span class='revenboldnotice'>Such a feast! [target] will yield much essence to you.</span>")
if(90 to INFINITY)
to_chat(src, "<span class='revenbignotice'>Ah, the perfect soul. [target] will yield massive amounts of essence to you.</span>")
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, "<span class='revenwarning'>[target.p_theyre(TRUE)] now powerful enough to fight off your draining.</span>")
to_chat(target, "<span class='boldannounce'>You feel something tugging across your body before subsiding.</span>")
@@ -72,7 +72,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 existance of ghosts, ghosts cannot prove the existance of the target they were draining.
change_essence_amount(essence_drained, FALSE, target)
if(essence_drained <= 90 && target.stat != DEAD)
essence_regen_cap += 5
+1 -1
View File
@@ -112,7 +112,7 @@
to_chat(user, "<span class='warning'>You require 3 [cloth_repair.name] to repair [src].</span>")
return TRUE
to_chat(user, "<span class='notice'>You begin fixing the damage to [src] with [cloth_repair]...</span>")
if(!do_after(user, 6 SECONDS, TRUE, src) || !cloth_repair.use(3))
if(!do_after(user, 6 SECONDS, src) || !cloth_repair.use(3))
return TRUE
repair(user, params)
return TRUE
+3 -3
View File
@@ -146,7 +146,7 @@
return
user.visible_message("<span class='notice'>[user] begins [tied ? "unknotting" : "tying"] the laces of [user.p_their()] [src.name].</span>", "<span class='notice'>You begin [tied ? "unknotting" : "tying"] the laces of your [src.name]...</span>")
if(do_after(user, lace_time, needhand=TRUE, target=our_guy, extra_checks=CALLBACK(src, .proc/still_shoed, our_guy)))
if(do_after(user, lace_time, target = our_guy, extra_checks = CALLBACK(src, .proc/still_shoed, our_guy)))
to_chat(user, "<span class='notice'>You [tied ? "unknot" : "tie"] the laces of your [src.name].</span>")
if(tied == SHOES_UNTIED)
adjust_laces(SHOES_TIED, user)
@@ -170,7 +170,7 @@
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/still_shoed, our_guy)))
if(do_after(user, mod_time, target = our_guy, extra_checks = CALLBACK(src, .proc/still_shoed, our_guy)))
to_chat(user, "<span class='notice'>You [tied ? "untie" : "knot"] the laces on [loc]'s [src.name].</span>")
if(tied == SHOES_UNTIED)
adjust_laces(SHOES_KNOTTED, user)
@@ -253,6 +253,6 @@
to_chat(user, "<span class='notice'>You begin [tied ? "untying" : "tying"] the laces on [src]...</span>")
if(do_after(user, lace_time, needhand=TRUE, target=src,extra_checks=CALLBACK(src, .proc/still_shoed, user)))
if(do_after(user, lace_time, target = src,extra_checks = CALLBACK(src, .proc/still_shoed, user)))
to_chat(user, "<span class='notice'>You [tied ? "untie" : "tie"] the laces on [src].</span>")
adjust_laces(tied ? SHOES_TIED : SHOES_UNTIED, user)
+1 -1
View File
@@ -164,7 +164,7 @@
if(L.status)
to_chat(user, "<span class='warning'>This bulb is too damaged to use as a replacement!</span>")
return
if(do_after(user, 50, 1, src))
if(do_after(user, 5 SECONDS, src))
qdel(I)
helmet = new helmettype(src)
to_chat(user, "<span class='notice'>You have successfully repaired [src]'s helmet.</span>")
+1 -1
View File
@@ -45,7 +45,7 @@
/obj/item/seeds/kudzu/attack_self(mob/user)
user.visible_message("<span class='danger'>[user] begins throwing seeds on the ground...</span>")
if(do_after(user, 50, needhand = TRUE, target = user.drop_location(), progress = TRUE))
if(do_after(user, 5 SECONDS, target = user.drop_location(), progress = TRUE))
plant(user)
to_chat(user, "<span class='notice'>You plant the kudzu. You monster.</span>")
+1 -1
View File
@@ -124,7 +124,7 @@
return
user.visible_message("<span class='notice'>[user] starts to pour the contents of [O] onto [src].</span>", "<span class='notice'>You start to slowly pour the contents of [O] onto [src].</span>")
if(!do_after(user, 60, TRUE, src))
if(!do_after(user, 6 SECONDS, src))
to_chat(user, "<span class='warning'>You failed to pour [O] onto [src]!</span>")
return
+3 -3
View File
@@ -275,7 +275,7 @@
buckle_cd = O.breakouttime
visible_message("<span class='warning'>[src] attempts to unbuckle [p_them()]self!</span>", \
"<span class='notice'>You attempt to unbuckle yourself... (This will take around [round(buckle_cd/600,1)] minute\s, and you need to stay still.)</span>")
if(do_after(src, buckle_cd, 0, target = src))
if(do_after(src, buckle_cd, target = src, timed_action_flags = IGNORE_HELD_ITEM))
if(!buckled)
return
buckled.user_unbuckle_mob(src,src)
@@ -326,7 +326,7 @@
if(!cuff_break)
visible_message("<span class='warning'>[src] attempts to remove [I]!</span>")
to_chat(src, "<span class='notice'>You attempt to remove [I]... (This will take around [DisplayTimeText(breakouttime)] and you need to stand still.)</span>")
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, "<span class='warning'>You fail to remove [I]!</span>")
@@ -335,7 +335,7 @@
breakouttime = 50
visible_message("<span class='warning'>[src] is trying to break [I]!</span>")
to_chat(src, "<span class='notice'>You attempt to break [I]... (This will take around 5 seconds and you need to stand still.)</span>")
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, "<span class='warning'>You fail to break [I]!</span>")
@@ -1097,7 +1097,7 @@
//Joe Medic starts quickly/expertly lifting Grey Tider onto their back..
"<span class='notice'>[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.." : "..."]</span>")
//(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)
if(target.loc != loc)
@@ -641,7 +641,7 @@
if(src == M)
if(has_status_effect(STATUS_EFFECT_CHOKINGSTRAND))
to_chat(src, "<span class='notice'>You attempt to remove the durathread strand from around your neck.</span>")
if(do_after(src, 35, null, src))
if(do_after(src, 3.5 SECONDS, src))
to_chat(src, "<span class='notice'>You succesfuly remove the durathread strand.</span>")
remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND)
return
@@ -1293,7 +1293,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
user.visible_message("<span class='warning'>[user] starts stealing [target]'s [I.name]!</span>",
"<span class='danger'>You start stealing [target]'s [I.name]...</span>", null, null, target)
to_chat(target, "<span class='userdanger'>[user] starts stealing your [I.name]!</span>")
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("<span class='warning'>[user] stole [target]'s [I.name]!</span>",
@@ -170,7 +170,7 @@
var/static/mutable_appearance/overcharge //shameless copycode from lightning spell
overcharge = overcharge || mutable_appearance('icons/effects/effects.dmi', "electricity", EFFECTS_LAYER)
H.add_overlay(overcharge)
if(do_mob(H, H, 50, 1))
if(do_after(H, 5 SECONDS, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM|IGNORE_INCAPACITATED)))
H.flash_lighting_fx(5, 7, current_color)
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
playsound(H, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
@@ -186,7 +186,7 @@
to_chat(H, "<span class='userdanger'>You're pretty sure you just felt your heart stop for a second there..</span>")
H.playsound_local(H, 'sound/effects/singlebeat.ogg', 100, 0)
H.Paralyze(100)
return
/datum/species/ethereal/proc/get_charge(mob/living/carbon/H) //this feels like it should be somewhere else. Eh?
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
@@ -204,7 +204,7 @@
H.notransform = TRUE
if(do_after(owner, delay=60, needhand=FALSE, target=owner, progress=TRUE))
if(do_after(owner, delay = 6 SECONDS, target = owner, timed_action_flags = IGNORE_HELD_ITEM))
if(H.blood_volume >= BLOOD_VOLUME_SLIME_SPLIT)
make_dupe()
else
+1 -2
View File
@@ -474,8 +474,7 @@
/mob/living/proc/get_up(instant = FALSE)
set waitfor = FALSE
var/static/datum/callback/rest_checks = CALLBACK(src, .proc/rest_checks_callback)
if(!instant && !do_mob(src, src, 1 SECONDS, uninterruptible = TRUE, extra_checks = rest_checks))
if(!instant && !do_mob(src, src, 1 SECONDS, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM), extra_checks = CALLBACK(src, /mob/living/proc/rest_checks_callback)))
return
if(resting || body_position == STANDING_UP || HAS_TRAIT(src, TRAIT_FLOORED))
return
@@ -50,7 +50,7 @@
user.do_attack_animation(src)
if (user.name == master)
visible_message("<span class='notice'>Responding to its master's touch, [src] disengages its holochassis emitter, rapidly losing coherence.</span>")
if(do_after(user, 1 SECONDS, TRUE, src))
if(do_after(user, 1 SECONDS, src))
fold_in()
if(user.put_in_hands(card))
user.visible_message("<span class='notice'>[user] promptly scoops up [user.p_their()] pAI's card.</span>")
+1 -1
View File
@@ -141,7 +141,7 @@
if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED))
to_chat(current_user, "<span class='warning'>Targeting transit location, please wait [DisplayTimeText(designate_time)]...</span>")
designating_target_loc = the_eye.loc
var/wait_completed = do_after(current_user, designate_time, FALSE, designating_target_loc, TRUE, CALLBACK(src, /obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget))
var/wait_completed = do_after(current_user, designate_time, designating_target_loc, timed_action_flags = IGNORE_HELD_ITEM, extra_checks = CALLBACK(src, /obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget))
designating_target_loc = null
if(!current_user)
return
+1 -1
View File
@@ -46,7 +46,7 @@
playsound(user, 'sound/effects/pope_entry.ogg', 100)
if(!do_after(M, 50, needhand=FALSE, target=marked_item))
if(!do_after(M, 5 SECONDS, target = marked_item, timed_action_flags = IGNORE_HELD_ITEM))
to_chat(M, "<span class='warning'>Your soul snaps back to your body as you stop ensouling [marked_item]!</span>")
return
+1 -1
View File
@@ -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, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM)))
if(ready && cast_check(skipcharge=1))
choose_targets()
else
+1 -1
View File
@@ -40,7 +40,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, timed_action_flags = IGNORE_HELD_ITEM))
mob_enter(M)
return TRUE
return FALSE
+1 -1
View File
@@ -47,7 +47,7 @@
if(istype(W, /obj/item/reagent_containers/food/snacks/grown/banana))
// ignore the occupants because they're presumably too distracted to notice the guy stuffing fruit into their vehicle's exhaust. do segways have exhausts? they do now!
user.visible_message("<span class='warning'>[user] begins stuffing [W] into [src]'s tailpipe.</span>", "<span class='warning'>You begin stuffing [W] into [src]'s tailpipe...</span>", ignored_mobs = occupants)
if(do_after(user, 30, TRUE, src))
if(do_after(user, 3 SECONDS, src))
if(user.transferItemToLoc(W, src))
user.visible_message("<span class='warning'>[user] stuffs [W] into [src]'s tailpipe.</span>", "<span class='warning'>You stuff [W] into [src]'s tailpipe.</span>", ignored_mobs = occupants)
eddie_murphy = W