diff --git a/code/__DEFINES/_flags/do_after.dm b/code/__DEFINES/_flags/do_after.dm index 26802736cf..1661d60271 100644 --- a/code/__DEFINES/_flags/do_after.dm +++ b/code/__DEFINES/_flags/do_after.dm @@ -1,32 +1,11 @@ -/// Requires absolute stillness from the user -#define DO_AFTER_DISALLOW_MOVING_ABSOLUTE_USER (1<<0) -/// Requires absolute stillness from the target -#define DO_AFTER_DISALLOW_MOVING_ABSOLUTE_TARGET (1<<1) -/// Requires that the user is on a turf. -#define DO_AFTER_REQUIRES_USER_ON_TURF (1<<2) -/// Requires relative stillness to our target via dx and dy coordinate difference but only if both are spacedrifting. Specify DO_AFTER_ALLOW_NONSPACEDRIFT_RELATIVITY to say otherwise. -#define DO_AFTER_DISALLOW_MOVING_RELATIVE (1<<3) -/// Breaks if active hand item changes. Requires a tool be specified, otherwise defaults to active item -#define DO_AFTER_DISALLOW_ACTIVE_ITEM_CHANGE (1<<4) -/// Breaks if the user has no free hands. If a tool is specified, allows that as well. -#define DO_AFTER_REQUIRE_FREE_HAND_OR_TOOL (1<<5) -/// Do not display progressbar. -#define DO_AFTER_NO_PROGRESSBAR (1<<6) -/// Do not check do_after_coefficient() -#define DO_AFTER_NO_COEFFICIENT (1<<7) -/// For relative stillness, allow non spacedrift relative movement -#define DO_AFTER_ALLOW_NONSPACEDRIFT_RELATIVITY (1<<8) - -/// Ignores checks. -#define DO_AFTER_PROCEED "PROCEED" -/// Uses all other checks -#define DO_AFTER_CONTINUE "CONTINUE" -/// Breaks -#define DO_AFTER_STOP "STOP" - -/// Stage - initiating a do_after -#define DO_AFTER_STARTING 1 -/// Stage - main loop of a do_after -#define DO_AFTER_PROGRESSING 2 -/// Stage - Last check of a do_after -#define DO_AFTER_FINISHING 3 +// timed_action_flags parameter for `/proc/do_after` +/// Can do the action even if target is not added to doafters +#define IGNORE_TARGET_IN_DOAFTERS (1<<0) +/// Can do the action even if mob moves location +#define IGNORE_USER_LOC_CHANGE (1<<1) +/// Can do the action even if the target moves location +#define IGNORE_TARGET_LOC_CHANGE (1<<2) +/// Can do the action even if the item is no longer being held +#define IGNORE_HELD_ITEM (1<<3) +/// Can do the action even if the mob is incapacitated (ex. handcuffed) +#define IGNORE_INCAPACITATED (1<<4) diff --git a/code/__HELPERS/do_after.dm b/code/__HELPERS/do_after.dm index 5b17ed687c..9f98b0e10e 100644 --- a/code/__HELPERS/do_after.dm +++ b/code/__HELPERS/do_after.dm @@ -1,168 +1,6 @@ -/** - * Higher overhead "advanced" version of do_after. - * @params - * - atom/user is the atom doing the action or the "physical" user - * - delay is time in deciseconds - * - atom/target is the atom the action is being done to, defaults to user - * - do_after_flags see __DEFINES/flags/do_after.dm for details. - * - datum/callback/extra_checks - Every time this ticks, extra_checks() is invoked with (user, delay, target, time_left, do_after_flags, required_mobility_flags, required_combat_flags, mob_redirect, stage, initially_held_item, tool, passed_in). - * Stage can be DO_AFTER_STARTING, DO_AFTER_PROGRESSING, DO_AFTER_FINISHING - * If it returns DO_AFTER_STOP, this breaks. - * If it returns nothing, all other checks are done. - * If it returns DO_AFTER_PROCEED, all other checks are ignored. - * passed_in is a list[PROGRESS_MULTIPLIER], for modification. - * - required_mobility_flags is checked with CHECK_ALL_MOBILITY. Will immediately fail if the user isn't a mob. - * - requried_combat_flags is checked with CHECK_MULTIPLE_BITFIELDS. Will immediately fail if the user isn't a mob. - * - mob/living/mob_redirect - advanced option: If this is specified, movement and mobility/combat flag checks will use this instead of user. Progressbars will also go to this. - * - obj/item/tool - The tool we're using. See do_after flags for details. - */ -#define INVOKE_CALLBACK cb_return = extra_checks?.Invoke(user, delay, target, timeleft, do_after_flags, required_mobility_flags, required_combat_flags, mob_redirect, stage, initially_held_item, tool, passed_in) -#define CHECK_FLAG_FAILURE ((required_mobility_flags || required_combat_flags) && (!living_user || (required_mobility_flags && !CHECK_ALL_MOBILITY(living_user, required_mobility_flags)) || (required_combat_flags && !CHECK_MULTIPLE_BITFIELDS(living_user.combat_flags, required_combat_flags)))) -#define TIMELEFT (timeleft) -/proc/do_after_advanced(atom/user, delay, atom/target, do_after_flags, datum/callback/extra_checks, required_mobility_flags, required_combat_flags, mob/living/mob_redirect, obj/item/tool) - // CHECK AND SET VARIABLES - if(!user) - return FALSE - if(!target) - target = user - if((user.loc == null) || (target.loc == null)) - return FALSE - var/mob/living/living_user = mob_redirect - if(!living_user && isliving(user)) - living_user = user - var/stage = DO_AFTER_STARTING - var/startlocuser = user.loc - var/startloctarget = target.loc - var/turf/userturf = get_turf(user) - var/turf/targetturf = get_turf(target) - if(!userturf || !targetturf) - return FALSE - if((do_after_flags & DO_AFTER_REQUIRES_USER_ON_TURF) && !isturf(user.loc)) - return FALSE - if(!(do_after_flags & DO_AFTER_NO_COEFFICIENT) && living_user) - delay *= living_user.cached_multiplicative_actions_slowdown - var/timeleft = delay - var/obj/item/initially_held_item = mob_redirect?.get_active_held_item() - var/atom/movable/AM_user = ismovable(user) && user - var/drifting = AM_user?.Process_Spacemove(NONE) && AM_user.inertia_dir - var/initial_dx = targetturf.x - userturf.x - var/initial_dy = targetturf.y - userturf.y - var/dx = initial_dx - var/dy = initial_dy - // DO OUR STARTING CHECKS - var/cb_return - var/list/passed_in = list(1) - INVOKE_CALLBACK - if(cb_return == DO_AFTER_STOP) - return FALSE - else if(cb_return != DO_AFTER_PROCEED) - if(CHECK_FLAG_FAILURE) - return FALSE - // SETUP LOOP - var/datum/progressbar/progbar - if(living_user) - if(!(do_after_flags & DO_AFTER_NO_PROGRESSBAR)) - progbar = new(living_user, delay, target) - // MAIN LOOP - . = TRUE - if(!delay) - return - var/obj/item/held - var/locchanged - var/ctu - var/ctt - var/tick_time = world.time - while(timeleft > 0) - stoplag(1) - var/timepassed = world.time - tick_time - tick_time = world.time - progbar?.update(TIMELEFT) - if(QDELETED(user) || QDELETED(target) || (user.loc == null) || (target.loc == null)) - . = FALSE - break - INVOKE_CALLBACK - timeleft -= timepassed * passed_in[1] - if(cb_return == DO_AFTER_STOP) - . = FALSE - break - else if(cb_return == DO_AFTER_PROCEED) - continue - // otherwise, go through our normal checks. - if(((do_after_flags & DO_AFTER_DISALLOW_MOVING_ABSOLUTE_USER) && (user.loc != startlocuser)) || ((do_after_flags & DO_AFTER_DISALLOW_MOVING_ABSOLUTE_TARGET) && (target.loc != startloctarget))) - . = FALSE - break - else if(do_after_flags & DO_AFTER_DISALLOW_MOVING_RELATIVE) - ctu = get_turf(user) - ctt = get_turf(target) - locchanged = (userturf != ctu) || (targetturf != ctt) - userturf = ctu - targetturf = ctt - dx = targetturf.x - userturf.x - dy = targetturf.y - userturf.y - if((dx != initial_dx) || (dy != initial_dy)) - . = FALSE - break - if(locchanged && !drifting && !(do_after_flags & DO_AFTER_ALLOW_NONSPACEDRIFT_RELATIVITY)) - . = FALSE - break - if(!AM_user.inertia_dir) - drifting = FALSE - if((do_after_flags & DO_AFTER_REQUIRES_USER_ON_TURF) && !isturf(user.loc)) - return FALSE - if(CHECK_FLAG_FAILURE) - . = FALSE - break - held = living_user?.get_active_held_item() - if((do_after_flags & DO_AFTER_DISALLOW_ACTIVE_ITEM_CHANGE) && (held != (tool || initially_held_item))) - . = FALSE - break - if((do_after_flags & DO_AFTER_REQUIRE_FREE_HAND_OR_TOOL) && (!living_user?.is_holding(tool) && !length(living_user?.get_empty_held_indexes()))) - . = FALSE - break - - // CLEANUP - progbar.end_progress() - // If we failed, just return. - if(!.) - return FALSE - // DO FINISHING CHECKS - if(QDELETED(user) || QDELETED(target)) - return FALSE - INVOKE_CALLBACK - if(cb_return == DO_AFTER_STOP) - return FALSE - else if(cb_return == DO_AFTER_PROCEED) - return TRUE - if(CHECK_FLAG_FAILURE) - return FALSE - if(((do_after_flags & DO_AFTER_DISALLOW_MOVING_ABSOLUTE_USER) && (user.loc != startlocuser)) || ((do_after_flags & DO_AFTER_DISALLOW_MOVING_ABSOLUTE_TARGET) && (target.loc != startloctarget))) - return FALSE - else if(do_after_flags & DO_AFTER_DISALLOW_MOVING_RELATIVE) - ctu = get_turf(user) - ctt = get_turf(target) - locchanged = (userturf != ctu) || (targetturf != ctt) - userturf = ctu - targetturf = ctt - dx = targetturf.x - userturf.x - dy = targetturf.y - userturf.y - if((dx != initial_dx) || (dy != initial_dy)) - return FALSE - if(locchanged && !drifting && !(do_after_flags & DO_AFTER_ALLOW_NONSPACEDRIFT_RELATIVITY)) - return FALSE - if((do_after_flags & DO_AFTER_REQUIRES_USER_ON_TURF) && !isturf(user.loc)) - return FALSE - held = living_user?.get_active_held_item() - if((do_after_flags & DO_AFTER_DISALLOW_ACTIVE_ITEM_CHANGE) && (held != (tool || initially_held_item))) - return FALSE - if((do_after_flags & DO_AFTER_REQUIRE_FREE_HAND_OR_TOOL) && (!living_user?.is_holding(tool) && !length(living_user?.get_empty_held_indexes()))) - return FALSE - -#undef INVOKE_CALLBACK -#undef CHECK_FLAG_FAILURE - -/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null, ignorehelditem = FALSE, resume_time = 0 SECONDS) +/proc/do_mob(mob/user, mob/target, time = 3 SECONDS, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, resume_time = 0 SECONDS) if(!user || !target) - return 0 + return FALSE var/user_loc = user.loc var/drifting = 0 @@ -181,30 +19,26 @@ var/endtime = world.time+time var/starttime = world.time - . = 1 + . = TRUE while (world.time + resume_time < endtime) stoplag(1) if (progress) progbar.update(world.time - starttime + resume_time) - if(QDELETED(user) || QDELETED(target)) - . = 0 - break - if(uninterruptible) - continue - if(!(target in user.do_afters)) - . = FALSE - break - - if(!(target in user.do_afters)) - . = FALSE - break if(drifting && !user.inertia_dir) - drifting = 0 + drifting = FALSE user_loc = user.loc - if((!drifting && user.loc != user_loc) || target.loc != target_loc || (!ignorehelditem && user.get_active_held_item() != holding) || user.incapacitated() || user.lying || (extra_checks && !extra_checks.Invoke())) - . = 0 + 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)) @@ -228,29 +62,25 @@ checked_health["health"] = health return ..() -/proc/do_after(mob/user, var/delay, needhand = 1, atom/target = null, progress = 1, datum/callback/extra_checks = null, required_mobility_flags = (MOBILITY_USE|MOBILITY_MOVE), resume_time = 0 SECONDS) +/proc/do_after(mob/user, delay, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, resume_time = 0 SECONDS) if(!user) - return 0 - var/atom/Tloc = null + return FALSE + 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 = 0 + var/drifting = FALSE if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 + drifting = TRUE var/holding = user.get_active_held_item() - var/holdingnull = 1 //User's hand started out empty, check for an empty hand - if(holding) - holdingnull = 0 //Users hand started holding something, check to see if it's still holding that - delay *= user.cached_multiplicative_actions_slowdown var/datum/progressbar/progbar @@ -259,44 +89,39 @@ var/endtime = world.time + delay var/starttime = world.time - . = 1 - var/mob/living/L = isliving(user) && user //evals to last thing eval'd + . = TRUE while (world.time + resume_time < endtime) stoplag(1) if (progress) progbar.update(world.time - starttime + resume_time) if(drifting && !user.inertia_dir) - drifting = 0 - Uloc = user.loc + drifting = FALSE + user_loc = user.loc - if(L && !CHECK_ALL_MOBILITY(L, required_mobility_flags)) - . = 0 - break - - if(QDELETED(user) || user.stat || (!drifting && user.loc != Uloc) || (extra_checks && !extra_checks.Invoke())) - . = 0 - break - - if(!QDELETED(Tloc) && (QDELETED(target) || Tloc != target.loc)) - if((Uloc != Tloc || Tloc != user) && !drifting) - . = 0 - break - - if(target && !(target in user.do_afters)) + 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(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) - . = 0 - break - if(user.get_active_held_item() != holding) - . = 0 - break + 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(!QDELETED(progbar)) progbar.end_progress() @@ -308,16 +133,16 @@ LAZYREMOVE(user.do_afters, target) LAZYREMOVE(target.targeted_by, user) -/proc/do_after_mob(mob/user, var/list/targets, time = 30, uninterruptible = 0, progress = 1, 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 || !targets) - return 0 + return FALSE if(!islist(targets)) targets = list(targets) var/user_loc = user.loc - var/drifting = 0 + var/drifting = FALSE if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 + drifting = TRUE var/list/originalloc = list() for(var/atom/target in targets) @@ -335,25 +160,39 @@ var/endtime = world.time + time var/starttime = world.time . = 1 - mainloop: - while(world.time < endtime) - stoplag(1) - if(progress) - progbar.update(world.time - starttime) - if(QDELETED(user) || !targets) - . = 0 + 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 = 0 - user_loc = user.loc - - for(var/atom/target in targets) - if((!drifting && user_loc != user.loc) || QDELETED(target) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying || (extra_checks && !extra_checks.Invoke())) - . = 0 - break mainloop + if(!.) // In case the for-loop found a reason to break out of the while. + break if(!QDELETED(progbar)) progbar.end_progress() diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 73b2dd3006..980b377356 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1340,7 +1340,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 @@ -1359,11 +1359,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 @@ -1373,7 +1372,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/concrete/rped.dm b/code/datums/components/storage/concrete/rped.dm index 9d85dc6173..bf96ae436f 100644 --- a/code/datums/components/storage/concrete/rped.dm +++ b/code/datums/components/storage/concrete/rped.dm @@ -37,7 +37,7 @@ to_chat(M, "You start dumping out tier/cell rating [lowest_rating] parts from [parent].") var/turf/T = get_turf(A) 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, TRUE, M))) + while (do_after(M, 1 SECONDS, T, NONE, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress, TRUE, M))) stoplag(1) progress.end_progress() A.do_squish(0.8, 1.2) @@ -81,7 +81,7 @@ to_chat(M, "You start dumping out tier/cell rating [lowest_rating] parts from [parent].") var/turf/T = get_turf(A) 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, TRUE, M))) + while (do_after(M, 10, T, NONE, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress, TRUE, M))) stoplag(1) progress.end_progress() A.do_squish(0.8, 1.2) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index c0101140d6..76c5830765 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -213,7 +213,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].") @@ -271,7 +271,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, TRUE, M))) + while(do_after(M, 1 SECONDS, T, NONE, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress, TRUE, M))) stoplag(1) progress.end_progress() A.do_squish(0.8, 1.2) @@ -374,7 +374,8 @@ if(check_locked(null, M, TRUE)) return FALSE if(dump_destination.storage_contents_dump_act(src, M)) - playsound(A, "rustle", 50, 1, -5) + if(rustle_sound) + playsound(A, "rustle", 50, 1, -5) A.do_squish(0.8, 1.2) return TRUE return FALSE @@ -437,7 +438,7 @@ if(isrevenant(M)) INVOKE_ASYNC(GLOBAL_PROC, .proc/RevenantThrow, over_object, M, source) return - if(check_locked(null, M) || !M.CanReach(A) || (!M.CanReach(over_object) && !istype(over_object, /atom/movable/screen))) + if(check_locked(null, M) || !M.CanReach(A)) return playsound(A, "rustle", 50, TRUE, -5) A.do_jiggle() @@ -673,7 +674,7 @@ var/atom/A = parent update_actions() for(var/mob/M in range(1, A)) - if(M.active_storage == src) + if(M.active_storage == src && (M != user)) close(M) /datum/component/storage/proc/signal_take_obj(datum/source, atom/movable/AM, new_loc, force = FALSE) diff --git a/code/datums/elements/scavenging.dm b/code/datums/elements/scavenging.dm index 1993005be7..e6e3279a6b 100644 --- a/code/datums/elements/scavenging.dm +++ b/code/datums/elements/scavenging.dm @@ -98,7 +98,7 @@ if(len_messages >= 3) msg_blind = "[search_texts[3]]" user.visible_message("[user] [search_texts[1]] [source].", msg_first_person, msg_blind) - if(do_after(user, scavenge_time * speed_multi, TRUE, source, TRUE, CALLBACK(src, .proc/set_progress, source, world.time), resume_time = progress_done * speed_multi)) + if(do_after(user, scavenge_time * speed_multi, source, NONE, TRUE, CALLBACK(src, .proc/set_progress, source, world.time), resume_time = progress_done * speed_multi)) spawn_loot(source, user) players_busy_scavenging -= user diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index 85fea3533e..5b2480a5bc 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -295,7 +295,7 @@ if(istype(gloves)) strip_mod = gloves.strip_mod - if (!do_mob(user, source, (strip_delay || item.strip_delay) / strip_mod, ignorehelditem = TRUE)) + if (!do_mob(user, source, (strip_delay || item.strip_delay) / strip_mod, timed_action_flags = IGNORE_HELD_ITEM)) return FALSE return TRUE diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 2e7a7ea9d2..25a6fa3d66 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -977,7 +977,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 successfully remove the durathread strand.") diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index 26881fe94c..34c83b9a8e 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -27,7 +27,7 @@ /datum/status_effect/freon/proc/owner_resist() to_chat(owner, "You start breaking out of the ice cube!") - if(do_mob(owner, owner, 40)) + if(do_mob(owner, owner, 4 SECONDS)) if(!QDELETED(src)) to_chat(owner, "You break out of the ice cube!") owner.remove_status_effect(/datum/status_effect/freon) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 70e52e5c8c..220cd88499 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -903,7 +903,7 @@ if(STR == src_object) progress.end_progress() return - 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 into [STR.insert_preposition]to [src] as you can.") diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 0e1a67316b..7b0ff1d319 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -191,7 +191,7 @@ if(is_holding_pressure()) // tell the user that this is a bad idea, and have a do_after as well to_chat(user, "As you begin crowbarring \the [src] a gush of air blows in your face... maybe you should reconsider?") - if(!do_after(user, 15, TRUE, src)) // give them a few seconds to reconsider their decision. + if(!do_after(user, 1.5 SECONDS, src)) // give them a few seconds to reconsider their decision. return log_game("[key_name_admin(user)] has opened a firelock with a pressure difference at [AREACOORD(loc)]") // there bibby I made it logged just for you. Enjoy. // since we have high-pressure-ness, close all other firedoors on the tile diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index bc22f99928..5cf563b9da 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -25,7 +25,7 @@ . = ..() if(stored) to_chat(user, "You start struggling to pry the [stored] from the [src]...") - if(!do_after(user, 30 SECONDS, TRUE, src)) + if(!do_after(user, 30 SECONDS, src)) to_chat(user, "Your fingers slip as you fail to pry the [stored] from the [src], clicking it right back into the slot!") return user.put_in_hands(stored) @@ -73,7 +73,6 @@ w_class = WEIGHT_CLASS_BULKY resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF - // The message server itself. /obj/machinery/telecomms/message_server icon = 'icons/obj/machines/research.dmi' @@ -84,6 +83,7 @@ use_power = IDLE_POWER_USE idle_power_usage = 10 active_power_usage = 100 + circuit = /obj/item/circuitboard/machine/telecomms/message_server id = "Messaging Server" network = "tcommsat" diff --git a/code/game/objects/items/cardboard_cutouts.dm b/code/game/objects/items/cardboard_cutouts.dm index bdfb9798b7..00fde9f9f5 100644 --- a/code/game/objects/items/cardboard_cutouts.dm +++ b/code/game/objects/items/cardboard_cutouts.dm @@ -112,7 +112,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 - 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 aea961860d..880358a2c1 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -447,7 +447,7 @@ M.visible_message("[user] hastily places [src] on [M]'s chest!", \ "[user] hastily places [src] on [M]'s chest!") busy = TRUE - if(do_after(user, isnull(defib?.disarm_shock_time)? disarm_shock_time : defib.disarm_shock_time, target = M)) + if(do_after(user, isnull(defib?.disarm_shock_time)? disarm_shock_time : defib.disarm_shock_time, M)) M.visible_message("[user] zaps [M] with [src]!", \ "[user] zaps [M] with [src]!") M.DefaultCombatKnockdown(140) @@ -477,7 +477,7 @@ "You overcharge the paddles and begin to place them onto [H]'s chest...") busy = TRUE update_icon() - if(do_after(user, 30, target = H)) + if(do_after(user, 3 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) @@ -486,7 +486,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, 30, target = H)) //Takes longer due to overcharging + if(do_after(user, 3 SECONDS, H)) //Takes longer due to overcharging if(!H) busy = FALSE update_icon() @@ -542,7 +542,7 @@ primetimer2 = 20 deathtimer = DEFIB_TIME_LOSS * 10 - if(do_after(user, primetimer, target = 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, primetimer, 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, 0) // patients rot when they are killed, and die when they are dead @@ -551,7 +551,7 @@ var/total_burn = 0 var/total_brute = 0 var/obj/item/organ/heart = H.getorgan(/obj/item/organ/heart) - if(do_after(user, primetimer2, target = H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total + if(do_after(user, primetimer2, H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total for(var/obj/item/carried_item in H.contents) if(istype(carried_item, /obj/item/clothing/suit/space)) if((!combat && !req_defib) || (req_defib && !defib.combat)) diff --git a/code/game/objects/items/devices/dogborg_sleeper.dm b/code/game/objects/items/devices/dogborg_sleeper.dm index 73574eda96..9524598956 100644 --- a/code/game/objects/items/devices/dogborg_sleeper.dm +++ b/code/game/objects/items/devices/dogborg_sleeper.dm @@ -90,7 +90,7 @@ to_chat(user, "Your [src] is already occupied.") return user.visible_message("[hound.name] is carefully inserting [target.name] into their [src].", "You start placing [target] into your [src]...") - if(!patient && iscarbon(target) && !target.buckled && do_after (user, 100, target = target)) + if(!patient && iscarbon(target) && !target.buckled && do_after(user, 10 SECONDS, target)) if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. return //If they moved away, you can't eat them. @@ -127,7 +127,7 @@ user.visible_message("You see [voracious ? "[user] struggling against the expanded material of [hound]'s gut!" : "and hear [user] pounding against something inside of [hound]'s [src.name]!"]", \ "[voracious ? "You start struggling inside of [src]'s tight, flexible confines," : "You start pounding against the metallic walls of [src],"] trying to trigger the release... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a [voracious ? "couple of thumps" : "loud banging noise"] coming from within [hound].") - if(do_after(user, breakout_time, target = src)) + if(do_after(user, breakout_time, src, IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM)) user.visible_message("[user] successfully broke out of [hound.name]!", \ "You successfully break out of [hound.name]!") go_out(user, hound) @@ -443,7 +443,7 @@ to_chat(user,"[target] is buckled and can not be put into your [src].") return user.visible_message("[hound.name] is ingesting [target] into their [src].", "You start ingesting [target] into your [src.name]...") - if(do_after(user, 30, target = target) && !patient && !target.buckled) + if(do_after(user, 3 SECONDS, target) && !patient && !target.buckled) target.forceMove(src) target.reset_perspective(src) update_gut(hound) diff --git a/code/game/objects/items/eightball.dm b/code/game/objects/items/eightball.dm index 39c8143ee9..046f7ea1ab 100644 --- a/code/game/objects/items/eightball.dm +++ b/code/game/objects/items/eightball.dm @@ -62,7 +62,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/granters.dm b/code/game/objects/items/granters.dm index 7227b10298..f83d01f4ef 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -11,7 +11,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, 1) - if(do_after(user,50, TRUE, user)) + if(do_after(user, 5 SECONDS, src)) if(remarks.len) to_chat(user, "[pick(remarks)]") else @@ -53,7 +53,7 @@ on_reading_stopped() reading = FALSE return - if(do_after(user,50, TRUE, user)) + if(do_after(user, 5 SECONDS, src)) on_reading_finished(user) reading = FALSE return TRUE diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index f0cd0fc1e7..f868dfd3b9 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -139,7 +139,7 @@ /obj/item/restraints/handcuffs/cable/attack_self(mob/user) to_chat(user, "You start unwinding the cable restraints back into coil") - if(!do_after(user, 25, TRUE, user)) + if(!do_after(user, 25, user)) return qdel(src) var/obj/item/stack/cable_coil/coil = new(get_turf(user)) diff --git a/code/game/objects/items/religion.dm b/code/game/objects/items/religion.dm index 20a2aae52a..bd03698cd7 100644 --- a/code/game/objects/items/religion.dm +++ b/code/game/objects/items/religion.dm @@ -244,7 +244,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/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 572ce58c74..43ed3b9213 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -306,7 +306,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \ "You begin whittling [src] into a sharp point at one end.", \ "You hear wood carving.") // 8 Second Timer - if(!do_after(user, 80, TRUE, src)) + if(!do_after(user, 8 SECONDS, src)) return // Make Stake var/obj/item/stake/basic/new_item = new(user.loc) diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index a24137c2f7..43648f8435 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -17,7 +17,6 @@ attack_verb = list("pinched", "nipped") hitsound = 'sound/items/wirecutter.ogg' usesound = 'sound/items/wirecutter.ogg' - tool_behaviour = TOOL_WIRECUTTER toolspeed = 1 armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 30) @@ -126,7 +125,6 @@ desc = "A set of jaws of life, compressed through the magic of science. It's fitted with a cutting head." icon_state = "jaws_cutter" item_state = "jawsoflife" - custom_materials = list(/datum/material/iron=150,/datum/material/silver=50,/datum/material/titanium=25) usesound = 'sound/items/jaws_cut.ogg' toolspeed = 0.25 @@ -161,7 +159,7 @@ var/man = C == user ? "your" : "[C]'\s" user.visible_message("[user] attempts to remove the durathread strand from around [man] neck.", \ "You attempt to remove the durathread strand from around [man] neck.") - if(do_after(user, 15, null, C)) + if(do_after(user, 1.5 SECONDS, C)) user.visible_message("[user] succesfuly removes the durathread strand.", "You succesfuly remove the durathread strand.") C.remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 8e7f5a35f8..d90d44ddfd 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -468,7 +468,7 @@ user.visible_message("[src] begins to shake violently!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear banging from [src].") - if(do_after(user,(breakout_time), target = src, required_mobility_flags = MOBILITY_RESIST)) + if(do_after(user, breakout_time, src, IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM)) if(!user || user.stat != CONSCIOUS || user.loc != src || opened || (!locked && !welded) ) return //we check after a while whether there is a point of resisting anymore and whether the user is capable of resisting diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index e89e6e6116..40424d831d 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -48,7 +48,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, 3 SECONDS, target = src)) + if(do_after(user, 3 SECONDS, src)) 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 @@ -514,7 +514,7 @@ "You start washing your [washing_face ? "face" : "hands"]...") busy = TRUE - if(!do_after(user, 40, target = src)) + if(!do_after(user, 4 SECONDS, src)) busy = FALSE return @@ -595,7 +595,7 @@ if(user.a_intent != INTENT_HARM) to_chat(user, "You start washing [O]...") busy = TRUE - if(!do_after(user, 40, target = src)) + if(!do_after(user, 4 SECONDS, src)) busy = FALSE return 1 busy = FALSE diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 9bd8225470..0e32c170d7 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -55,7 +55,7 @@ . = ..() if(dropping == user && isliving(user)) var/mob/living/L = user - if(L.resting && do_after(L, max(10, L.getStaminaLoss()*0.5), 0, src)) + if(L.resting && do_after(L, max(10, L.getStaminaLoss()*0.5), src, IGNORE_HELD_ITEM)) if(Adjacent(L, src)) step(L, get_dir(L, src)) playsound(L, "rustle", 25, 1) diff --git a/code/game/turfs/simulated/wall/misc_walls.dm b/code/game/turfs/simulated/wall/misc_walls.dm index a8d1cf2ed4..5686a2dc02 100644 --- a/code/game/turfs/simulated/wall/misc_walls.dm +++ b/code/game/turfs/simulated/wall/misc_walls.dm @@ -92,7 +92,7 @@ if(!istype(I, /obj/item/pickaxe/drill/jackhammer)) return FALSE to_chat(user, "You begin to smash though [src]...") - if(!do_after(user, 70, TRUE, src)) + if(!do_after(user, 7 SECONDS, src)) return FALSE I.play_tool_sound(src) visible_message("[user] smashes through [src] with [I]!", "You hear the grinding of metal.") diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index a42215e511..826132e860 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -388,7 +388,7 @@ GLOBAL_LIST_EMPTY(station_turfs) var/list/things = src_object.contents() var/datum/progressbar/progress = new(user, things.len, src) - while (do_after(usr, 1 SECONDS, TRUE, src, FALSE, CALLBACK(src_object, /datum/component/storage.proc/mass_remove_from_storage, src, things, progress, TRUE, user))) + while (do_after(usr, 1 SECONDS, src, NONE, FALSE, CALLBACK(src_object, /datum/component/storage.proc/mass_remove_from_storage, src, things, progress, TRUE, user))) stoplag(1) progress.end_progress() diff --git a/code/modules/antagonists/bloodsucker/items/bloodsucker_stake.dm b/code/modules/antagonists/bloodsucker/items/bloodsucker_stake.dm index 5e6989806a..06eabd4739 100644 --- a/code/modules/antagonists/bloodsucker/items/bloodsucker_stake.dm +++ b/code/modules/antagonists/bloodsucker/items/bloodsucker_stake.dm @@ -81,7 +81,7 @@ // Make Attempt... to_chat(user, "You put all your weight into embedding the stake into [target]'s chest...") playsound(user, 'sound/magic/Demon_consume.ogg', 50, 1) - if(!do_mob(user, C, staketime, 0, 1, extra_checks=CALLBACK(C, /mob/living/carbon/proc/can_be_staked))) // user / target / time / uninterruptable / show progress bar / extra checks + if(!do_mob(user, C, staketime, NONE, extra_checks=CALLBACK(C, /mob/living/carbon/proc/can_be_staked))) // user / target / time / uninterruptable / show progress bar / extra checks return // Drop & Embed Stake user.visible_message("[user.name] drives the [src] into [target]'s chest!", \ diff --git a/code/modules/antagonists/bloodsucker/powers/feed.dm b/code/modules/antagonists/bloodsucker/powers/feed.dm index 81ebdbe4e2..a4bdcfee54 100644 --- a/code/modules/antagonists/bloodsucker/powers/feed.dm +++ b/code/modules/antagonists/bloodsucker/powers/feed.dm @@ -146,7 +146,7 @@ to_chat(user, "You lean quietly toward [target] and secretly draw out your fangs...") else to_chat(user, "You pull [target] close to you and draw out your fangs...") - if(!do_mob(user, target, feed_time, 0, 1, extra_checks = CALLBACK(src, .proc/ContinueActive, user, target)))//sleep(10) + if(!do_mob(user, target, feed_time, NONE, extra_checks = CALLBACK(src, .proc/ContinueActive, user, target)))//sleep(10) to_chat(user, "Your feeding was interrupted.") //DeactivatePower(user,target) return @@ -207,7 +207,7 @@ //user.mobility_flags &= ~MOBILITY_MOVE // user.canmove = 0 // Prevents spilling blood accidentally. // Abort? A bloody mistake. - if(!do_mob(user, target, 20, 0, 0, extra_checks=CALLBACK(src, .proc/ContinueActive, user, target))) + if(!do_mob(user, target, 2 SECONDS, NONE, extra_checks=CALLBACK(src, .proc/ContinueActive, user, target))) // May have disabled Feed during do_mob if(!active || !ContinueActive(user, target)) break diff --git a/code/modules/antagonists/changeling/powers/linglink.dm b/code/modules/antagonists/changeling/powers/linglink.dm index b82f215a04..067399fb9a 100644 --- a/code/modules/antagonists/changeling/powers/linglink.dm +++ b/code/modules/antagonists/changeling/powers/linglink.dm @@ -59,7 +59,7 @@ target.reagents.add_reagent(/datum/reagent/medicine/salbutamol, 40) // So they don't choke to death while you interrogate them sleep(1800) SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("[name]", "[i]")) - if(!do_mob(user, target, 20)) + if(!do_mob(user, target, 2 SECONDS)) to_chat(user, "Our link with [target] has ended!") 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 808932443f..ba7fcb0be1 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_book.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_book.dm @@ -43,7 +43,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 @@ -57,7 +57,7 @@ var/A = get_turf(target) to_chat(user, "You start drawing a rune...") - if(do_after(user,30 SECONDS,FALSE, user)) + if(do_after(user, 30 SECONDS, user)) new /obj/effect/eldritch/big(A) @@ -65,7 +65,7 @@ /obj/item/forbidden_book/proc/remove_rune(atom/target,mob/user) to_chat(user, "You start removing a rune...") - if(do_after(user,2 SECONDS,FALSE, user)) + if(do_after(user, 2 SECONDS, user)) qdel(target) /obj/item/forbidden_book/ui_interact(mob/user, datum/tgui/ui = null) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm index 61ff54c5e9..97b76090a7 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm @@ -958,7 +958,7 @@ halo = halo || mutable_appearance('icons/effects/effects.dmi', "at_shield2", EFFECTS_LAYER) user.add_overlay(halo) playsound(get_turf(user), Snd, 50, 0) - if(do_mob(user,user,50,1)) + if(do_mob(user, user, 5 SECONDS)) user.cut_overlay(halo) user.emote("clap1") user.say("DOM'ENO ISPLETIMAS") diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index 3a173d55c7..885921a944 100644 --- a/code/modules/antagonists/revenant/revenant_abilities.dm +++ b/code/modules/antagonists/revenant/revenant_abilities.dm @@ -32,7 +32,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)) //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) @@ -41,7 +41,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)) //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.") @@ -51,7 +51,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)) //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.") @@ -73,7 +73,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, 4.6 SECONDS, target)) //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 f349eae02b..878b54de38 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -110,7 +110,7 @@ to_chat(user, "You require 3 [S.name] to repair [src].") return to_chat(user, "You begin fixing the damage to [src] with [S]...") - if(do_after(user, 6 SECONDS, TRUE, src)) + if(do_after(user, 6 SECONDS, src)) if(S.use(3)) repair(user, params) return 1 diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index e17396626c..606c361ab0 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -180,7 +180,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, 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) @@ -204,7 +204,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, 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) @@ -285,6 +285,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, 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/hydroponics/grown/kudzu.dm b/code/modules/hydroponics/grown/kudzu.dm index 73026e546a..f48c660667 100644 --- a/code/modules/hydroponics/grown/kudzu.dm +++ b/code/modules/hydroponics/grown/kudzu.dm @@ -44,7 +44,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())) plant(user) to_chat(user, "You plant the kudzu. You monster.") diff --git a/code/modules/library/lib_codex_gigas.dm b/code/modules/library/lib_codex_gigas.dm index 26fa5b6f3d..21296bcba9 100644 --- a/code/modules/library/lib_codex_gigas.dm +++ b/code/modules/library/lib_codex_gigas.dm @@ -52,7 +52,7 @@ correctness = 100 correctness -= U.getOrganLoss(ORGAN_SLOT_BRAIN) * 0.5 //Brain damage makes researching hard. speed += U.getOrganLoss(ORGAN_SLOT_BRAIN) * 3 - if(do_after(user, speed, 0, user)) + if(do_after(user, speed, user)) var/usedName = devilName if(!prob(correctness)) usedName += "x" diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index c31b566cf3..7e10ae1c39 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -123,7 +123,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 @@ -153,7 +153,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 fdf51262ac..443e28ab26 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -267,7 +267,7 @@ MarkResistTime() 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, required_mobility_flags = MOBILITY_RESIST)) + if(do_after(src, buckle_cd, src, timed_action_flags = IGNORE_HELD_ITEM)) if(!buckled) return buckled.user_unbuckle_mob(src, src) @@ -304,13 +304,16 @@ if(I.item_flags & BEING_REMOVED) to_chat(src, "You're already attempting to remove [I]!") return + var/obj/item/restraints/R = istype(I, /obj/item/restraints) ? I : null + var/allow_breakout_movement = NONE + if(R?.allow_breakout_movement) + allow_breakout_movement = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE) I.item_flags |= BEING_REMOVED breakouttime = I.breakouttime - var/datum/cuffbreak_checker/cuffbreak_checker = new(get_turf(src), istype(I, /obj/item/restraints)? I : null) 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_advanced(src, breakouttime, src, NONE, CALLBACK(cuffbreak_checker, /datum/cuffbreak_checker.proc/check_movement), required_mobility_flags = MOBILITY_RESIST)) + if(do_after(src, breakouttime, target = src, timed_action_flags = allow_breakout_movement)) clear_cuffs(I, cuff_break) else to_chat(src, "You fail to remove [I]!") @@ -319,7 +322,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_advanced(src, breakouttime, src, NONE, CALLBACK(cuffbreak_checker, /datum/cuffbreak_checker.proc/check_movement), required_mobility_flags = MOBILITY_RESIST)) + if(do_after(src, breakouttime, target = src, timed_action_flags = allow_breakout_movement)) clear_cuffs(I, cuff_break) else to_chat(src, "You fail to break [I]!") @@ -327,28 +330,8 @@ else if(cuff_break == INSTANT_CUFFBREAK) clear_cuffs(I, cuff_break) - QDEL_NULL(cuffbreak_checker) I.item_flags &= ~BEING_REMOVED -/datum/cuffbreak_checker - var/turf/last - var/obj/item/restraints/cuffs - -/datum/cuffbreak_checker/New(turf/initial_turf, obj/item/restraints/R) - last = initial_turf - if(R) - cuffs = R - -/datum/cuffbreak_checker/proc/check_movement(atom/user, delay, atom/target, time_left, do_after_flags, required_mobility_flags, required_combat_flags, mob_redirect, stage, initially_held_item, tool, list/passed_in) - if(get_turf(user) != last) - last = get_turf(user) - passed_in[1] = 0.5 - if(cuffs && !cuffs.allow_breakout_movement) - return DO_AFTER_STOP - else - passed_in[1] = 1 - return DO_AFTER_CONTINUE - /mob/living/carbon/proc/uncuff() if (handcuffed) var/obj/item/W = handcuffed diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 4fb52f31c3..0388f2bc83 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -198,7 +198,7 @@ //rock paper scissors emote handling /mob/living/carbon/human/proc/beginRockPaperScissors(var/chosen_move) GLOB.rockpaperscissors_players[src] = list(chosen_move, ROCKPAPERSCISSORS_NOT_DECIDED) - do_after_advanced(src, ROCKPAPERSCISSORS_TIME_LIMIT, src, DO_AFTER_REQUIRES_USER_ON_TURF|DO_AFTER_NO_COEFFICIENT|DO_AFTER_NO_PROGRESSBAR|DO_AFTER_DISALLOW_MOVING_ABSOLUTE_USER, CALLBACK(src, .proc/rockpaperscissors_tick)) + do_after(src, ROCKPAPERSCISSORS_TIME_LIMIT, src, extra_checks = CALLBACK(src, .proc/rockpaperscissors_tick)) var/new_entry = GLOB.rockpaperscissors_players[src] if(new_entry[2] == ROCKPAPERSCISSORS_NOT_DECIDED) to_chat(src, "You put your hand back down.") @@ -240,10 +240,10 @@ src.visible_message("[opponent] wins!") //make the progress bar end so that each player can handle the result - return DO_AFTER_STOP + return FALSE //no opponent was found, so keep searching - return DO_AFTER_PROCEED + return TRUE //the actual emotes /datum/emote/living/carbon/human/rockpaperscissors diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index b81863e932..144992c04f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -782,7 +782,7 @@ //src is the user that will be carrying, target is the mob to be carried /mob/living/carbon/human/proc/can_piggyback(mob/living/target) - return (iscarbon(target) || ispAI(target)) && target.stat == CONSCIOUS + return (iscarbon(target) || ispAI(target)) && target.stat == CONSCIOUS && CHECK_MOBILITY(src, MOBILITY_STAND) /mob/living/carbon/human/proc/can_be_firemanned(mob/living/carbon/target) return (ishuman(target) && !CHECK_MOBILITY(target, MOBILITY_STAND)) || ispAI(target) @@ -801,7 +801,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, extra_checks = CALLBACK(src, PROC_REF(can_be_firemanned), target))) //Second check to make sure they're still valid to be carried if(can_be_firemanned(target) && !incapacitated(FALSE, TRUE)) buckle_mob(target, TRUE, TRUE, 90, 1, 0, TRUE) @@ -816,7 +816,7 @@ /mob/living/carbon/human/proc/piggyback(mob/living/carbon/target) if(can_piggyback(target)) visible_message("[target] starts to climb onto [src]...") - if(do_after(target, 15, target = src, required_mobility_flags = MOBILITY_STAND)) + if(do_after(target, 1.5 SECONDS, src, extra_checks = CALLBACK(src, PROC_REF(can_piggyback), target))) if(can_piggyback(target)) if(target.incapacitated(FALSE, TRUE) || incapacitated(FALSE, TRUE)) target.visible_message("[target] can't hang onto [src]!") diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 1de40ec80c..5941efe087 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -546,7 +546,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 @@ -817,7 +817,7 @@ to_chat(src, "\t There is \a [I] stuck to your [LB.name]!") else to_chat(src, "\t There is \a [I] embedded in your [LB.name]!") - + /mob/living/carbon/human/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone) if(damage_type != BRUTE && damage_type != BURN) diff --git a/code/modules/mob/living/carbon/human/human_mobility.dm b/code/modules/mob/living/carbon/human/human_mobility.dm index dc498c4153..99577f4b05 100644 --- a/code/modules/mob/living/carbon/human/human_mobility.dm +++ b/code/modules/mob/living/carbon/human/human_mobility.dm @@ -35,7 +35,7 @@ standupwarning = "[src] struggles to stand up." var/usernotice = automatic ? "You are now getting up. (Auto)" : "You are now getting up." visible_message("[standupwarning]", usernotice, vision_distance = 5) - if(do_after(src, totaldelay, target = src, required_mobility_flags = MOBILITY_RESIST)) + if(do_after(src, totaldelay, target = src, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM))) set_resting(FALSE, TRUE) combat_flags &= ~COMBAT_FLAG_RESISTING_REST diff --git a/code/modules/mob/living/carbon/human/human_stripping.dm b/code/modules/mob/living/carbon/human/human_stripping.dm index cd05e06731..08db3fe552 100644 --- a/code/modules/mob/living/carbon/human/human_stripping.dm +++ b/code/modules/mob/living/carbon/human/human_stripping.dm @@ -60,7 +60,7 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list( if (!istype(jumpsuit)) return null to_chat(source, "[user] is trying to adjust your [jumpsuit.name].") - if (!do_mob(user, source, jumpsuit.strip_delay * 0.5, ignorehelditem = TRUE)) + if (!do_mob(user, source, jumpsuit.strip_delay * 0.5, timed_action_flags = IGNORE_HELD_ITEM)) return to_chat(source, "[user] successfully adjusted your [jumpsuit.name].") jumpsuit.toggle_jumpsuit_adjust() @@ -96,7 +96,7 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list( source.visible_message("[user] tries to [hardsuit.suittoggled ? "retract" : "extend"] [source]'s helmet.", \ "[user] tries to [hardsuit.suittoggled ? "retract" : "extend"] [source]'s helmet.", \ target = user, target_message = "You try to [hardsuit.suittoggled ? "retract" : "extend"] [source]'s helmet.") - if(!do_mob(user, source, hardsuit_head ? hardsuit_head.strip_delay : POCKET_STRIP_DELAY, ignorehelditem = TRUE)) + if(!do_mob(user, source, hardsuit_head ? hardsuit_head.strip_delay : POCKET_STRIP_DELAY, timed_action_flags = IGNORE_HELD_ITEM)) return null if((source.head != hardsuit_head) && source.head) return null @@ -279,7 +279,7 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list( to_chat(user, span_notice("You try to [isnull(carbon_source.internal) ? "open": "close"] the valve on [source]'s [item.name]...")) - if(!do_mob(user, carbon_source, INTERNALS_TOGGLE_DELAY, ignorehelditem = TRUE)) + if(!do_mob(user, carbon_source, INTERNALS_TOGGLE_DELAY, timed_action_flags = IGNORE_HELD_ITEM)) return null if(carbon_source.internal) diff --git a/code/modules/mob/living/carbon/human/species_types/arachnid.dm b/code/modules/mob/living/carbon/human/species_types/arachnid.dm index 6dc19d928a..819f347353 100644 --- a/code/modules/mob/living/carbon/human/species_types/arachnid.dm +++ b/code/modules/mob/living/carbon/human/species_types/arachnid.dm @@ -92,7 +92,7 @@ var/nutrition_threshold = NUTRITION_LEVEL_FED if (H.nutrition >= nutrition_threshold) to_chat(H, "You begin spinning some web...") - if(!do_after(H, 10 SECONDS, 1, T)) + if(!do_after(H, 10 SECONDS, T)) to_chat(H, "Your web spinning was interrupted!") return H.adjust_nutrition(-E.spinner_rate) @@ -152,7 +152,7 @@ to_chat(H, "You cannot wrap this.") return H.visible_message("[H] starts to wrap [A] into a cocoon!","You start to wrap [A] into a cocoon.") - if(!do_after(H, 10 SECONDS, 1, A)) + if(!do_after(H, 10 SECONDS, A)) to_chat(H, "Your web spinning was interrupted!") return H.adjust_nutrition(E.spinner_rate * -3) 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 ae7a7546e1..8a1c8707fa 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -153,7 +153,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) @@ -169,7 +169,6 @@ 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 6f48d9022d..e8042dfac9 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -198,7 +198,7 @@ H.mob_transforming = TRUE - if(do_after(owner, delay=60, needhand=FALSE, target=owner, progress=TRUE)) + if(do_after(owner, 6 SECONDS, owner)) 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 be6508dd96..f6a2f1cb38 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -953,7 +953,7 @@ else to_chat(src,"You try to remove [who]'s [what.name].") what.add_fingerprint(src) - if(do_mob(src, who, round(what.strip_delay / strip_mod), ignorehelditem = TRUE)) + if(do_mob(src, who, round(what.strip_delay / strip_mod), timed_action_flags = IGNORE_HELD_ITEM)) if(what && Adjacent(who)) if(islist(where)) var/list/L = where diff --git a/code/modules/mob/living/living_active_block.dm b/code/modules/mob/living/living_active_block.dm index 9ccaeb6c59..d6a4640062 100644 --- a/code/modules/mob/living/living_active_block.dm +++ b/code/modules/mob/living/living_active_block.dm @@ -48,7 +48,7 @@ animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = 2.5, FALSE, SINE_EASING | EASE_IN) /mob/living/proc/continue_starting_active_block() - return (combat_flags & COMBAT_FLAG_ACTIVE_BLOCK_STARTING)? DO_AFTER_CONTINUE : DO_AFTER_STOP + return (combat_flags & COMBAT_FLAG_ACTIVE_BLOCK_STARTING) /mob/living/get_standard_pixel_x_offset() . = ..() @@ -102,7 +102,7 @@ var/delay = data.block_start_delay combat_flags |= COMBAT_FLAG_ACTIVE_BLOCK_STARTING animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = delay, FALSE, SINE_EASING | EASE_IN) - if(!do_after_advanced(src, delay, src, DO_AFTER_REQUIRES_USER_ON_TURF|DO_AFTER_NO_COEFFICIENT, CALLBACK(src, .proc/continue_starting_active_block), MOBILITY_USE, null, null, I)) + if(!do_after(src, delay, src, (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE), extra_checks = CALLBACK(src, .proc/continue_starting_active_block))) to_chat(src, "You fail to raise [I].") combat_flags &= ~(COMBAT_FLAG_ACTIVE_BLOCK_STARTING) animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = 2.5, FALSE, SINE_EASING | EASE_IN, ANIMATION_END_NOW) diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 4f6b6aa351..9973b6472e 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -365,7 +365,7 @@ playsound(src, 'sound/weapons/cablecuff.ogg', 30, TRUE, -2) C.visible_message("[process_emote("CAPTURE_ONE", C)]",\ "[process_emote("CAPTURE_TWO", C)]") - if(do_after(src, 60, FALSE, C)) + if(do_after(src, 60, C)) attempt_handcuff(C) /mob/living/simple_animal/bot/secbot/proc/attempt_handcuff(mob/living/carbon/C) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm index d9ea6f4a8a..b7545de517 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -17,7 +17,7 @@ if("Cannibalize") if(D.health < D.maxHealth) D.visible_message("[D] begins to cannibalize parts from [src].", "You begin to cannibalize parts from [src]...") - if(do_after(D, 60, 0, target = src)) + if(do_after(D, 6 SECONDS, src)) D.visible_message("[D] repairs itself using [src]'s remains!", "You repair yourself using [src]'s remains.") D.adjustBruteLoss(-src.maxHealth) new /obj/effect/decal/cleanable/oil/streak(get_turf(src)) @@ -44,7 +44,7 @@ to_chat(user, "You can't seem to find the [pick(faux_gadgets)]! Without it, [src] [pick(faux_problems)].") return user.visible_message("[user] begins to reactivate [src].", "You begin to reactivate [src]...") - if(do_after(user, 30, 1, target = src)) + if(do_after(user, 3 SECONDS, src)) revive(full_heal = 1) user.visible_message("[user] reactivates [src]!", "You reactivate [src].") alert_drones(DRONE_NET_CONNECT) diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 9ade9f097f..3c50cc2024 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -53,7 +53,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( if(vent_found_parent && (vent_found_parent.members.len || vent_found_parent.other_atmosmch)) visible_message("[src] begins climbing into the ventilation system..." ,"You begin climbing into the ventilation system...") - if(!do_after(src, 25, target = vent_found, required_mobility_flags = MOBILITY_MOVE)) + if(!do_after(src, 25, target = vent_found)) return if(!client) diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index 80cf0a3d95..42e9a3dff0 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -1,3 +1,5 @@ +#define MOD_ACTIVATION_STEP_FLAGS IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM|IGNORE_INCAPACITATED + /// Creates a radial menu from which the user chooses parts of the suit to deploy/retract. Repeats until all parts are extended or retracted. /obj/item/mod/control/proc/choose_deploy(mob/user) if(!length(mod_parts)) @@ -132,31 +134,31 @@ playsound(src, 'sound/machines/synth_no.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000) return TRUE - if(do_after(wearer, activation_step_time, target = wearer, required_mobility_flags = NONE)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(has_wearer)))) to_chat(wearer, span_notice("[boots] [active ? "relax their grip on your legs" : "seal around your feet"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(boots, seal = !active) else return toggle_activate_fail() - if(do_after(wearer, activation_step_time, target = wearer, required_mobility_flags = NONE)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(has_wearer)))) to_chat(wearer, span_notice("[gauntlets] [active ? "become loose around your fingers" : "tighten around your fingers and wrists"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(gauntlets, seal = !active) else return toggle_activate_fail() - if(do_after(wearer, activation_step_time, target = wearer, required_mobility_flags = NONE)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(has_wearer)))) to_chat(wearer, span_notice("[chestplate] [active ? "releases your chest" : "cinches tightly against your chest"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(chestplate,seal = !active) else return toggle_activate_fail() - if(do_after(wearer, activation_step_time, target = wearer, required_mobility_flags = NONE)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(has_wearer)))) to_chat(wearer, span_notice("[helmet] hisses [active ? "open" : "closed"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(helmet, seal = !active) else return toggle_activate_fail() - if(do_after(wearer, activation_step_time, target = wearer, required_mobility_flags = NONE)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(has_wearer)))) to_chat(wearer, span_notice("Systems [active ? "shut down. Parts unsealed. Goodbye" : "started up. Parts sealed. Welcome"], [wearer].")) if(ai) to_chat(ai, span_notice("SYSTEMS [active ? "DEACTIVATED. GOODBYE" : "ACTIVATED. WELCOME"]: \"[ai]\"")) @@ -240,3 +242,6 @@ for(var/obj/item/part in mod_parts) seal_part(part, seal = TRUE) finish_activation(on = TRUE) + +/obj/item/mod/control/proc/has_wearer() + return wearer diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 9e779b9c1b..d45b5ad9e1 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -587,7 +587,7 @@ By design, d1 is the smallest direction and d2 is the highest to_chat(user, "You don't have enough cable coil to make restraints out of them") return to_chat(user, "You start making some cable restraints.") - if(!do_after(user, 30, TRUE, user, TRUE) || !use(15)) + if(!do_after(user, 3 SECONDS, user) || !use(15)) to_chat(user, "You fail to make cable restraints, you need to be standing still to do it") return var/obj/item/restraints/handcuffs/cable/result = new(get_turf(user)) diff --git a/code/modules/reagents/reagent_containers/rags.dm b/code/modules/reagents/reagent_containers/rags.dm index 1bd9c16000..4982571a3b 100644 --- a/code/modules/reagents/reagent_containers/rags.dm +++ b/code/modules/reagents/reagent_containers/rags.dm @@ -37,14 +37,14 @@ var/log_object = "a damp rag containing [reagentlist]" if(user.a_intent == INTENT_HARM && !C.is_mouth_covered()) C.visible_message("[user] is trying to smother \the [C] with \the [src]!", "[user] is trying to smother you with \the [src]!", "You hear some struggling and muffled cries of surprise.") - if(do_after(user, 20, target = C)) + if(do_after(user, 2 SECONDS, C)) reagents.reaction(C, INGEST) reagents.trans_to(C, 5, log = "rag smother") C.visible_message("[user] has smothered \the [C] with \the [src]!", "[user] has smothered you with \the [src]!", "You hear some struggling and a heavy breath taken.") log_combat(user, C, "smothered", log_object) else C.visible_message("[user] is trying to wipe \the [C] with \the [src].") - if(do_after(user, 20, target = C)) + if(do_after(user, 2 SECONDS, C)) reagents.reaction(C, TOUCH) reagents.remove_all(5) C.visible_message("[user] has wiped \the [C] with \the [src].") @@ -52,7 +52,7 @@ else if(istype(A) && (src in user)) user.visible_message("[user] starts to wipe down [A] with [src]!", "You start to wipe down [A] with [src]...") - if(do_after(user, action_speed, target = A)) + if(do_after(user, action_speed, A)) user.visible_message("[user] finishes wiping off [A]!", "You finish wiping off [A].") SEND_SIGNAL(A, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_MEDIUM) @@ -91,7 +91,7 @@ . = ..() if(reagents.total_volume && user.canUseTopic(src, BE_CLOSE)) to_chat(user, "You start squeezing \the [src] dry...") - if(do_after(user, action_speed, TRUE, src)) + if(do_after(user, action_speed, src)) var/msg = "You squeeze \the [src]" var/obj/item/target if(Adjacent(user)) //Allows the user to drain the reagents into a beaker if adjacent (no telepathy). diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index c02405fc3f..98549fc495 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -114,7 +114,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 bf6051c87c..2a21916c8a 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, marked_item, timed_action_flags = (IGNORE_USER_LOC_CHANGE|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 d0c3c4166c..f5aaca2a87 100644 --- a/code/modules/spells/spell_types/lightning.dm +++ b/code/modules/spells/spell_types/lightning.dm @@ -27,7 +27,7 @@ halo = halo || mutable_appearance('icons/effects/effects.dmi', "electricity", EFFECTS_LAYER) user.add_overlay(halo) playsound(get_turf(user), Snd, 50, 0) - if(do_mob(user,user,100,1)) + if(do_mob(user, user, 10 SECONDS)) if(ready && cast_check(skipcharge=1)) choose_targets() else diff --git a/code/modules/vehicles/sealed.dm b/code/modules/vehicles/sealed.dm index 7bb4e878ec..7c1fa8f61a 100644 --- a/code/modules/vehicles/sealed.dm +++ b/code/modules/vehicles/sealed.dm @@ -25,7 +25,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/vore/eating/belly_obj.dm b/code/modules/vore/eating/belly_obj.dm index 3d8870d41a..07e01e4580 100644 --- a/code/modules/vore/eating/belly_obj.dm +++ b/code/modules/vore/eating/belly_obj.dm @@ -539,7 +539,7 @@ //Handle a mob struggling // Called from /mob/living/carbon/relaymove() -/obj/belly/proc/relay_resist(var/mob/living/R) +/obj/belly/proc/relay_resist(mob/living/R) if (!(R in contents)) return // User is not in this belly @@ -547,7 +547,7 @@ to_chat(R,"You attempt to climb out of \the [lowertext(name)]. (This will take around [escapetime/10] seconds.)") to_chat(owner,"Someone is attempting to climb out of your [lowertext(name)]!") - if(do_after(R, owner, escapetime)) + if(do_after(R, escapetime, owner, (IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM))) if((owner.stat || escapable) && (R.loc == src)) //Can still escape? release_specific_contents(R) return @@ -604,7 +604,7 @@ if(prob(escapechance)) //Let's have it check to see if the prey escapes first. to_chat(R,"You start to climb out of \the [lowertext(name)].") to_chat(owner,"Someone is attempting to climb out of your [lowertext(name)]!") - if(do_after(R, escapetime)) + if(do_after(R, escapetime, owner, (IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM))) if((escapable) && (R.loc == src)) //Can still escape? release_specific_contents(R) to_chat(R,"You climb out of \the [lowertext(name)].") diff --git a/code/modules/vore/eating/living.dm b/code/modules/vore/eating/living.dm index 99c1236d9c..d5a3627684 100644 --- a/code/modules/vore/eating/living.dm +++ b/code/modules/vore/eating/living.dm @@ -152,7 +152,7 @@ swallow_time = istype(prey, /mob/living/carbon/human) ? belly.human_prey_swallow_time : belly.nonhuman_prey_swallow_time //Timer and progress bar - if(!do_after(user, swallow_time, TRUE, prey)) + if(!do_after(user, swallow_time, prey)) return FALSE // Prey escaped (or user disabled) before timer expired. if(!prey.Adjacent(user)) //double check'd just in case they moved during the timer and the do_mob didn't fail for whatever reason