diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 2c906a34868..e81e0f55156 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -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) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 45c78354a1e..a6d7a7a149c 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -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)) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 6ca5b8cdfa2..67fcd30614a 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -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 diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index d911ca9cdca..8e619488834 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -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, "You put everything you could [insert_preposition] [parent].") @@ -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() diff --git a/code/datums/components/swabbing.dm b/code/datums/components/swabbing.dm index de897a10c65..fbf8cf16071 100644 --- a/code/datums/components/swabbing.dm +++ b/code/datums/components/swabbing.dm @@ -96,7 +96,7 @@ This component is used in vat growing to swab for microbiological samples which return to_chat(user, "You start swabbing [target] for samples!") - 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 diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 9db0d3ea8fb..cbf7f369160 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -270,7 +270,7 @@ if(usr != owner) return to_chat(owner, "You attempt to remove the durathread strand from around your neck.") - 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, "You succesfuly remove the durathread strand.") diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 010336b68ab..aa2fdfe08c1 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -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, "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 c9e636772f5..f652b38e279 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -810,7 +810,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, 2 SECONDS, src)) if(!panel_open || !S.use(2)) return user.visible_message("[user] reinforces \the [src] with metal.", @@ -824,7 +824,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, 2 SECONDS, src)) if(!panel_open || !S.use(2)) return user.visible_message("[user] reinforces \the [src] with plasteel.", @@ -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, "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 6a3228fa3a4..0aa381c1993 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -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, "Despite your efforts, [src] managed to resist your attempts to open it!") diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 22be6d5e52b..0abc1c3ffac 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -249,7 +249,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/bodybag.dm b/code/game/objects/items/bodybag.dm index 6df651a7467..8f5b5e33435 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -77,13 +77,12 @@ user.last_special = world.time + CLICK_CD_BREAKOUT to_chat(user, "You claw at the fabric of [src], trying to tear it open...") to_chat(loc, "Someone starts trying to break free of [src]!") - 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, "The pressure subsides. It seems that they've stopped resisting...") - return - loc.visible_message("[user] suddenly appears in front of [loc]!", "[user] breaks free of [src]!") - 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, "The pressure subsides. It seems that they've stopped resisting...") + return + loc.visible_message("[user] suddenly appears in front of [loc]!", "[user] breaks free of [src]!") + qdel(src) diff --git a/code/game/objects/items/cardboard_cutouts.dm b/code/game/objects/items/cardboard_cutouts.dm index 37a9b4e314a..966d8c0c6a4 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/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 diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index fc22820c354..36c2fce3940 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -498,7 +498,7 @@ "You overcharge the paddles and begin to place them onto [H]'s chest...") busy = TRUE update_icon() - if(do_after(user, 15, TRUE, H)) + if(do_after(user, 1.5 SECONDS, H)) user.visible_message("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest and begin to charge them.") var/turf/T = get_turf(defib) @@ -507,7 +507,7 @@ T.audible_message("\The [defib] lets out an urgent beep and lets out a steadily rising hum...") else user.audible_message("[src] let out an urgent beep.") - 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("[user] begins to place [src] on [H]'s chest.", "You begin to place [src] on [H]'s chest...") 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("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest.") 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. diff --git a/code/game/objects/items/eightball.dm b/code/game/objects/items/eightball.dm index b880dddb0de..fa0061492a9 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)) var/answer = get_answer() say(answer) diff --git a/code/game/objects/items/food/meat.dm b/code/game/objects/items/food/meat.dm index ebb29752554..edf43e7f06a 100644 --- a/code/game/objects/items/food/meat.dm +++ b/code/game/objects/items/food/meat.dm @@ -165,7 +165,7 @@ /obj/item/food/monkeycube/suicide_act(mob/living/M) M.visible_message("[M] is putting [src] in [M.p_their()] mouth! It looks like [M.p_theyre()] trying to commit suicide!") - 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 diff --git a/code/game/objects/items/granters.dm b/code/game/objects/items/granters.dm index 367fa191d29..f638ea4ffb8 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -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, "[pick(remarks)]") 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 diff --git a/code/game/objects/items/religion.dm b/code/game/objects/items/religion.dm index bcaff0e45c2..603fb3f0697 100644 --- a/code/game/objects/items/religion.dm +++ b/code/game/objects/items/religion.dm @@ -330,7 +330,7 @@ if(staffcooldown + staffwait > world.time) return user.visible_message("[user] chants deeply and waves [user.p_their()] staff!") - 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 diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index 7abfdfc3b1c..4439b359241 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -58,7 +58,7 @@ return else if(istype(C) && C.has_status_effect(STATUS_EFFECT_CHOKINGSTRAND)) to_chat(C, "You attempt to remove the durathread strand from around your neck.") - if(do_after(user, 15, null, C)) + if(do_after(user, 1.5 SECONDS, C)) to_chat(C, "You succesfuly remove the durathread strand.") C.remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) else diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 827a1d2901c..fddb5d5ebd6 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -466,7 +466,7 @@ /obj/structure/chair/plastic/proc/snap_check(mob/living/carbon/Mob) if (Mob.nutrition >= NUTRITION_LEVEL_FAT) to_chat(Mob, "The chair begins to pop and crack, you're too heavy!") - if(do_after(Mob, 60, 1, Mob, 0)) + if(do_after(Mob, 6 SECONDS, progress = FALSE)) Mob.visible_message("The plastic chair snaps under [Mob]'s weight!") new /obj/effect/decal/cleanable/plastic(loc) qdel(src) diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 4d629b85d5e..c9c6dccc3df 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -335,7 +335,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, 2 SECONDS, 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/watercloset.dm b/code/game/objects/structures/watercloset.dm index 066f12e3bb6..c6947926ecc 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, 3 SECONDS, 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/changeling/powers/linglink.dm b/code/modules/antagonists/changeling/powers/linglink.dm index 36204649af6..47113429ba8 100644 --- a/code/modules/antagonists/changeling/powers/linglink.dm +++ b/code/modules/antagonists/changeling/powers/linglink.dm @@ -63,11 +63,11 @@ changeling.islinking = 0 target.mind.linglink = 0 return - + 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_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 diff --git a/code/modules/antagonists/eldritch_cult/eldritch_book.dm b/code/modules/antagonists/eldritch_cult/eldritch_book.dm index 890520876e7..c14d28b5136 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_book.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_book.dm @@ -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, "You start drawing power from influence...") - if(do_after(user,10 SECONDS,TRUE,RS)) + if(do_after(user, 10 SECONDS, RS)) qdel(RS) charge += 1 diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index 727029f3633..0c86660c4b2 100644 --- a/code/modules/antagonists/revenant/revenant_abilities.dm +++ b/code/modules/antagonists/revenant/revenant_abilities.dm @@ -31,7 +31,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) @@ -40,7 +40,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.") @@ -50,7 +50,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.") @@ -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 diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 1c9f9a0e911..318c9ac00c5 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -112,7 +112,7 @@ to_chat(user, "You require 3 [cloth_repair.name] to repair [src].") return TRUE to_chat(user, "You begin fixing the damage to [src] with [cloth_repair]...") - 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 diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index afc738d4ac3..18a89225e82 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -146,7 +146,7 @@ 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/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, "You [tied ? "unknot" : "tie"] the laces of your [src.name].") 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, "You [tied ? "untie" : "knot"] the laces on [loc]'s [src.name].") if(tied == SHOES_UNTIED) adjust_laces(SHOES_KNOTTED, user) @@ -253,6 +253,6 @@ 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/still_shoed, user))) + if(do_after(user, lace_time, target = src,extra_checks = CALLBACK(src, .proc/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/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index b1a3781e339..dccf8594138 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -164,7 +164,7 @@ if(L.status) to_chat(user, "This bulb is too damaged to use as a replacement!") return - if(do_after(user, 50, 1, src)) + if(do_after(user, 5 SECONDS, src)) qdel(I) helmet = new helmettype(src) to_chat(user, "You have successfully repaired [src]'s helmet.") diff --git a/code/modules/hydroponics/grown/kudzu.dm b/code/modules/hydroponics/grown/kudzu.dm index 7764be7ecb7..41b33b7254c 100644 --- a/code/modules/hydroponics/grown/kudzu.dm +++ b/code/modules/hydroponics/grown/kudzu.dm @@ -45,7 +45,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, 5 SECONDS, target = user.drop_location(), progress = TRUE)) plant(user) to_chat(user, "You plant the kudzu. You monster.") diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index fa0f7a65550..592ba96ee67 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -124,7 +124,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, 6 SECONDS, src)) to_chat(user, "You failed to pour [O] onto [src]!") return diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f7e7326289d..718c220e462 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -275,7 +275,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)) + 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("[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]!") @@ -335,7 +335,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 53ebaa95b42..45aa50f3143 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1097,7 +1097,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) if(target.loc != loc) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index e67e6f6cfc0..4c515471830 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -641,7 +641,7 @@ if(src == M) if(has_status_effect(STATUS_EFFECT_CHOKINGSTRAND)) to_chat(src, "You attempt to remove the durathread strand from around your neck.") - if(do_after(src, 35, null, src)) + if(do_after(src, 3.5 SECONDS, src)) to_chat(src, "You succesfuly remove the durathread strand.") remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index d941e06a3c9..6124df37e87 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1293,7 +1293,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 11a778cb39d..bfc82d47f6b 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -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, "You're pretty sure you just felt your heart stop for a second there..") 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) 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 cef78557624..eed6b58e844 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -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 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 061b7f75b84..3dff8414468 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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 diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm index 49ec8aa2531..c01426ddc73 100644 --- a/code/modules/mob/living/silicon/pai/pai_defense.dm +++ b/code/modules/mob/living/silicon/pai/pai_defense.dm @@ -50,7 +50,7 @@ user.do_attack_animation(src) if (user.name == master) visible_message("Responding to its master's touch, [src] disengages its holochassis emitter, rapidly losing coherence.") - 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("[user] promptly scoops up [user.p_their()] pAI's card.") diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index 1b886de02a2..d818e982854 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -141,7 +141,7 @@ if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED)) to_chat(current_user, "Targeting transit location, please wait [DisplayTimeText(designate_time)]...") 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 diff --git a/code/modules/spells/spell_types/lichdom.dm b/code/modules/spells/spell_types/lichdom.dm index ea3a3f5a0ba..9b0ede9e446 100644 --- a/code/modules/spells/spell_types/lichdom.dm +++ b/code/modules/spells/spell_types/lichdom.dm @@ -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, "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 3231d22170e..968008ed790 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, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM))) if(ready && cast_check(skipcharge=1)) choose_targets() else diff --git a/code/modules/vehicles/sealed.dm b/code/modules/vehicles/sealed.dm index 666a9da8fd4..d0b2ca300b3 100644 --- a/code/modules/vehicles/sealed.dm +++ b/code/modules/vehicles/sealed.dm @@ -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 diff --git a/code/modules/vehicles/secway.dm b/code/modules/vehicles/secway.dm index 3bf42c25988..15853c49c7f 100644 --- a/code/modules/vehicles/secway.dm +++ b/code/modules/vehicles/secway.dm @@ -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("[user] begins stuffing [W] into [src]'s tailpipe.", "You begin stuffing [W] into [src]'s tailpipe...", 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("[user] stuffs [W] into [src]'s tailpipe.", "You stuff [W] into [src]'s tailpipe.", ignored_mobs = occupants) eddie_murphy = W