From 7d34ea2f58c14df9a11544c015e87bc4179c56b9 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 22 Jul 2023 14:59:18 -0400 Subject: [PATCH 01/13] removes do_after_mob and do_atom --- code/__HELPERS/mobs.dm | 133 +++++------------- code/__HELPERS/unsorted.dm | 38 ----- code/_onclick/hud/alert.dm | 3 - .../structures/crates_lockers/closets.dm | 3 +- code/modules/mob/living/carbon/carbon.dm | 5 +- code/modules/mob/mob_defines.dm | 5 + .../code/modules/spacepods/equipment.dm | 2 +- yogstation/code/modules/spacepods/spacepod.dm | 4 +- 8 files changed, 48 insertions(+), 145 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 62d6f348e67a..569bb72de48c 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -269,64 +269,6 @@ GLOBAL_LIST_EMPTY(species_list) else return "unknown" - -/mob/var/action_speed_modifier = 1 //Value to multiply action delays by //yogs start: fuck -/mob/var/action_speed_adjust = 0 //Value to add or remove to action delays //yogs end - -/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null) - if(!user || !target) - return 0 - var/user_loc = user.loc - - if(target) - LAZYADD(user.do_afters, target) - LAZYADD(target.targeted_by, user) - - var/drifting = 0 - if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 - - var/target_loc = target.loc - - var/holding = user.get_active_held_item() - time = ((time + user.action_speed_adjust) * user.action_speed_modifier) //yogs: darkspawn - var/datum/progressbar/progbar - if (progress) - progbar = new(user, time, target) - - var/endtime = world.time+time - var/starttime = world.time - . = 1 - while (world.time < endtime) - stoplag(1) - if (progress) - progbar.update(world.time - starttime) - if(QDELETED(user) || QDELETED(target)) - . = 0 - break - - if(target && !(target in user.do_afters)) - . = FALSE - break - - if(uninterruptible) - continue - - if(drifting && !user.inertia_dir) - drifting = 0 - 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())) - . = 0 - break - if (progress) - qdel(progbar) - - 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) @@ -418,63 +360,62 @@ GLOBAL_LIST_EMPTY(species_list) LAZYREMOVE(user.do_afters, target) LAZYREMOVE(target.targeted_by, user) -/mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1 - . = 1 - return - -/proc/do_after_mob(mob/user, list/targets, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks, required_mobility_flags = MOBILITY_STAND) - if(!user || !targets) +/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null) + if(!user || !target) return 0 - if(!islist(targets)) - targets = list(targets) var/user_loc = user.loc + if(target) + LAZYADD(user.do_afters, target) + LAZYADD(target.targeted_by, user) + var/drifting = 0 if(!user.Process_Spacemove(0) && user.inertia_dir) drifting = 1 - var/list/originalloc = list() - for(var/atom/target in targets) - originalloc[target] = target.loc + var/target_loc = target.loc var/holding = user.get_active_held_item() time = ((time + user.action_speed_adjust) * user.action_speed_modifier) //yogs: darkspawn var/datum/progressbar/progbar - if(progress) - progbar = new(user, time, targets[1]) + if (progress) + progbar = new(user, time, target) - var/endtime = world.time + time + var/endtime = world.time+time var/starttime = world.time - var/mob/living/L - if(isliving(user)) - L = user . = 1 - mainloop: - while(world.time < endtime) - stoplag(1) - if(progress) - progbar.update(world.time - starttime) - if(QDELETED(user) || !targets) - . = 0 - break - if(uninterruptible) - continue + while (world.time < endtime) + stoplag(1) + if (progress) + progbar.update(world.time - starttime) + if(QDELETED(user) || QDELETED(target)) + . = 0 + break + + if(target && !(target in user.do_afters)) + . = FALSE + break - if(drifting && !user.inertia_dir) - drifting = 0 - user_loc = user.loc + if(uninterruptible) + continue - if(L && !CHECK_MULTIPLE_BITFIELDS(L.mobility_flags, required_mobility_flags)) - . = 0 - break + 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() || (extra_checks && !extra_checks.Invoke())) - . = 0 - break mainloop - if(progbar) + if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_held_item() != holding || user.incapacitated() || (extra_checks && !extra_checks.Invoke())) + . = 0 + break + if (progress) qdel(progbar) + if(!QDELETED(target)) + LAZYREMOVE(user.do_afters, target) + LAZYREMOVE(target.targeted_by, user) + +/mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1 + . = 1 + /proc/is_species(A, species_datum) . = FALSE if(ishuman(A)) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 4d29da2282aa..6a4e43e2ca40 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1299,44 +1299,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) temp = ((temp + (temp>>3))&29127) % 63 //070707 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) - if(!user || !target) - return TRUE - var/user_loc = user.loc - - var/drifting = FALSE - if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = TRUE - - var/target_drifting = FALSE - if(!target.Process_Spacemove(0) && target.inertia_dir) - target_drifting = TRUE - - var/target_loc = target.loc - - var/endtime = world.time+time - . = TRUE - while (world.time < endtime) - stoplag(1) - if(QDELETED(user) || QDELETED(target)) - . = 0 - break - if(uninterruptible) - continue - - if(drifting && !user.inertia_dir) - drifting = FALSE - user_loc = user.loc - - if(target_drifting && !target.inertia_dir) - target_drifting = FALSE - target_loc = target.loc - - if((!drifting && user.loc != user_loc) || (!target_drifting && target.loc != target_loc) || (extra_checks && !extra_checks.Invoke())) - . = FALSE - break - // \ref behaviour got changed in 512 so this is necesary to replicate old behaviour. // If it ever becomes necesary to get a more performant REF(), this lies here in wait // #define REF(thing) (thing && istype(thing, /datum) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : "\ref[thing]") diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index a03d283702b1..cac43f2d7677 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -716,9 +716,6 @@ so as to remain in compliance with the most up-to-date laws." mymob?.client?.screen |= alert return 1 -/mob - var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly - /atom/movable/screen/alert/Click(location, control, params) if(!usr || !usr.client) return diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index d20a88cf3c18..42190e04f183 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -381,13 +381,12 @@ GLOBAL_LIST_EMPTY(lockers) else if(!isitem(O)) return var/turf/T = get_turf(src) - var/list/targets = list(O, src) add_fingerprint(user) user.visible_message(span_warning("[user] [actuallyismob ? "tries to ":""]stuff [O] into [src]."), \ span_warning("You [actuallyismob ? "try to ":""]stuff [O] into [src]."), \ span_italics("You hear clanging.")) if(actuallyismob) - if(do_after_mob(user, targets, 40)) + if(do_after(user, 4 SECONDS, O)) user.visible_message(span_notice("[user] stuffs [O] into [src]."), \ span_notice("You stuff [O] into [src]."), \ span_italics("You hear a loud metal bang.")) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index a84894f41b7e..834095a16f46 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1036,7 +1036,7 @@ /mob/living/carbon/do_after_coefficent() . = ..() - var/datum/component/mood/mood = src.GetComponent(/datum/component/mood) //Currently, only carbons or higher use mood, move this once that changes. + var/datum/component/mood/mood = GetComponent(/datum/component/mood) //Currently, only carbons or higher use mood, move this once that changes. if(mood) switch(mood.sanity) //Alters do_after delay based on how sane you are if(-INFINITY to SANITY_DISTURBED) @@ -1044,8 +1044,7 @@ if(SANITY_NEUTRAL to INFINITY) . *= 0.90 - for(var/i in status_effects) - var/datum/status_effect/S = i + for(var/datum/status_effect/S as anything in status_effects) . *= S.interact_speed_modifier() /mob/living/carbon/proc/create_internal_organs() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index c67ee0566913..adaf5c87ec28 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -216,3 +216,8 @@ var/create_area_cooldown var/sound_environment_override = SOUND_ENVIRONMENT_NONE + + var/action_speed_modifier = 1 //Value to multiply action delays by //yogs start: fuck + var/action_speed_adjust = 0 //Value to add or remove to action delays //yogs end + + var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly diff --git a/yogstation/code/modules/spacepods/equipment.dm b/yogstation/code/modules/spacepods/equipment.dm index 54454085cea5..9fded2c8ebd2 100644 --- a/yogstation/code/modules/spacepods/equipment.dm +++ b/yogstation/code/modules/spacepods/equipment.dm @@ -128,7 +128,7 @@ if(istype(A, storage_type) && SP.Adjacent(A)) // For loading ore boxes if(!storage) to_chat(user, span_notice("You begin loading [A] into [SP]'s [src]")) - if(do_after_mob(user, list(A, SP), 40)) + if(do_after(user, 4 SECONDS, A)) storage = A A.forceMove(src) to_chat(user, span_notice("You load [A] into [SP]'s [src]!")) diff --git a/yogstation/code/modules/spacepods/spacepod.dm b/yogstation/code/modules/spacepods/spacepod.dm index 6fae6028cfc5..5e12e48dbacb 100644 --- a/yogstation/code/modules/spacepods/spacepod.dm +++ b/yogstation/code/modules/spacepods/spacepod.dm @@ -483,7 +483,7 @@ GLOBAL_LIST_INIT(spacepods_list, list()) if(hatch_open) to_chat(user, span_warning("The hatch is shut!")) to_chat(user, span_notice("You begin inserting the canister into [src]")) - if(do_after_mob(user, list(A, src), 50) && construction_state == SPACEPOD_ARMOR_WELDED) + if(do_after(user, 5 SECONDS, A) && construction_state == SPACEPOD_ARMOR_WELDED) to_chat(user, span_notice("You insert the canister into [src]")) A.forceMove(src) internal_tank = A @@ -497,7 +497,7 @@ GLOBAL_LIST_INIT(spacepods_list, list()) return if(passengers.len < max_passengers) visible_message(span_danger("[user] starts loading [M] into [src]!")) - if(do_after_mob(user, list(M, src), 50) && construction_state == SPACEPOD_ARMOR_WELDED) + if(do_after(user, 5 SECONDS, M) && construction_state == SPACEPOD_ARMOR_WELDED) add_rider(M, FALSE) return if(M == user) From 715b9e2e71e5a62714bef59c8e4717c416236d3c Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:54:54 -0400 Subject: [PATCH 02/13] Ports TG do_after --- code/__DEFINES/flags.dm | 12 ++ code/__DEFINES/mobs.dm | 6 +- code/__HELPERS/mobs.dm | 86 +++++---- code/datums/components/chasm.dm | 2 +- code/datums/components/storage/storage.dm | 20 +-- code/datums/progressbar.dm | 165 +++++++++++++----- code/datums/wounds/_wounds.dm | 2 +- code/datums/wounds/slash.dm | 2 +- code/game/atoms.dm | 4 +- code/game/machinery/iv_drip.dm | 2 +- code/game/machinery/limbgrower.dm | 2 +- code/game/objects/items/bodybag.dm | 2 +- code/game/objects/items/cardboard_cutouts.dm | 2 +- .../items/devices/busterarm/megabuster.dm | 4 +- code/game/objects/items/mail.dm | 2 +- code/game/objects/items/stacks/medical.dm | 2 +- .../items/stacks/sheets/sheet_types.dm | 2 +- code/game/objects/items/tools/weldingtool.dm | 2 +- code/game/objects/structures/fence.dm | 2 +- code/game/objects/structures/watercloset.dm | 2 +- code/game/turfs/simulated/minerals.dm | 2 +- code/game/turfs/turf.dm | 4 +- .../bloodsuckers/clans/clan_tzimisce.dm | 2 +- .../bloodsuckers/powers/targeted/lunge.dm | 2 +- .../structures/bloodsucker_crypt.dm | 4 +- .../clock_helpers/fabrication_helpers.dm | 2 +- .../antagonists/clockcult/clock_scripture.dm | 2 +- .../clockcult/clock_structures/stargazer.dm | 2 +- code/modules/antagonists/cult/blood_magic.dm | 2 +- .../eldritch_cult/eldritch_book.dm | 4 +- code/modules/antagonists/horror/horror.dm | 6 +- .../horror/horror_abilities_and_upgrades.dm | 2 +- .../revenant/revenant_abilities.dm | 8 +- .../antagonists/space_dragon/carp_rift.dm | 2 +- .../components/unary_devices/cryo.dm | 4 +- .../food_and_drinks/food/snacks_vend.dm | 4 +- code/modules/mining/lavaland/world_anvil.dm | 4 +- code/modules/mob/living/carbon/carbon.dm | 8 +- .../mob/living/carbon/carbon_defense.dm | 2 +- .../mob/living/carbon/human/human_defense.dm | 2 +- code/modules/mob/living/living.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 2 +- .../friendly/drone/interaction.dm | 2 +- .../living/simple_animal/friendly/mouse.dm | 2 +- .../mob/living/simple_animal/hostile/rat.dm | 8 +- code/modules/mob/logout.dm | 1 + code/modules/mob/mob_defines.dm | 1 - code/modules/power/cable.dm | 2 +- .../modules/projectiles/guns/ballistic/bow.dm | 2 +- .../reagents/reagent_containers/blood_pack.dm | 2 +- .../xenobiology/crossbreeding/crystalized.dm | 2 +- code/modules/shuttle/navigation_computer.dm | 2 +- .../spells/spell_types/charged/_charged.dm | 2 +- code/modules/spells/spell_types/hivemind.dm | 20 +-- .../spells/spell_types/self/lichdom.dm | 2 +- code/modules/surgery/anesthesia_machine.dm | 2 +- code/modules/vehicles/sealed.dm | 2 +- .../game/objects/items/holotool/holotool.dm | 2 +- 58 files changed, 259 insertions(+), 190 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index d04a6c5c5a82..742fd376e0be 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -186,3 +186,15 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 /// 33554431 (2^24 - 1) is the maximum value our bitflags can reach. #define MAX_BITFLAG_DIGITS 8 + +// timed_action_flags parameter for `/proc/do_after` +/// Can do the action even if mob moves location +#define IGNORE_USER_LOC_CHANGE (1<<0) +/// Can do the action even if the target moves location +#define IGNORE_TARGET_LOC_CHANGE (1<<1) +/// Can do the action even if the item is no longer being held +#define IGNORE_HELD_ITEM (1<<2) +/// Can do the action even if the mob is incapacitated (ex. handcuffed) +#define IGNORE_INCAPACITATED (1<<3) +/// Used to prevent important slowdowns from being abused by drugs like kronkaine +#define IGNORE_SLOWDOWNS (1<<4) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 5812e0047339..d0742c407caf 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -371,10 +371,10 @@ //this should be in the ai defines, but out ai defines are actual ai, not simplemob ai #define IS_DEAD_OR_INCAP(source) (source.incapacitated() || source.stat) -#define INTERACTING_WITH(X, Y) (Y in X.do_afters) - - #define DOING_INTERACTION(user, interaction_key) (LAZYACCESS(user.do_afters, interaction_key)) +#define DOING_INTERACTION_LIMIT(user, interaction_key, max_interaction_count) ((LAZYACCESS(user.do_afters, interaction_key) || 0) >= max_interaction_count) +#define DOING_INTERACTION_WITH_TARGET(user, target) (LAZYACCESS(user.do_afters, target)) +#define DOING_INTERACTION_WITH_TARGET_LIMIT(user, target, max_interaction_count) ((LAZYACCESS(user.do_afters, target) || 0) >= max_interaction_count) ///Define for spawning megafauna instead of a mob for cave gen #define SPAWN_MEGAFAUNA "bluh bluh huge boss" diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 569bb72de48c..7b1a87beec6b 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -283,18 +283,29 @@ GLOBAL_LIST_EMPTY(species_list) checked_health["health"] = health return ..() -/proc/do_after(mob/user, delay, atom/target = null, needhand = TRUE, progress = TRUE, datum/callback/extra_checks = null, stayStill = TRUE) +/** + * Timed action involving one mob user. Target is optional. + * + * Checks that `user` does not move, change hands, get stunned, etc. for the + * given `delay`. Returns `TRUE` on success or `FALSE` on failure. + * Interaction_key is the assoc key under which the do_after is capped, with max_interact_count being the cap. Interaction key will default to target if not set. + */ +/proc/do_after(mob/user, delay, atom/target, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1) if(!user) return FALSE - var/atom/target_loc = null - if(target && !isturf(target)) - target_loc = target.loc - - if(target) - LAZYADD(user.do_afters, target) - LAZYADD(target.targeted_by, user) + if(!isnum(delay)) + CRASH("do_after was passed a non-number delay: [delay || "null"].") + + if(!interaction_key && target) + interaction_key = target //Use the direct ref to the target + if(interaction_key) //Do we have a interaction_key now? + var/current_interaction_count = LAZYACCESS(user.do_afters, interaction_key) || 0 + if(current_interaction_count >= max_interact_count) //We are at our peak + return + LAZYSET(user.do_afters, interaction_key, current_interaction_count + 1) var/atom/user_loc = user.loc + var/atom/target_loc = target?.loc var/drifting = FALSE if(!user.Process_Spacemove() && user.inertia_dir) @@ -302,63 +313,48 @@ 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 = ((delay + user.action_speed_adjust) * user.action_speed_modifier * user.do_after_coefficent()) //yogs: darkspawn + if(!(timed_action_flags & IGNORE_SLOWDOWNS)) + delay *= user.action_speed_modifier * user.do_after_coefficent() //yogs: darkspawn var/datum/progressbar/progbar - if (progress) - progbar = new(user, delay, target) + if(progress) + progbar = new(user, delay, target || user) + + SEND_SIGNAL(user, COMSIG_DO_AFTER_BEGAN) var/endtime = world.time + delay var/starttime = world.time . = TRUE while (world.time < endtime) stoplag(1) - if (progress) + + if(!QDELETED(progbar)) progbar.update(world.time - starttime) if(drifting && !user.inertia_dir) drifting = FALSE user_loc = user.loc - if(QDELETED(user) || user.stat || (!drifting && user.loc != user_loc && stayStill) || (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) && HAS_TRAIT(user, TRAIT_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(target_loc) && (QDELETED(target) || target_loc != target.loc)) - if((user_loc != target_loc || target_loc != user) && !drifting && stayStill) - . = FALSE - break - - if(target && !(target in user.do_afters)) + if(target && (user != target) && \ + (QDELETED(target) \ + || (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && target.loc != target_loc))) . = 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 (progress) - qdel(progbar) + if(!QDELETED(progbar)) + progbar.end_progress() - if(!QDELETED(target)) - LAZYREMOVE(user.do_afters, target) - LAZYREMOVE(target.targeted_by, user) + if(interaction_key) + LAZYREMOVE(user.do_afters, interaction_key) + SEND_SIGNAL(user, COMSIG_DO_AFTER_ENDED) /proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null) if(!user || !target) @@ -376,7 +372,7 @@ GLOBAL_LIST_EMPTY(species_list) var/target_loc = target.loc var/holding = user.get_active_held_item() - time = ((time + user.action_speed_adjust) * user.action_speed_modifier) //yogs: darkspawn + time *= user.action_speed_modifier //yogs: darkspawn var/datum/progressbar/progbar if (progress) progbar = new(user, time, target) diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index 528b4e74c963..c7f23cb3d589 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -213,7 +213,7 @@ if(!rod.wielded) to_chat(user, span_warning("You need to wield the rod in both hands before you can fish in the chasm!")) return - if(do_after(user, 3 SECONDS, src.parent)) + if(do_after(user, 3 SECONDS, parent)) if(!rod.wielded) return diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 56d1de824a28..bd557a8bd347 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -232,14 +232,12 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) if(!len) to_chat(M, span_notice("You failed to pick up anything with [parent].")) return - var/datum/progressbar/progress = new(M, len, I.loc) var/list/rejections = list() - while(do_after(M, 1 SECONDS, parent, TRUE, FALSE, CALLBACK(src, PROC_REF(handle_mass_pickup), things, I.loc, rejections, progress))) + while(do_after(M, 1 SECONDS, parent, TRUE, FALSE, CALLBACK(src, PROC_REF(handle_mass_pickup), things, I.loc, rejections))) stoplag(1) - qdel(progress) to_chat(M, span_notice("You put everything you could [insert_preposition] [parent].")) -/datum/component/storage/proc/handle_mass_item_insertion(list/things, datum/component/storage/src_object, mob/user, datum/progressbar/progress) +/datum/component/storage/proc/handle_mass_item_insertion(list/things, datum/component/storage/src_object, mob/user) var/atom/source_real_location = src_object.real_location() for(var/obj/item/I in things) things -= I @@ -251,13 +249,11 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) if(can_be_inserted(I,FALSE,user)) handle_item_insertion(I, TRUE, user) if (TICK_CHECK) - progress.update(progress.goal - things.len) return TRUE - progress.update(progress.goal - things.len) return FALSE -/datum/component/storage/proc/handle_mass_pickup(list/things, atom/thing_loc, list/rejections, datum/progressbar/progress) +/datum/component/storage/proc/handle_mass_pickup(list/things, atom/thing_loc, list/rejections) var/atom/real_location = real_location() for(var/obj/item/I in things) things -= I @@ -274,10 +270,8 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) handle_item_insertion(I, TRUE) //The TRUE stops the "You put the [parent] into [S]" insertion message from being displayed. if (TICK_CHECK) - progress.update(progress.goal - things.len) return TRUE - progress.update(progress.goal - things.len) return FALSE /datum/component/storage/proc/quick_empty(mob/M) @@ -291,12 +285,10 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) to_chat(M, span_notice("You start dumping out [parent].")) var/turf/T = get_turf(A) var/list/things = contents() - var/datum/progressbar/progress = new(M, length(things), T) - while (do_after(M, 1 SECONDS, T, TRUE, FALSE, CALLBACK(src, PROC_REF(mass_remove_from_storage), T, things, progress))) + while (do_after(M, 1 SECONDS, T, TRUE, FALSE, CALLBACK(src, PROC_REF(mass_remove_from_storage), T, things))) stoplag(1) - qdel(progress) -/datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress, trigger_on_found = TRUE) +/datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, trigger_on_found = TRUE) var/atom/real_location = real_location() for(var/obj/item/I in things) things -= I @@ -306,9 +298,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) if(trigger_on_found && I.on_found()) return FALSE if(TICK_CHECK) - progress.update(progress.goal - length(things)) return TRUE - progress.update(progress.goal - length(things)) return FALSE /datum/component/storage/proc/do_quick_empty(atom/_target) diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index 6fa60c86d3b8..e3f56dc3cbb9 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -1,67 +1,142 @@ #define PROGRESSBAR_HEIGHT 6 +#define PROGRESSBAR_ANIMATION_TIME 5 /datum/progressbar - var/goal = 1 + ///The progress bar visual element. var/image/bar - var/shown = 0 + ///The target where this progress bar is applied and where it is shown. + var/atom/bar_loc + ///The mob whose client sees the progress bar. var/mob/user - var/client/client - var/listindex + ///The client seeing the progress bar. + var/client/user_client + ///Effectively the number of steps the progress bar will need to do before reaching completion. + var/goal = 1 + ///Control check to see if the progress was interrupted before reaching its goal. + var/last_progress = 0 + ///Variable to ensure smooth visual stacking on multiple progress bars. + var/listindex = 0 + /datum/progressbar/New(mob/User, goal_number, atom/target) . = ..() if (!istype(target)) - EXCEPTION("Invalid target given") - if (goal_number) - goal = goal_number - bar = image('icons/effects/progessbar.dmi', target, "prog_bar_0", HUD_LAYER) - bar.plane = ABOVE_HUD_PLANE + stack_trace("Invalid target [target] passed in") + qdel(src) + return + if(QDELETED(User) || !istype(User)) + stack_trace("/datum/progressbar created with [isnull(User) ? "null" : "invalid"] user") + qdel(src) + return + if(!isnum(goal_number)) + stack_trace("/datum/progressbar created with [isnull(User) ? "null" : "invalid"] goal_number") + qdel(src) + return + goal = goal_number + bar_loc = target + bar = image('icons/effects/progessbar.dmi', bar_loc, "prog_bar_0") + bar.plane = ABOVE_HUD_PLANE //SET_PLANE_EXPLICIT(bar, ABOVE_HUD_PLANE, User) //comment in when we port TG planes bar.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA user = User - if(user) - client = user.client - LAZYINITLIST(user.progressbars) - LAZYINITLIST(user.progressbars[bar.loc]) - var/list/bars = user.progressbars[bar.loc] - bars.Add(src) + LAZYADDASSOC(user.progressbars, bar_loc, src) //TODO: LAZYADDASSOCLIST + var/list/bars = user.progressbars[bar_loc] listindex = bars.len - bar.pixel_y = 32 + (PROGRESSBAR_HEIGHT * (listindex - 1)) -/datum/progressbar/proc/update(progress) - if (!user || !user.client) - shown = 0 + if(user.client) + user_client = user.client + add_prog_bar_image_to_client() + + RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(on_user_delete)) + RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(clean_user_client)) + RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(on_user_login)) + + +/datum/progressbar/Destroy() + if(user) + for(var/pb in user.progressbars[bar_loc]) + var/datum/progressbar/progress_bar = pb + if(progress_bar == src || progress_bar.listindex <= listindex) + continue + progress_bar.listindex-- + + progress_bar.bar.pixel_y = 32 + (PROGRESSBAR_HEIGHT * (progress_bar.listindex - 1)) + var/dist_to_travel = 32 + (PROGRESSBAR_HEIGHT * (progress_bar.listindex - 1)) - PROGRESSBAR_HEIGHT + animate(progress_bar.bar, pixel_y = dist_to_travel, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING) + + LAZYREMOVEASSOC(user.progressbars, bar_loc, src) + user = null + + if(user_client) + clean_user_client() + + bar_loc = null + + if(bar) + QDEL_NULL(bar) + + return ..() + + +///Called right before the user's Destroy() +/datum/progressbar/proc/on_user_delete(datum/source) + SIGNAL_HANDLER + + user.progressbars = null //We can simply nuke the list and stop worrying about updating other prog bars if the user itself is gone. + user = null + qdel(src) + + +///Removes the progress bar image from the user_client and nulls the variable, if it exists. +/datum/progressbar/proc/clean_user_client(datum/source) + SIGNAL_HANDLER + + if(!user_client) //Disconnected, already gone. return - if (user.client != client) - if (client) - client.images -= bar - if (user.client) - user.client.images += bar + user_client.images -= bar + user_client = null + + +///Called by user's Login(), it transfers the progress bar image to the new client. +/datum/progressbar/proc/on_user_login(datum/source) + SIGNAL_HANDLER + + if(user_client) + if(user_client == user.client) //If this was not client handling I'd condemn this sanity check. But clients are fickle things. + return + clean_user_client() + if(!user.client) //Clients can vanish at any time, the bastards. + return + user_client = user.client + add_prog_bar_image_to_client() + +///Adds a smoothly-appearing progress bar image to the player's screen. +/datum/progressbar/proc/add_prog_bar_image_to_client() + bar.pixel_y = 0 + bar.alpha = 0 + user_client.images += bar + animate(bar, pixel_y = 32 + (PROGRESSBAR_HEIGHT * (listindex - 1)), alpha = 255, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING) + + +///Updates the progress bar image visually. +/datum/progressbar/proc/update(progress) progress = clamp(progress, 0, goal) + if(progress == last_progress) + return + last_progress = progress bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]" - if (!shown) - user.client.images += bar - shown = 1 -/datum/progressbar/proc/shiftDown() - --listindex - bar.pixel_y -= PROGRESSBAR_HEIGHT -/datum/progressbar/Destroy() - for(var/I in user.progressbars[bar.loc]) - var/datum/progressbar/P = I - if(P != src && P.listindex > listindex) - P.shiftDown() - - var/list/bars = user.progressbars[bar.loc] - bars.Remove(src) - if(!bars.len) - LAZYREMOVE(user.progressbars, bar.loc) - - if (client) - client.images -= bar - qdel(bar) - . = ..() +///Called on progress end, be it successful or a failure. Wraps up things to delete the datum and bar. +/datum/progressbar/proc/end_progress() + if(last_progress != goal) + bar.icon_state = "[bar.icon_state]_fail" + + animate(bar, alpha = 0, time = PROGRESSBAR_ANIMATION_TIME) + + QDEL_IN(src, PROGRESSBAR_ANIMATION_TIME) + +#undef PROGRESSBAR_ANIMATION_TIME #undef PROGRESSBAR_HEIGHT diff --git a/code/datums/wounds/_wounds.dm b/code/datums/wounds/_wounds.dm index 5f72f9dc924c..7bb68b832bf2 100644 --- a/code/datums/wounds/_wounds.dm +++ b/code/datums/wounds/_wounds.dm @@ -287,7 +287,7 @@ return FALSE // now that we've determined we have a valid attempt at treating, we can stomp on their dreams if we're already interacting with the patient - if(INTERACTING_WITH(user, victim)) + if(DOING_INTERACTION_WITH_TARGET(user, victim)) to_chat(user, span_warning("You're already interacting with [victim]!")) return TRUE diff --git a/code/datums/wounds/slash.dm b/code/datums/wounds/slash.dm index f4dc664e1b5c..4b5473377bca 100644 --- a/code/datums/wounds/slash.dm +++ b/code/datums/wounds/slash.dm @@ -167,7 +167,7 @@ user.visible_message(span_warning("[user] begins aiming [lasgun] directly at [victim]'s [limb.name]..."), span_userdanger("You begin aiming [lasgun] directly at [user == victim ? "your" : "[victim]'s"] [limb.name]...")) playsound(lasgun, 'sound/surgery/cautery1.ogg', 75, TRUE, falloff_exponent = 1) - if(!do_after(user, base_treat_time * self_penalty_mult, victim, extra_checks = CALLBACK(src, PROC_REF(still_exists)))) + if(!do_after(user, base_treat_time * self_penalty_mult, victim, extra_checks = CALLBACK(src, PROC_REF(still_exists)))) return playsound(lasgun, 'sound/surgery/cautery2.ogg', 75, TRUE, falloff_exponent = 1) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 7ab71e2f9895..58e5c2586b45 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -861,16 +861,14 @@ */ /atom/proc/component_storage_contents_dump_act(datum/component/storage/src_object, mob/user) var/list/things = src_object.contents() - var/datum/progressbar/progress = new(user, things.len, src) var/datum/component/storage/STR = GetComponent(/datum/component/storage) //yogs start -- stops things from dumping into themselves if(STR == src_object) to_chat(user,span_warning("You can't dump the contents of [src_object.parent] into itself!")) return //yogs end - while (do_after(user, 1 SECONDS, src, TRUE, FALSE, CALLBACK(STR, TYPE_PROC_REF(/datum/component/storage, handle_mass_item_insertion), things, src_object, user, progress))) + while (do_after(user, 1 SECONDS, src, TRUE, FALSE, CALLBACK(STR, TYPE_PROC_REF(/datum/component/storage, handle_mass_item_insertion), things, src_object, user))) stoplag(1) - qdel(progress) to_chat(user, span_notice("You dump as much of [src_object.parent]'s contents into [STR.insert_preposition]to [src] as you can.")) STR.orient2hud(user) src_object.orient2hud(user) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 973a57d639d5..b968a7ecfe49 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -236,7 +236,7 @@ . = ..() if(user.is_holding_item_of_type(/obj/item/clothing/mask/breath) && can_convert) visible_message("[user] attempts to attach the breath mask to [src].", "You attempt to attach the breath mask to [src].") - if(!do_after(user, 10 SECONDS, src, FALSE)) + if(!do_after(user, 10 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(user, "You fail to attach the breath mask to [src]!") return var/item = user.is_holding_item_of_type(/obj/item/clothing/mask/breath) diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 50a6847414dd..0c0a1d3548a8 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -137,7 +137,7 @@ "You hear the clatter of a floppy drive.") busy = TRUE var/obj/item/disk/design_disk/limbs/limb_design_disk = user_item - if(do_after(user, 2 SECONDS, target = src)) + if(do_after(user, 2 SECONDS, src)) for(var/datum/design/found_design in limb_design_disk.blueprints) stored_research.add_design(found_design) update_static_data(user) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 4946fe32939b..29f8225c462a 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -84,7 +84,7 @@ user.last_special = world.time + CLICK_CD_BREAKOUT to_chat(user, span_notice("You claw at the fabric of [src], trying to tear it open...")) to_chat(loc, span_warning("Someone starts trying to break free of [src]!")) - if(!do_after(user, 5 SECONDS, src, stayStill = FALSE)) + if(!do_after(user, 5 SECONDS, src, timed_action_flags = IGNORE_USER_LOC_CHANGE)) to_chat(loc, span_warning("The pressure subsides. It seems that they've stopped resisting...")) return loc.visible_message(span_warning("[user] suddenly appears in front of [loc]!"), span_userdanger("[user] breaks free of [src]!")) diff --git a/code/game/objects/items/cardboard_cutouts.dm b/code/game/objects/items/cardboard_cutouts.dm index 413d1520ef9c..e930f0ebb99f 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_REF(check_menu), user, crayon), radius = 36, require_near = TRUE) if(!new_appearance) return FALSE - if(!do_after(user, 1 SECONDS, src, FALSE)) + if(!do_after(user, 1 SECONDS, src, timed_action_flags = IGNORE_USER_LOC_CHANGE)) return FALSE if(!check_menu(user, crayon)) return FALSE diff --git a/code/game/objects/items/devices/busterarm/megabuster.dm b/code/game/objects/items/devices/busterarm/megabuster.dm index f57ff35dc506..ddee326e555b 100644 --- a/code/game/objects/items/devices/busterarm/megabuster.dm +++ b/code/game/objects/items/devices/busterarm/megabuster.dm @@ -18,7 +18,7 @@ var/obj/item/buster/megabuster/B = new() owner.visible_message(span_userdanger("[owner]'s left arm begins crackling loudly!")) playsound(owner,'sound/effects/beepskyspinsabre.ogg', 60, 1) - if(do_after(owner, 2 SECONDS, owner, TRUE, stayStill = FALSE)) + if(do_after(owner, 2 SECONDS, owner, timed_action_flags = IGNORE_USER_LOC_CHANGE)) if(!owner.put_in_l_hand(B)) to_chat(owner, span_warning("You can't do this with your left hand full!")) else @@ -32,7 +32,7 @@ var/obj/item/buster/megabuster/B = new() owner.visible_message(span_userdanger("[owner]'s right arm begins crackling loudly!")) playsound(owner,'sound/effects/beepskyspinsabre.ogg', 60, 1) - if(do_after(owner, 2 SECONDS, owner, TRUE, stayStill = FALSE)) + if(do_after(owner, 2 SECONDS, owner, timed_action_flags = IGNORE_USER_LOC_CHANGE)) if(!owner.put_in_r_hand(B)) to_chat(owner, span_warning("You can't do this with your right hand full!")) else diff --git a/code/game/objects/items/mail.dm b/code/game/objects/items/mail.dm index 37d8230b04b1..147038b8c8c8 100644 --- a/code/game/objects/items/mail.dm +++ b/code/game/objects/items/mail.dm @@ -120,7 +120,7 @@ recipient_real = recipient // This will be truthy if recipient resolved successfully to_chat(user, span_notice("You start to unwrap the package...")) - if(!do_after(user, 1.5 SECONDS, target = user)) + if(!do_after(user, 1.5 SECONDS, user)) return user.temporarilyRemoveItemFromInventory(src, TRUE) for (var/content in contents) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 134bc9576018..928e3b74990c 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -46,7 +46,7 @@ /obj/item/stack/medical/proc/try_heal(mob/living/M, mob/user, silent = FALSE) if(!M.can_inject(user, TRUE)) return - if(INTERACTING_WITH(user, M)) + if(DOING_INTERACTION_WITH_TARGET(user, M)) return if(M == user) playsound(src, pick(apply_sounds), 25) diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 51c111dd47dc..16a5493cbe51 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -284,7 +284,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \ span_hear("You hear wood carving."), ) // 5 Second Timer - if(!do_after(user, 5 SECONDS, src, NONE, TRUE)) + if(!do_after(user, 5 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM)) return // Make Stake var/obj/item/stake/new_item = new(user.loc) diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 1a3b98762402..2b8461e3d0d1 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -122,7 +122,7 @@ if(affecting.brute_dam <= 0) to_chat(user, span_warning("[affecting] is already in good condition!")) return FALSE - if(INTERACTING_WITH(user, H)) + if(DOING_INTERACTION_WITH_TARGET(user, H)) return FALSE if(!tool_start_check(user, 1)) return FALSE diff --git a/code/game/objects/structures/fence.dm b/code/game/objects/structures/fence.dm index 858181cf5812..f26ded20a439 100644 --- a/code/game/objects/structures/fence.dm +++ b/code/game/objects/structures/fence.dm @@ -73,7 +73,7 @@ user.visible_message(span_danger("\The [user] starts cutting through \the [src] with \the [W]."),\ span_danger("You start cutting through \the [src] with \the [W].")) - if(do_after(user, CUT_TIME*W.toolspeed, src)) + if(do_after(user, CUT_TIME * W.toolspeed, src)) if(current_stage == hole_size) switch(++hole_size) if(MEDIUM_HOLE) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index d722f58b6d44..5b6910eb8557 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -38,7 +38,7 @@ if(open) GM.visible_message(span_danger("[user] starts to give [GM] a swirlie!"), span_userdanger("[user] starts to give you a swirlie...")) swirlie = GM - if(do_after(user, 3 SECONDS, src, FALSE)) + if(do_after(user, 3 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM)) GM.visible_message(span_danger("[user] gives [GM] a swirlie!"), span_userdanger("[user] gives you a swirlie!"), span_italics("You hear a toilet flushing.")) if(iscarbon(GM)) var/mob/living/carbon/C = GM diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 81d2c8607eeb..9652f25bf508 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -56,7 +56,7 @@ if (!isturf(T)) return - if(INTERACTING_WITH(user, src))//prevents message spam + if(DOING_INTERACTION(user, src))//prevents message spam return to_chat(user, span_notice("You start picking...")) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 7dd6c1b46906..700148b30748 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -373,10 +373,8 @@ GLOBAL_LIST_EMPTY(station_turfs) return FALSE var/list/things = src_object.contents() - var/datum/progressbar/progress = new(user, things.len, src) - while (do_after(usr, 1 SECONDS, src, TRUE, FALSE, CALLBACK(src_object, TYPE_PROC_REF(/datum/component/storage, mass_remove_from_storage), src, things, progress))) + while (do_after(usr, 1 SECONDS, src, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src_object, TYPE_PROC_REF(/datum/component/storage, mass_remove_from_storage), src, things))) stoplag(1) - qdel(progress) return TRUE diff --git a/code/modules/antagonists/bloodsuckers/clans/clan_tzimisce.dm b/code/modules/antagonists/bloodsuckers/clans/clan_tzimisce.dm index d938dd386fc1..6385291432e5 100644 --- a/code/modules/antagonists/bloodsuckers/clans/clan_tzimisce.dm +++ b/code/modules/antagonists/bloodsuckers/clans/clan_tzimisce.dm @@ -30,4 +30,4 @@ INVOKE_ASYNC(vassal, TYPE_PROC_REF(/mob/, set_species), /datum/species/szlachta) /datum/bloodsucker_clan/tzimisce/proc/slash_vassal(mob/living/bloodsucker, time, mob/living/vassal) - do_after(bloodsucker, time, vassal, FALSE, TRUE, null, FALSE) //necessary becaues of how signal handler works + do_after(bloodsucker, time, vassal, timed_action_flags = IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM) //necessary becaues of how signal handler works diff --git a/code/modules/antagonists/bloodsuckers/powers/targeted/lunge.dm b/code/modules/antagonists/bloodsuckers/powers/targeted/lunge.dm index 6a99d935978f..a431e7c234f1 100644 --- a/code/modules/antagonists/bloodsuckers/powers/targeted/lunge.dm +++ b/code/modules/antagonists/bloodsuckers/powers/targeted/lunge.dm @@ -92,7 +92,7 @@ var/x_offset = base_x + rand(-3, 3) var/y_offset = base_y + rand(-3, 3) animate(pixel_x = x_offset, pixel_y = y_offset, time = 0.1 SECONDS) - if(!do_after(owner, 4 SECONDS, stayStill = FALSE, extra_checks = CALLBACK(src, PROC_REF(CheckCanTarget), target_atom))) + if(!do_after(owner, 4 SECONDS, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(CheckCanTarget), target_atom))) end_target_lunge(base_x, base_y) return FALSE diff --git a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm index dc97c45bdeb4..0053aeace628 100644 --- a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm +++ b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm @@ -256,7 +256,7 @@ /obj/effect/reality_smash/attack_hand(mob/user, list/modifiers) // this is important if(!IS_BLOODSUCKER(user)) //only bloodsucker will attack this with their hand return - if(INTERACTING_WITH(user, src)) + if(DOING_INTERACTION(user, src)) return if(user.mind in src.siphoners) balloon_alert(user, "already harvested!") @@ -858,7 +858,7 @@ */ /obj/structure/bloodsucker/vassalrack/proc/torture_victim(mob/living/user, mob/living/target) - if(INTERACTING_WITH(user, target)) + if(DOING_INTERACTION(user, target)) balloon_alert(user, "already interacting!") return var/datum/antagonist/bloodsucker/bloodsuckerdatum = user.mind.has_antag_datum(/datum/antagonist/bloodsucker) diff --git a/code/modules/antagonists/clockcult/clock_helpers/fabrication_helpers.dm b/code/modules/antagonists/clockcult/clock_helpers/fabrication_helpers.dm index c76cce3b168c..ae59d44446b0 100644 --- a/code/modules/antagonists/clockcult/clock_helpers/fabrication_helpers.dm +++ b/code/modules/antagonists/clockcult/clock_helpers/fabrication_helpers.dm @@ -307,7 +307,7 @@ user.visible_message(span_notice("[user]'s [fabricator.name] starts covering [src == user ? "[user.p_them()]" : "[src]"] in glowing orange energy..."), \ span_alloy("You start repairing [src == user ? "yourself" : "[src]"]...")) fabricator.repairing = src - if(do_after(user, (maxHealth - health)*2, src)) + if(do_after(user, (maxHealth - health) * 2, src)) adjustHealth(-maxHealth) user.visible_message(span_notice("[user]'s [fabricator.name] stops covering [src == user ? "[user.p_them()]" : "[src]"] with glowing orange energy."), \ span_alloy("You finish repairing [src == user ? "yourself" : "[src]"].")) diff --git a/code/modules/antagonists/clockcult/clock_scripture.dm b/code/modules/antagonists/clockcult/clock_scripture.dm index 4d02e411a297..e7f387caa80a 100644 --- a/code/modules/antagonists/clockcult/clock_scripture.dm +++ b/code/modules/antagonists/clockcult/clock_scripture.dm @@ -158,7 +158,7 @@ GLOBAL_LIST_INIT(scripture_states,scripture_states_init_value()) //list of clock if(chant_slowdown) invoker.add_movespeed_modifier(MOVESPEED_ID_CLOCKCHANT, update=TRUE, priority=100, multiplicative_slowdown=chant_slowdown) chant() - if(!do_after(invoker, channel_time, invoker, extra_checks = CALLBACK(src, PROC_REF(check_special_requirements)), stayStill = no_mobility)) + if(!do_after(invoker, channel_time, invoker, timed_action_flags = (no_mobility ? IGNORE_USER_LOC_CHANGE : NONE), extra_checks = CALLBACK(src, PROC_REF(check_special_requirements)))) slab.busy = null invoker.remove_movespeed_modifier(MOVESPEED_ID_CLOCKCHANT) chanting = FALSE diff --git a/code/modules/antagonists/clockcult/clock_structures/stargazer.dm b/code/modules/antagonists/clockcult/clock_structures/stargazer.dm index e0d2fd622aef..729b95052f15 100644 --- a/code/modules/antagonists/clockcult/clock_structures/stargazer.dm +++ b/code/modules/antagonists/clockcult/clock_structures/stargazer.dm @@ -108,7 +108,7 @@ to_chat(user, "[I] has already been enhanced!") return to_chat(user, "You begin placing [I] onto [src].") - if(do_after(user, 60, target=I)) + if(do_after(user, 60, I)) if(cooldowntime > world.time) to_chat(user, "[src] is still warming up, it will be ready in [DisplayTimeText(cooldowntime - world.time)].") return diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 9e01314bf471..83e4b9a3711e 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -76,7 +76,7 @@ else to_chat(owner, span_cultitalic("You are already invoking blood magic!")) return - if(do_after(owner, 100 - rune*60, target = owner)) + if(do_after(owner, (100 - rune * 60), owner)) if(ishuman(owner)) var/mob/living/carbon/human/H = owner H.bleed(40 - rune*32) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_book.dm b/code/modules/antagonists/eldritch_cult/eldritch_book.dm index 041b056a6533..f75641012013 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_book.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_book.dm @@ -33,7 +33,7 @@ if(istype(target,/obj/effect/eldritch)) remove_rune(target,user) if(istype(target,/obj/effect/reality_smash)) - if(!INTERACTING_WITH(user, target)) + if(!DOING_INTERACTION(user, target)) get_power_from_influence(target,user) if(istype(target,/turf/open)) draw_rune(target,user) @@ -54,7 +54,7 @@ ///Gives you a charge and destroys a corresponding influence /obj/item/forbidden_book/proc/get_power_from_influence(atom/target, mob/user) var/obj/effect/reality_smash/RS = target - if(INTERACTING_WITH(user, RS)) + if(DOING_INTERACTION(user, RS)) return if(user.mind in RS.siphoners) to_chat(user, span_danger("You have already studied this influence!")) diff --git a/code/modules/antagonists/horror/horror.dm b/code/modules/antagonists/horror/horror.dm index c077161477d8..475b87cbd314 100644 --- a/code/modules/antagonists/horror/horror.dm +++ b/code/modules/antagonists/horror/horror.dm @@ -212,7 +212,7 @@ return to_chat(src, "You begin consuming [victim.name]'s soul!") - if(do_after(src, 30 SECONDS, victim, stayStill = FALSE)) + if(do_after(src, 30 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE)) consume() /mob/living/simple_animal/horror/proc/consume() @@ -532,7 +532,7 @@ to_chat(victim, span_userdanger("An odd, uncomfortable pressure begins to build inside your skull, behind your ear...")) leaving = TRUE - if(do_after(src, 10 SECONDS, victim, extra_checks = CALLBACK(src, PROC_REF(is_leaving)), stayStill = FALSE)) + if(do_after(src, 10 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_leaving)))) release_host() /mob/living/simple_animal/horror/proc/release_host() @@ -724,7 +724,7 @@ var/delay = 20 SECONDS if(has_upgrade("fast_control")) delay -= 12 SECONDS - if(do_after(src, delay, victim, extra_checks = CALLBACK(src, PROC_REF(is_bonding)), stayStill = FALSE)) + if(do_after(src, delay, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_bonding)))) assume_control() /mob/living/simple_animal/horror/proc/assume_control() diff --git a/code/modules/antagonists/horror/horror_abilities_and_upgrades.dm b/code/modules/antagonists/horror/horror_abilities_and_upgrades.dm index 3db16153f14a..090af213248b 100644 --- a/code/modules/antagonists/horror/horror_abilities_and_upgrades.dm +++ b/code/modules/antagonists/horror/horror_abilities_and_upgrades.dm @@ -265,7 +265,7 @@ delay = 3 SECONDS transferring = TRUE - if(!do_after(B.victim, delay, C, extra_checks = CALLBACK(src, PROC_REF(is_transferring), C), stayStill = FALSE)) + if(!do_after(B.victim, delay, C, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_transferring), C))) to_chat(owner, span_warning("As [C] moves away, your transfer gets interrupted!")) transferring = FALSE return diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index c32ebe515243..11dc42ca2e27 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, span_revennotice("You search for the soul of [target].")) - if(do_after(src, rand(10, 20), target, FALSE)) //did they get deleted in that second? + if(do_after(src, rand(10, 20), target, timed_action_flags = IGNORE_HELD_ITEM)) //did they get deleted in that second? if(target.ckey) to_chat(src, span_revennotice("[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, span_revennotice("[target.p_their(TRUE)] soul is weak and faltering.")) - if(do_after(src, rand(15, 20), target, FALSE)) //did they get deleted NOW? + if(do_after(src, rand(15, 20), target, timed_action_flags = IGNORE_HELD_ITEM)) //did they get deleted NOW? switch(essence_drained) if(1 to 30) to_chat(src, span_revennotice("[target] will not yield much essence. Still, every bit counts.")) @@ -50,7 +50,7 @@ to_chat(src, span_revenboldnotice("Such a feast! [target] will yield much essence to you.")) if(90 to INFINITY) to_chat(src, span_revenbignotice("Ah, the perfect soul. [target] will yield massive amounts of essence to you.")) - if(do_after(src, rand(15, 25), target, FALSE)) //how about now + if(do_after(src, rand(15, 25), target, timed_action_flags = IGNORE_HELD_ITEM)) //how about now if(!target.stat) to_chat(src, span_revenwarning("[target.p_theyre(TRUE)] now powerful enough to fight off your draining.")) to_chat(target, span_boldannounce("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, 4.6 SECONDS, target, FALSE)) //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, 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/antagonists/space_dragon/carp_rift.dm b/code/modules/antagonists/space_dragon/carp_rift.dm index 54ba54b02fbe..044372255569 100644 --- a/code/modules/antagonists/space_dragon/carp_rift.dm +++ b/code/modules/antagonists/space_dragon/carp_rift.dm @@ -30,7 +30,7 @@ owner.balloon_alert(dragon, "needs stable ground!") return owner.balloon_alert(owner, "opening rift...") - if(!do_after(owner, 10 SECONDS, target = owner)) + if(!do_after(owner, 10 SECONDS, owner)) return if(locate(/obj/structure/carp_rift) in owner.loc) return diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 6a83acd81b7c..a4c4200928fd 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -336,7 +336,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics user.visible_message("You see [user] kicking against the glass of [src]!", \ "You struggle inside [src], kicking the release with your foot... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a thump from [src].") - if(do_after(user, breakout_time, target = src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src ) return user.visible_message("[user] successfully broke out of [src]!", \ @@ -362,7 +362,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics close_machine(target) else user.visible_message("[user] starts shoving [target] inside [src].", "You start shoving [target] inside [src].") - if (do_after(user, 25, target=target)) + if (do_after(user, 25, target)) close_machine(target) /obj/machinery/atmospherics/components/unary/cryo_cell/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/food_and_drinks/food/snacks_vend.dm b/code/modules/food_and_drinks/food/snacks_vend.dm index 2bbb184f8a9b..9eee8f39fe90 100644 --- a/code/modules/food_and_drinks/food/snacks_vend.dm +++ b/code/modules/food_and_drinks/food/snacks_vend.dm @@ -177,10 +177,10 @@ opened = TRUE else if(!searched) - if(INTERACTING_WITH(user, src)) + if(DOING_INTERACTION(user, src)) return to_chat(user, span_warning("You start searching for the toy...")) - if(!do_after(user, 1.5 SECONDS, target = src)) + if(!do_after(user, 1.5 SECONDS, src)) return if(prob(50)) switch(rand(1,2)) diff --git a/code/modules/mining/lavaland/world_anvil.dm b/code/modules/mining/lavaland/world_anvil.dm index 05673d281cd4..cce2074a52ff 100644 --- a/code/modules/mining/lavaland/world_anvil.dm +++ b/code/modules/mining/lavaland/world_anvil.dm @@ -53,7 +53,7 @@ var/success = FALSE switch(I.type) if(/obj/item/magmite) - if(do_after(user,10 SECONDS, target = src)) + if(do_after(user, 10 SECONDS, src)) new /obj/item/magmite_parts(get_turf(src)) qdel(I) to_chat(user, "You carefully forge the rough plasma magmite into plasma magmite upgrade parts.") @@ -63,7 +63,7 @@ if(!parts.inert) to_chat(user,"The magmite upgrade parts are already glowing and usable!") return - if(do_after(user,5 SECONDS, target = src)) + if(do_after(user, 5 SECONDS, src)) parts.restore() to_chat(user, "You successfully reheat the magmite upgrade parts. They are now glowing and usable again.") if(!success) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 834095a16f46..5b93b73fff03 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -283,7 +283,7 @@ return var/time_taken = I.embedding.embedded_unsafe_removal_time*I.w_class usr.visible_message(span_warning("[usr] attempts to remove [I] from [usr.p_their()] [L.name]."),span_notice("You attempt to remove [I] from your [L.name]... (It will take [DisplayTimeText(time_taken)].)")) - if(do_after(usr, time_taken, needhand = 1, target = src)) + if(do_after(usr, time_taken, target = src)) if(!I || !L || I.loc != src) return var/damage_amount = I.embedding.embedded_unsafe_removal_pain_multiplier * I.w_class @@ -310,7 +310,7 @@ buckle_cd = O.breakouttime visible_message(span_warning("[src] attempts to unbuckle [p_them()]self!"), \ span_notice("You attempt to unbuckle yourself... (This will take around [round(buckle_cd/10,1)] second\s, and you need to stay still.)")) - if(do_after(src, buckle_cd, src, FALSE)) + if(do_after(src, buckle_cd, src, timed_action_flags = IGNORE_HELD_ITEM)) if(!buckled) return buckled.user_unbuckle_mob(src,src) @@ -361,7 +361,7 @@ if(!cuff_break) visible_message(span_warning("[src] attempts to remove [I]!")) to_chat(src, span_notice("You attempt to remove [I]... (This will take around [DisplayTimeText(breakouttime)] and you need to stand still.)")) - if(do_after(src, breakouttime, src, FALSE)) + if(do_after(src, breakouttime, src, timed_action_flags = IGNORE_HELD_ITEM)) clear_cuffs(I, cuff_break) else to_chat(src, span_warning("You fail to remove [I]!")) @@ -370,7 +370,7 @@ breakouttime = 5 SECONDS visible_message(span_warning("[src] is trying to break [I]!")) to_chat(src, span_notice("You attempt to break [I]... (This will take around 5 seconds and you need to stand still.)")) - if(do_after(src, breakouttime, src, FALSE)) + if(do_after(src, breakouttime, src, timed_action_flags = IGNORE_HELD_ITEM)) clear_cuffs(I, cuff_break) else to_chat(src, span_warning("You fail to break [I]!")) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index dddace248ac9..2847b35713d6 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -155,7 +155,7 @@ return var/time_taken = choice.embedding.embedded_unsafe_removal_time * choice.w_class user.visible_message(span_warning("[user] attempts to remove [choice] from [user.p_their()] [body_part.name]."),span_notice("You attempt to remove [choice] from your [body_part.name]... (It will take [DisplayTimeText(time_taken)].)")) - if(!do_after(user, time_taken, needhand = 1, target = src) && !(choice in body_part.embedded_objects)) + if(!do_after(user, time_taken, target = src) && !(choice in body_part.embedded_objects)) return if(remove_embedded_object(choice, get_turf(src), unsafe = TRUE) && !QDELETED(choice)) user.put_in_hands(choice) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index c576f2fdebff..acd48d01bdf3 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -730,7 +730,7 @@ if(src == M) if(has_status_effect(STATUS_EFFECT_CHOKINGSTRAND)) to_chat(src, span_notice("You attempt to remove the durathread strand from around your neck.")) - if(do_after(src, 3.5 SECONDS, src, FALSE)) + if(do_after(src, 3.5 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(src, span_notice("You succesfuly remove the durathread strand.")) remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index b643652df0d1..f036a920f4a7 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -461,7 +461,7 @@ if(!resting) set_resting(TRUE, FALSE) else - if(do_after(src, 1 SECONDS, src, stayStill = FALSE)) + if(do_after(src, 1 SECONDS, src, timed_action_flags = IGNORE_USER_LOC_CHANGE)) set_resting(FALSE, FALSE) else to_chat(src, span_notice("You fail to get up.")) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 44a130b2fa51..dfab64ff92b1 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1274,7 +1274,7 @@ M.visible_message(span_boldwarning("Unfortunately, [M] just can't seem to hold onto [src]!")) return M.visible_message(span_warning("[M] begins to [M == usr ? "climb onto" : "be buckled to"] [src]...")) - var/_target = usr == M ? src : M + var/_target = (usr == M) ? src : M if(!do_after(usr, 0.75 SECONDS, _target)) M.visible_message(span_boldwarning("[M] was prevented from buckling to [src]!")) return 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 be4eb208727a..f107094745c8 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(span_notice("[D] begins to cannibalize parts from [src]."), span_notice("You begin to cannibalize parts from [src]...")) - if(do_after(D, 6 SECONDS, src, FALSE)) + if(do_after(D, 6 SECONDS, src, timed_action_flags = IGNORE_HELD_ITEM)) D.visible_message(span_notice("[D] repairs itself using [src]'s remains!"), span_notice("You repair yourself using [src]'s remains.")) D.adjustBruteLoss(-src.maxHealth) new /obj/effect/decal/cleanable/oil/streak(get_turf(src)) diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 1a939259f0f5..d61cadc78645 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -204,7 +204,7 @@ GLOBAL_VAR_INIT(mouse_killed, 0) eating = TRUE layer = MOB_LAYER visible_message(span_danger("[src] starts eating away [A]..."),span_notice("You start eating the [A]...")) - if(do_after(src, 3 SECONDS, A, FALSE)) + if(do_after(src, 3 SECONDS, A, timed_action_flags = IGNORE_HELD_ITEM)) if(QDELETED(A)) return visible_message(span_danger("[src] finishes eating up [A]!"),span_notice("You finish up eating [A].")) diff --git a/code/modules/mob/living/simple_animal/hostile/rat.dm b/code/modules/mob/living/simple_animal/hostile/rat.dm index d7ff628709cd..c04b35155693 100644 --- a/code/modules/mob/living/simple_animal/hostile/rat.dm +++ b/code/modules/mob/living/simple_animal/hostile/rat.dm @@ -128,7 +128,7 @@ return FALSE layer = MOB_LAYER visible_message(span_danger("[src] starts eating away [A]..."),span_notice("You start eating the [A]...")) - if(do_after(src, 3 SECONDS, A, FALSE)) + if(do_after(src, 3 SECONDS, A, timed_action_flags = IGNORE_HELD_ITEM)) if(QDELETED(A)) return visible_message(span_danger("[src] finishes eating up [A]!"),span_notice("You finish up eating [A].")) @@ -177,7 +177,7 @@ if(C.getBruteLoss_nonProsthetic() >= 100) return src.visible_message(span_warning("[src] starts biting into [C]!"),span_notice("You start eating [C]...")) - if(!do_after(src, 3 SECONDS, FALSE, target)) + if(!do_after(src, 3 SECONDS, target, timed_action_flags = IGNORE_HELD_ITEM)) return to_chat(src, span_notice("You finish eating [C].")) heal_bodypart_damage(5) @@ -190,10 +190,10 @@ if(target.reagents.has_reagent(/datum/reagent/plaguebacteria)) to_chat(src, span_warning("[target] is already infected!")) return - if(INTERACTING_WITH(src, target)) + if(DOING_INTERACTION(src, target)) return src.visible_message(span_warning("[src] starts licking [target]!"),span_notice("You start licking [target]...")) - if(!do_after(src, 2 SECONDS, FALSE, target)) + if(!do_after(src, 2 SECONDS, target, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(src, span_warning("You stop licking [target].")) return target.reagents.add_reagent(/datum/reagent/plaguebacteria, rand(1,2), no_react = TRUE) diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index b89d5770aaf4..258c77c61664 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,4 +1,5 @@ /mob/Logout() + SEND_SIGNAL(src, COMSIG_MOB_LOGOUT) log_message("[key_name(src)] is no longer owning mob [src]", LOG_OWNERSHIP) SStgui.on_logout(src) unset_machine() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index adaf5c87ec28..ab280fcc2276 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -218,6 +218,5 @@ var/sound_environment_override = SOUND_ENVIRONMENT_NONE var/action_speed_modifier = 1 //Value to multiply action delays by //yogs start: fuck - var/action_speed_adjust = 0 //Value to add or remove to action delays //yogs end var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index e36e23e24337..4c23d9693153 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -555,7 +555,7 @@ By design, d1 is the smallest direction and d2 is the highest to_chat(user, span_warning("[affecting] is already in good condition!")) return FALSE if(affecting && affecting.status == BODYPART_ROBOTIC) - if(INTERACTING_WITH(user, H)) + if(DOING_INTERACTION(user, H)) return FALSE user.visible_message(span_notice("[user] starts to fix some of the wires in [H]'s [affecting.name]."), span_notice("You start fixing some of the wires in [H == user ? "your" : "[H]'s"] [affecting.name].")) heal_robo_limb(src, H, user, 0, 10, 1) diff --git a/code/modules/projectiles/guns/ballistic/bow.dm b/code/modules/projectiles/guns/ballistic/bow.dm index dd80bbdbacc3..1237f44a7b1e 100644 --- a/code/modules/projectiles/guns/ballistic/bow.dm +++ b/code/modules/projectiles/guns/ballistic/bow.dm @@ -83,7 +83,7 @@ else if(get_ammo()) drawing = TRUE update_slowdown() - if (!do_after(user, draw_time, src, TRUE, stayStill = !move_drawing)) + if(!do_after(user, draw_time, src, timed_action_flags = (move_drawing ? IGNORE_HELD_ITEM : IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM))) drawing = FALSE update_slowdown() return TRUE diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index e3643b8016dd..827c67bc44c0 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -27,7 +27,7 @@ playsound(user.loc, 'sound/items/drink.ogg', rand(10, 50), TRUE) return TRUE - while(do_after(user, 1 SECONDS, stayStill = FALSE)) + while(do_after(user, 1 SECONDS, timed_action_flags = IGNORE_USER_LOC_CHANGE)) user.visible_message( span_notice("[user] puts the [src] up to their mouth."), span_notice("You take a sip from the [src]."), diff --git a/code/modules/research/xenobiology/crossbreeding/crystalized.dm b/code/modules/research/xenobiology/crossbreeding/crystalized.dm index 4502a568b361..11a0d885896f 100644 --- a/code/modules/research/xenobiology/crossbreeding/crystalized.dm +++ b/code/modules/research/xenobiology/crossbreeding/crystalized.dm @@ -20,7 +20,7 @@ Crystalized extracts: to_chat(user,span_notice("You can't build crystals that close to each other!")) return var/user_turf = get_turf(user) - if(!do_after(user, 15 SECONDS, user_turf, FALSE)) + if(!do_after(user, 15 SECONDS, user_turf, timed_action_flags = IGNORE_HELD_ITEM)) return new crystal_type(user_turf) qdel(src) diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index 50cdc25367f4..dea8db39f1fc 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -120,7 +120,7 @@ if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED)) to_chat(current_user, span_warning("Targeting transit location, please wait [DisplayTimeText(designate_time)]...")) designating_target_loc = the_eye.loc - var/wait_completed = do_after(current_user, designate_time, designating_target_loc, FALSE, 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, 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/charged/_charged.dm b/code/modules/spells/spell_types/charged/_charged.dm index adfcc6d28fba..d0c1db0b24f0 100644 --- a/code/modules/spells/spell_types/charged/_charged.dm +++ b/code/modules/spells/spell_types/charged/_charged.dm @@ -80,7 +80,7 @@ currently_channeling = TRUE build_all_button_icons(UPDATE_BUTTON_STATUS) - if(!do_after(cast_on, channel_time, stayStill = FALSE, needhand = FALSE)) + if(!do_after(cast_on, channel_time, timed_action_flags = IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM)) stop_channel_effect(cast_on) return . | SPELL_CANCEL_CAST diff --git a/code/modules/spells/spell_types/hivemind.dm b/code/modules/spells/spell_types/hivemind.dm index f975cc3a3870..49cedea69b28 100644 --- a/code/modules/spells/spell_types/hivemind.dm +++ b/code/modules/spells/spell_types/hivemind.dm @@ -83,7 +83,7 @@ else to_chat(owner, span_notice("We begin linking our mind with [target.name]!")) var/multiplier = (!foiled || bruteforce) ? 5 : 10 - if(!do_after(owner, multiplier*(1.5**get_dist(owner, target)), owner, FALSE) || !(target in view(aoe_radius))) + if(!do_after(owner, multiplier*(1.5**get_dist(owner, target)), owner, timed_action_flags = IGNORE_HELD_ITEM) || !(target in view(aoe_radius))) to_chat(owner, span_notice("We fail to connect to [target.name].")) return if((HAS_TRAIT(target, TRAIT_MINDSHIELD) && !bruteforce)) @@ -249,7 +249,7 @@ var/mob/living/L = track.tracked_by if(!L) continue - if(!do_after(owner, 0.5 SECONDS, owner, FALSE)) + if(!do_after(owner, 0.5 SECONDS, owner, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_notice("Our concentration has been broken!")) break distance = get_dist(owner, L) @@ -269,7 +269,7 @@ message += " is quite far away." to_chat(owner, span_assimilator("[message]")) for(var/datum/antagonist/hivemind/enemy in hive.individual_track_bonus) - if(!do_after(owner, 0.5 SECONDS, owner, FALSE)) + if(!do_after(owner, 0.5 SECONDS, owner, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_notice("Our concentration has been broken!")) break var/mob/living/carbon/C = enemy.owner?.current @@ -326,7 +326,7 @@ to_chat(owner, span_notice("We begin siphoning power from our many vessels!")) while(iterations < 7) var/mob/living/carbon/target = pick(carbon_members) - if(!do_after(owner, 1 SECONDS, owner, FALSE)) + if(!do_after(owner, 1 SECONDS, owner, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_warning("Our concentration has been broken!")) break if(!target) @@ -426,7 +426,7 @@ if(vessel.anti_magic_check(FALSE, FALSE, TRUE)) timely = 100 restricted_range = TRUE - if(!do_after(owner, timely, owner, FALSE)) + if(!do_after(owner, timely, owner, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_notice("We fail to assume control of the target.")) return if(owner.z != vessel.z || (restricted_range && get_dist(vessel, owner) > 35)) @@ -458,7 +458,7 @@ starting_spot = get_turf(vessel) time_initialized = world.time to_chat(vessel, span_assimilator("We can sustain our control for a maximum of [round(power/10)] seconds.")) - if(do_after(owner, power, owner, FALSE, FALSE)) + if(do_after(owner, power, owner, timed_action_flags = IGNORE_HELD_ITEM, progress = FALSE)) to_chat(vessel, span_warning("We cannot sustain the mind control any longer and release control!")) else to_chat(vessel, span_warning("Our body has been disturbed, interrupting the mind control!")) @@ -606,13 +606,13 @@ /datum/action/cooldown/spell/aoe/target_hive/nightmare/cast_on_thing_in_aoe(atom/victim, atom/caster) var/mob/living/carbon/target = victim - if(!do_after(owner, 3 SECONDS, owner, FALSE)) + if(!do_after(owner, 3 SECONDS, owner, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_notice("Our concentration has been broken!")) return to_chat(target, span_ownerdanger("You see dark smoke swirling around you!")) if(target.anti_magic_check(FALSE, FALSE, TRUE)) to_chat(owner, span_notice("We begin bruteforcing the tinfoil barriers of [target.name] and pulling out their nightmares.")) - if(!do_after(owner, 3 SECONDS, owner, FALSE) || !(target in view(aoe_radius))) + if(!do_after(owner, 3 SECONDS, owner, timed_action_flags = IGNORE_HELD_ITEM) || !(target in view(aoe_radius))) to_chat(owner, span_notice("Our concentration has been broken!")) return target.apply_status_effect(STATUS_EFFECT_HIVEMIND_CURSE, CURSE_SPAWNING | CURSE_BLINDING) @@ -682,12 +682,12 @@ var/list/enemies = list() to_chat(owner, span_notice("We begin probing [target.name]'s mind!")) - if(do_after(owner, 10 SECONDS, target, FALSE)) + if(do_after(owner, 10 SECONDS, target, timed_action_flags = IGNORE_HELD_ITEM)) var/foiled = target.anti_magic_check(FALSE, FALSE, TRUE) if(!in_hive || foiled) var/timely = !in_hive ? 200 : 100 to_chat(owner, span_notice("Their mind slowly opens up to us.")) - if(!do_after(owner, timely, target, FALSE)) + if(!do_after(owner, timely, target, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(owner, span_notice("Our concentration has been broken!")) return for(var/datum/antagonist/hivemind/enemy in GLOB.antagonists) diff --git a/code/modules/spells/spell_types/self/lichdom.dm b/code/modules/spells/spell_types/self/lichdom.dm index eddeb119b6f5..7dc147937158 100644 --- a/code/modules/spells/spell_types/self/lichdom.dm +++ b/code/modules/spells/spell_types/self/lichdom.dm @@ -48,7 +48,7 @@ playsound(cast_on, 'sound/effects/pope_entry.ogg', 100) to_chat(cast_on, span_green("You begin to focus your very being into [marked_item]...")) - if(!do_after(cast_on, 5 SECONDS, target = marked_item, needhand = FALSE)) + if(!do_after(cast_on, 5 SECONDS, target = marked_item, timed_action_flags = IGNORE_HELD_ITEM)) to_chat(cast_on, span_warning("Your soul snaps back to your body as you stop ensouling [marked_item]!")) return diff --git a/code/modules/surgery/anesthesia_machine.dm b/code/modules/surgery/anesthesia_machine.dm index af386474096c..78b3e1436144 100644 --- a/code/modules/surgery/anesthesia_machine.dm +++ b/code/modules/surgery/anesthesia_machine.dm @@ -78,7 +78,7 @@ if(src.Adjacent(target) && usr.Adjacent(target)) if(attached_tank && !mask_out) usr.visible_message("[usr] attempts to attach the [src] to [target].", "You attempt to attach the [src] to [target].") - if(do_after(usr, 5 SECONDS, target, TRUE)) + if(do_after(usr, 5 SECONDS, target, timed_action_flags = IGNORE_HELD_ITEM)) if(!target.equip_to_appropriate_slot(attached_mask)) to_chat(usr, "You are unable to attach the [src] to [target]!") return diff --git a/code/modules/vehicles/sealed.dm b/code/modules/vehicles/sealed.dm index 1a7b5caa1726..979ed61c96d0 100644 --- a/code/modules/vehicles/sealed.dm +++ b/code/modules/vehicles/sealed.dm @@ -29,7 +29,7 @@ return FALSE if(occupant_amount() >= max_occupants) return FALSE - if(do_after(M, get_enter_delay(M), src, FALSE)) + 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/yogstation/code/game/objects/items/holotool/holotool.dm b/yogstation/code/game/objects/items/holotool/holotool.dm index e8f16d8de0cb..08d5c9a5bc76 100644 --- a/yogstation/code/game/objects/items/holotool/holotool.dm +++ b/yogstation/code/game/objects/items/holotool/holotool.dm @@ -43,7 +43,7 @@ if(affecting.brute_dam <= 0) to_chat(user, span_warning("[affecting] is already in good condition!")) return FALSE - if(INTERACTING_WITH(user, H)) + if(DOING_INTERACTION(user, H)) return FALSE user.changeNext_move(CLICK_CD_MELEE) user.visible_message(span_notice("[user] starts to fix some of the dents on [M]'s [affecting.name]."), span_notice("You start fixing some of the dents on [M == user ? "your" : "[M]'s"] [affecting.name].")) From 3e5a8c3b838d88ef0693a2e24e116aefef2f8ec4 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:59:09 -0400 Subject: [PATCH 03/13] Convert a ton of do_mob to do_after --- code/_onclick/item_attack.dm | 2 +- code/datums/martial/cqc.dm | 2 +- code/datums/status_effects/gas.dm | 2 +- code/game/machinery/_machinery.dm | 2 +- code/game/machinery/decontamination.dm | 2 +- code/game/machinery/suit_storage_unit.dm | 2 +- code/game/objects/effects/decals/cleanable.dm | 13 ++++++------- code/game/objects/effects/decals/cleanable/food.dm | 13 ++++++------- code/game/objects/items.dm | 11 +++-------- code/game/objects/items/dna_injector.dm | 2 +- code/game/objects/items/handcuffs.dm | 4 ++-- code/game/objects/items/implants/implanter.dm | 2 +- code/game/objects/items/kitchen.dm | 2 +- code/game/objects/items/pet_carrier.dm | 2 +- code/game/objects/items/stacks/medical.dm | 4 ++-- code/game/objects/items/twohanded.dm | 2 +- code/game/objects/structures.dm | 4 ++-- code/game/objects/structures/kitchen_spike.dm | 2 +- 18 files changed, 33 insertions(+), 40 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 5a22cd799d2d..9ddb14efb32d 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -59,7 +59,7 @@ if(butchering && butchering.butchering_enabled) to_chat(user, span_notice("You begin to butcher [src]...")) playsound(loc, butchering.butcher_sound, 50, TRUE, -1) - if(do_mob(user, src, butchering.speed) && Adjacent(I)) + if(do_after(user, butchering.speed, src) && Adjacent(I)) butchering.Butcher(user, src) return TRUE else if(I.is_sharp() && !butchering) //give sharp objects butchering functionality, for consistency diff --git a/code/datums/martial/cqc.dm b/code/datums/martial/cqc.dm index 1151a492cfa4..ca0ebfd6a704 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -297,7 +297,7 @@ /datum/martial_art/cqc/proc/handle_chokehold(mob/living/carbon/human/A, mob/living/carbon/human/D) //handles the chokehold attack, dealing oxygen damage until the target is unconscious or would have less than 20 health before knocking out chokehold_active = TRUE var/damage2deal = 15 - while(do_mob(A, D, isipc(D) ? 5 SECONDS : 1 SECONDS)) // doesn't make sense to deal oxygen damage to IPCs so instead do a longer channel that automatically succeeds + while(do_after(A, isipc(D) ? 5 SECONDS : 1 SECONDS, D)) // doesn't make sense to deal oxygen damage to IPCs so instead do a longer channel that automatically succeeds if(!A.grab_state) return FALSE if(isipc(D)) // have you tried turning it off and on again diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index 9dee822ec926..f91f5df9114e 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_after(owner, 4 SECONDS, owner)) 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/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 8d6a4f812951..b5fb2477346f 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -673,7 +673,7 @@ Class Procs: if(HAS_TRAIT(user, TRAIT_FREERUNNING)) //do you have any idea how fast I am??? adjusted_climb_time *= 0.8 machineclimber = user - if(do_mob(user, user, adjusted_climb_time)) + if(do_after(user, adjusted_climb_time, user)) if(src.loc) //Checking if structure has been destroyed if(do_climb(user)) user.visible_message("[user] climbs onto [src].", \ diff --git a/code/game/machinery/decontamination.dm b/code/game/machinery/decontamination.dm index db881eab3bea..d0eaa02f941e 100644 --- a/code/game/machinery/decontamination.dm +++ b/code/game/machinery/decontamination.dm @@ -82,7 +82,7 @@ else target.visible_message(span_warning("[user] starts shoving [target] into [src]!"), span_userdanger("[user] starts shoving you into [src]!")) - if(do_mob(user, target, 30)) + if(do_after(user, 3 SECONDS, target)) if(target == user) user.visible_message(span_warning("[user] slips into [src] and closes the door behind [user.p_them()]!"), "You slip into [src]'s cramped space and shut its door.") else diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 4177a5fb3372..5a16dfe7f9b0 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -205,7 +205,7 @@ else target.visible_message(span_warning("[user] starts shoving [target] into [src]!"), span_userdanger("[user] starts shoving you into [src]!")) - if(do_mob(user, target, 30)) + if(do_after(user, 3 SECONDS, target)) if(occupant || helmet || suit || storage) return if(target == user) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 4c0c8eb5cb25..75b92b50c032 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -52,13 +52,12 @@ to_chat(user, span_notice("You start scooping up [src] into [W]...")) var/scoop_time scoop_time = min((W.reagents.maximum_volume - W.reagents.total_volume), src.reagents.total_volume) //1 second per 10 units scooped - if(do_mob(user, user, scoop_time)) - if(src) - to_chat(user, span_notice("You scoop up [src] into [W]!")) - reagents.trans_to(W, reagents.total_volume, transfered_by = user) - if(!reagents.total_volume) //scooped up all of it - qdel(src) - return + if(do_after(user, scoop_time)) + to_chat(user, span_notice("You scoop up [src] into [W]!")) + reagents.trans_to(W, reagents.total_volume, transfered_by = user) + if(!reagents.total_volume) //scooped up all of it + qdel(src) + return if(W.is_hot()) //todo: make heating a reagent holder proc if(istype(W, /obj/item/clothing/mask/cigarette)) diff --git a/code/game/objects/effects/decals/cleanable/food.dm b/code/game/objects/effects/decals/cleanable/food.dm index 98ed08f66140..0ff86b723d57 100644 --- a/code/game/objects/effects/decals/cleanable/food.dm +++ b/code/game/objects/effects/decals/cleanable/food.dm @@ -48,10 +48,9 @@ user.visible_message(span_notice("[user] shamefully begins gathering up all [src]..."), span_notice("You shamefully begin gathering up all [src] into [W]...")) var/scoop_time scoop_time = min((W.reagents.maximum_volume - W.reagents.total_volume), src.reagents.total_volume) * 2 //don't spill your flour - if(do_mob(user, user, scoop_time)) - if(src) - to_chat(user, span_notice("You scoop up [src] into [W].")) - reagents.trans_to(W, reagents.total_volume, transfered_by = user) - if(!reagents.total_volume) //scooped up all of it - qdel(src) - return + if(do_after(user, scoop_time)) + to_chat(user, span_notice("You scoop up [src] into [W].")) + reagents.trans_to(W, reagents.total_volume, transfered_by = user) + if(!reagents.total_volume) //scooped up all of it + qdel(src) + return diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 763bdd38e925..c6cb22ab8f52 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -397,7 +397,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if(grav > STANDARD_GRAVITY) var/grav_power = min(3,grav - STANDARD_GRAVITY) to_chat(user,span_notice("You start picking up [src]...")) - if(!do_mob(user,src,30*grav_power)) + if(!do_after(user, 30 * grav_power, src)) return @@ -922,13 +922,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) // Create a callback with checks that would be called every tick by do_after. var/datum/callback/tool_check = CALLBACK(src, PROC_REF(tool_check_callback), user, amount, extra_checks) - if(ismob(target)) - if(!do_mob(user, target, delay, extra_checks=tool_check)) - return - - else - if(!do_after(user, delay, target, extra_checks=tool_check)) - return + if(!do_after(user, delay, target, extra_checks=tool_check)) + return else // Invoke the extra checks once, just in case. if(extra_checks && !extra_checks.Invoke()) diff --git a/code/game/objects/items/dna_injector.dm b/code/game/objects/items/dna_injector.dm index 5b82cf6d7ef2..257cbcb00622 100644 --- a/code/game/objects/items/dna_injector.dm +++ b/code/game/objects/items/dna_injector.dm @@ -63,7 +63,7 @@ if(target != user) target.visible_message(span_danger("[user] is trying to inject [target] with [src]!"), \ span_userdanger("[user] is trying to inject you with [src]!")) - if(!do_mob(user, target) || used) + if(!do_after(user, 3 SECONDS, target) || used) return target.visible_message("[user] injects [target] with the syringe with [src]!", \ span_userdanger("[user] injects you with the syringe with [src]!")) diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index bf0a765fc311..fe9774f137b1 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -70,12 +70,12 @@ to_chat(user, span_boldannounce("Restraining [C] will wake them up! Are you sure you want to do this?")) C.visible_message(span_warning("[C] jerks in their sleep as they are restrained!")) to_chat(C, span_boldannounce("Someone handles your arms roughly, pulling you towards wakefulness!")) - if(do_mob(user, C, 1.5 SECONDS, FALSE, FALSE)) // No progress bar + if(do_after(user, 1.5 SECONDS, C, progress = FALSE)) // No progress bar C.remove_status_effect(STATUS_EFFECT_BROKEN_WILL) C.SetUnconscious(0) // Yogs end - if(do_mob(user, C, 30) && (C.get_num_arms(FALSE) >= 2 || C.get_arm_ignore())) + if(do_after(user, 3 SECONDS, C) && (C.get_num_arms(FALSE) >= 2 || C.get_arm_ignore())) if(iscyborg(user)) apply_cuffs(C, user, TRUE) else diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index 7d02ebbdb4fb..38f53d2e8491 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -31,7 +31,7 @@ M.visible_message(span_warning("[user] is attempting to implant [M].")) var/turf/T = get_turf(M) - if(T && (M == user || do_mob(user, M, 50))) + if(T && (M == user || do_after(user, 5 SECONDS, M))) if(src && imp) if(imp.implant(M, user)) if (M == user) diff --git a/code/game/objects/items/kitchen.dm b/code/game/objects/items/kitchen.dm index c9b7e893b32b..93ae7295f502 100644 --- a/code/game/objects/items/kitchen.dm +++ b/code/game/objects/items/kitchen.dm @@ -52,7 +52,7 @@ M.reagents.add_reagent(forkload.type, 1) else M.visible_message(span_notice("[user] is trying to feed [M] a delicious forkful of [loaded_food]!")) //yogs start - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return log_combat(user, M, "fed [loaded_food]", forkload.type) //yogs end M.visible_message(span_notice("[user] feeds [M] a delicious forkful of [loaded_food]!")) diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm index 526bbc748ca8..6865046f7f92 100644 --- a/code/game/objects/items/pet_carrier.dm +++ b/code/game/objects/items/pet_carrier.dm @@ -168,7 +168,7 @@ user.visible_message(span_notice("[user] starts loading [target] into [src]."), \ span_notice("You start loading [target] into [src]..."), null, null, target) to_chat(target, span_userdanger("[user] starts loading you into [user.p_their()] [name]!")) - if(!do_mob(user, target, 30)) + if(!do_after(user, 3 SECONDS, target)) return if(target in occupants) return diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 928e3b74990c..1b37ddd60128 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -52,13 +52,13 @@ playsound(src, pick(apply_sounds), 25) if(!silent) user.visible_message(span_notice("[user] starts to apply \the [src] on [user.p_them()]self..."), span_notice("You begin applying \the [src] on yourself...")) - if(!do_mob(user, M, self_delay, extra_checks=CALLBACK(M, /mob/living/proc/can_inject, user, TRUE))) + if(!do_after(user, self_delay, M, extra_checks=CALLBACK(M, /mob/living/proc/can_inject, user, TRUE))) return else if(other_delay) playsound(src, pick(apply_sounds), 25) if(!silent) user.visible_message(span_notice("[user] starts to apply \the [src] on [M]."), span_notice("You begin applying \the [src] on [M]...")) - if(!do_mob(user, M, other_delay, extra_checks=CALLBACK(M, /mob/living/proc/can_inject, user, TRUE))) + if(!do_after(user, other_delay, M, extra_checks=CALLBACK(M, /mob/living/proc/can_inject, user, TRUE))) return if(heal(M, user)) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index 9dad7e549220..2c5a4d44fc03 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -1204,7 +1204,7 @@ to_chat(user, span_notice("You begin charging the weapon, concentration flowing into it...")) user.visible_message(span_warning("[user] flicks the hammer on, tilting [user.p_their()] head down as if in thought.")) spark_system.start() //Generates sparks when you charge - if(!do_mob(user, user, ispreternis(user)? 5 SECONDS : 6 SECONDS)) + if(!do_after(user, ispreternis(user) ? 5 SECONDS : 6 SECONDS)) if(!charging) //So no duplicate messages return to_chat(user, span_notice("You flip the switch off as you lose your focus.")) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 8092444f5ae2..4913d503bd98 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -82,8 +82,8 @@ if(HAS_TRAIT(user, TRAIT_FREERUNNING)) //do you have any idea how fast I am??? adjusted_climb_time *= 0.8 structureclimber = user - if(do_mob(user, user, adjusted_climb_time)) - if(src.loc) //Checking if structure has been destroyed + if(do_after(user, adjusted_climb_time)) + if(loc) //Checking if structure has been destroyed if(do_climb(user)) user.visible_message(span_warning("[user] climbs onto [src]."), \ span_notice("You climb onto [src].")) diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index 50ce137c33b6..b69624f8a005 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -64,7 +64,7 @@ /obj/structure/kitchenspike/attack_hand(mob/user) if(VIABLE_MOB_CHECK(user.pulling) && user.a_intent == INTENT_GRAB && !has_buckled_mobs()) var/mob/living/L = user.pulling - if(do_mob(user, src, 120)) + if(do_after(user, src, 120)) if(has_buckled_mobs()) //to prevent spam/queing up attacks return if(L.buckled) From ee1477f73d4c14e75e54b88df234afc6920ce46e Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 23 Jul 2023 11:14:53 -0400 Subject: [PATCH 04/13] Removes do_mob entirely --- code/__DEFINES/flags.dm | 2 + code/__HELPERS/mobs.dm | 53 ------------------- .../abductor/equipment/abduction_gear.dm | 2 +- .../bloodsuckers/bloodsuckers_objects.dm | 2 +- .../bloodsuckers/powers/gangrel.dm | 15 +++--- .../bloodsuckers/powers/targeted/brawn.dm | 4 +- .../bloodsuckers/powers/targeted/mesmerize.dm | 2 +- .../bloodsuckers/powers/targeted/tzimisce.dm | 2 +- .../structures/bloodsucker_coffin.dm | 4 +- .../structures/bloodsucker_crypt.dm | 22 ++++---- .../antagonists/changeling/powers/absorb.dm | 2 +- .../antagonists/changeling/powers/linglink.dm | 2 +- .../clockcult/clock_helpers/slab_abilities.dm | 2 +- code/modules/antagonists/cult/blood_magic.dm | 2 +- code/modules/antagonists/horror/horror.dm | 2 +- .../antagonists/horror/horror_datums.dm | 2 +- .../antagonists/monsterhunter/monstertrack.dm | 2 +- code/modules/food_and_drinks/drinks/drinks.dm | 2 +- .../modules/food_and_drinks/food/condiment.dm | 2 +- code/modules/food_and_drinks/food/snacks.dm | 2 +- .../mining/equipment/regenerative_core.dm | 2 +- .../living/carbon/alien/humanoid/humanoid.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 4 +- .../carbon/human/species_types/ethereal.dm | 2 +- .../mob/living/carbon/monkey/combat.dm | 2 +- code/modules/mob/living/living.dm | 4 +- code/modules/mob/living/living_defense.dm | 2 +- .../mob/living/simple_animal/bot/medbot.dm | 2 +- .../simple_animal/guardian/types/support.dm | 2 +- .../living/simple_animal/hostile/regalrat.dm | 2 +- code/modules/projectiles/gun.dm | 2 +- .../reagents/reagent_containers/glass.dm | 2 +- .../reagents/reagent_containers/hypospray.dm | 6 +-- .../reagents/reagent_containers/medspray.dm | 4 +- .../reagents/reagent_containers/pill.dm | 4 +- .../reagents/reagent_containers/spray.dm | 2 +- .../reagents/reagent_containers/syringes.dm | 4 +- code/modules/recycling/disposal/bin.dm | 2 +- .../research/xenobiology/xenobiology.dm | 2 +- code/modules/spells/spell_types/devil.dm | 4 +- code/modules/surgery/helpers.dm | 2 +- code/modules/swarmers/swarmer.dm | 10 ++-- code/modules/vehicles/cars/car.dm | 2 +- yogstation/code/datums/antagonists/vampire.dm | 2 +- .../code/datums/martial/explosive_fist.dm | 2 +- .../code/datums/martial/garden_warfare.dm | 2 +- .../game/gamemodes/vampire/vampire_powers.dm | 4 +- .../darkspawn/darkspawn_objects/dark_bead.dm | 4 +- .../shadowling/shadowling_abilities.dm | 21 ++++---- .../special_shadowling_abilities.dm | 30 +++++------ .../guardian/abilities/minor/teleport.dm | 2 +- .../code/modules/guardian/standarrow.dm | 2 +- .../code/modules/mob/living/carbon/carbon.dm | 2 +- .../reagents/reagent_containers/gummies.dm | 4 +- 55 files changed, 112 insertions(+), 163 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 742fd376e0be..3887fb1304d4 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -198,3 +198,5 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define IGNORE_INCAPACITATED (1<<3) /// Used to prevent important slowdowns from being abused by drugs like kronkaine #define IGNORE_SLOWDOWNS (1<<4) + +#define IGNORE_ALL (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM|IGNORE_INCAPACITATED|IGNORE_SLOWDOWNS) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 7b1a87beec6b..9daaf955ba3a 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -356,59 +356,6 @@ GLOBAL_LIST_EMPTY(species_list) LAZYREMOVE(user.do_afters, interaction_key) SEND_SIGNAL(user, COMSIG_DO_AFTER_ENDED) -/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null) - if(!user || !target) - return 0 - var/user_loc = user.loc - - if(target) - LAZYADD(user.do_afters, target) - LAZYADD(target.targeted_by, user) - - var/drifting = 0 - if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 - - var/target_loc = target.loc - - var/holding = user.get_active_held_item() - time *= user.action_speed_modifier //yogs: darkspawn - var/datum/progressbar/progbar - if (progress) - progbar = new(user, time, target) - - var/endtime = world.time+time - var/starttime = world.time - . = 1 - while (world.time < endtime) - stoplag(1) - if (progress) - progbar.update(world.time - starttime) - if(QDELETED(user) || QDELETED(target)) - . = 0 - break - - if(target && !(target in user.do_afters)) - . = FALSE - break - - if(uninterruptible) - continue - - if(drifting && !user.inertia_dir) - drifting = 0 - 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())) - . = 0 - break - if (progress) - qdel(progbar) - - if(!QDELETED(target)) - LAZYREMOVE(user.do_afters, target) - LAZYREMOVE(target.targeted_by, user) - /mob/proc/do_after_coefficent() // This gets added to the delay on a do_after, default 1 . = 1 diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index 45b84db7b344..6c2f67afc7aa 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -547,7 +547,7 @@ Congratulations! You are now trained for invasive xenobiology research!"} playsound(src, 'sound/weapons/cablecuff.ogg', 30, TRUE, -2) C.visible_message(span_danger("[user] begins restraining [C] with [src]!"), \ span_userdanger("[user] begins shaping an energy field around your hands!")) - if(do_mob(user, C, 30) && (C.get_num_arms(FALSE) >= 2 || C.get_arm_ignore())) + if(do_after(user, 3 SECONDS, C) && (C.get_num_arms(FALSE) >= 2 || C.get_arm_ignore())) if(!C.handcuffed) C.set_handcuffed(new /obj/item/restraints/handcuffs/energy/used(C)) C.update_handcuffed() diff --git a/code/modules/antagonists/bloodsuckers/bloodsuckers_objects.dm b/code/modules/antagonists/bloodsuckers/bloodsuckers_objects.dm index 48b371bcd7c3..310203b0f648 100644 --- a/code/modules/antagonists/bloodsuckers/bloodsuckers_objects.dm +++ b/code/modules/antagonists/bloodsuckers/bloodsuckers_objects.dm @@ -129,7 +129,7 @@ to_chat(user, span_notice("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, target, staketime, extra_checks = CALLBACK(target, TYPE_PROC_REF(/mob/living/carbon, can_be_staked)))) // user / target / time / uninterruptable / show progress bar / extra checks + if(!do_after(user, staketime, target, extra_checks = CALLBACK(target, TYPE_PROC_REF(/mob/living/carbon, can_be_staked)))) // user / target / time / uninterruptable / show progress bar / extra checks return // Drop & Embed Stake user.visible_message( diff --git a/code/modules/antagonists/bloodsuckers/powers/gangrel.dm b/code/modules/antagonists/bloodsuckers/powers/gangrel.dm index eae474784ffa..23fd354ace58 100644 --- a/code/modules/antagonists/bloodsuckers/powers/gangrel.dm +++ b/code/modules/antagonists/bloodsuckers/powers/gangrel.dm @@ -24,7 +24,7 @@ /datum/action/cooldown/bloodsucker/gangrel/transform/ActivatePower() var/datum/antagonist/bloodsucker/bloodsuckerdatum = owner.mind.has_antag_datum(/datum/antagonist/bloodsucker) var/mob/living/carbon/human/user = owner - if(!do_mob(user, user, 10 SECONDS, 1)) + if(!do_after(user, 10 SECONDS)) return var/list/radial_display = list() //get our options, switches are kinda weird here cause wwe ant to stack them @@ -119,11 +119,10 @@ Beware you will not be able to transform again until the night passes!" /datum/action/cooldown/bloodsucker/gangrel/transform_back/ActivatePower() - if(!do_mob(owner, owner, 10 SECONDS)) + if(!do_after(owner, 10 SECONDS)) return - var/mob/living/simple_animal/hostile/bloodsucker/bs - if(istype(owner, bs)) - qdel(bs) + if(istype(owner, /mob/living/simple_animal/hostile/bloodsucker)) + qdel(owner) return ..() /* ////////////////||\\\\\\\\\\\\\\\\ @@ -446,7 +445,7 @@ . = ..() var/mob/living/simple_animal/hostile/bloodsucker/werewolf/A = owner A.visible_message(span_danger("[A] inhales a ton of air!"), span_warning("You prepare to howl!")) - if(!do_mob(A, A, 2.5 SECONDS, TRUE)) + if(!do_after(A, 2.5 SECONDS)) return playsound(A.loc, 'yogstation/sound/creatures/darkspawn_howl.ogg', 50, TRUE) A.visible_message(span_userdanger("[A] lets out a chilling howl!"), span_boldwarning("You howl, confusing and deafening nearby mortals.")) @@ -540,12 +539,12 @@ /datum/action/cooldown/bloodsucker/targeted/tear/proc/Mawl(mob/living/target) var/mob/living/carbon/user = owner - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return var/datum/status_effect/saw_bleed/B = target.has_status_effect(STATUS_EFFECT_SAWBLEED) while(!target.stat) - if(!target.Adjacent(user) || !do_mob(user, target, 0.8 SECONDS)) + if(!target.Adjacent(user) || !do_after(user, 0.8 SECONDS, target)) break var/obj/item/bodypart/affecting = target.get_bodypart(ran_zone(user.zone_selected)) user.do_attack_animation(target, ATTACK_EFFECT_CLAW) diff --git a/code/modules/antagonists/bloodsuckers/powers/targeted/brawn.dm b/code/modules/antagonists/bloodsuckers/powers/targeted/brawn.dm index cbb95500dda0..76f4f6618269 100644 --- a/code/modules/antagonists/bloodsuckers/powers/targeted/brawn.dm +++ b/code/modules/antagonists/bloodsuckers/powers/targeted/brawn.dm @@ -147,7 +147,7 @@ else if(istype(target_atom, /obj/structure/closet) && level_current >= 3) var/obj/structure/closet/target_closet = target_atom to_chat(user, span_warning("You prepare to bash [target_closet] open...")) - if(!do_mob(user, target_closet, 2.5 SECONDS)) + if(!do_after(user, 2.5 SECONDS, target_closet)) return FALSE target_closet.visible_message(span_danger("[target_closet] breaks open as [user] bashes it!")) addtimer(CALLBACK(src, PROC_REF(break_closet), user, target_closet), 1) @@ -157,7 +157,7 @@ var/obj/machinery/door/target_airlock = target_atom playsound(get_turf(user), 'sound/machines/airlock_alien_prying.ogg', 40, TRUE, -1) to_chat(owner, span_warning("You prepare to tear open [target_airlock]...")) - if(!do_mob(user, target_airlock, 2.5 SECONDS)) + if(!do_after(user, 2.5 SECONDS, target_airlock)) return FALSE if(target_airlock.Adjacent(user)) target_airlock.visible_message(span_danger("[target_airlock] breaks open as [user] bashes it!")) diff --git a/code/modules/antagonists/bloodsuckers/powers/targeted/mesmerize.dm b/code/modules/antagonists/bloodsuckers/powers/targeted/mesmerize.dm index a08f806b0fbf..ee7869840bfa 100644 --- a/code/modules/antagonists/bloodsuckers/powers/targeted/mesmerize.dm +++ b/code/modules/antagonists/bloodsuckers/powers/targeted/mesmerize.dm @@ -91,7 +91,7 @@ var/mob/living/user = owner to_chat(owner, span_notice("Attempting to hypnotically gaze [target]...")) if(!power_activates_immediately) - if(!do_mob(user, target, mesmerizingtime, NONE, TRUE)) + if(!do_after(user, mesmerizingtime, target)) return power_activated_sucessfully() // PAY COST! BEGIN COOLDOWN! diff --git a/code/modules/antagonists/bloodsuckers/powers/targeted/tzimisce.dm b/code/modules/antagonists/bloodsuckers/powers/targeted/tzimisce.dm index 69516a65538c..13b0e9abde0c 100644 --- a/code/modules/antagonists/bloodsuckers/powers/targeted/tzimisce.dm +++ b/code/modules/antagonists/bloodsuckers/powers/targeted/tzimisce.dm @@ -138,7 +138,7 @@ target.adjustBruteLoss(25) return playsound(usr.loc, "sound/weapons/slice.ogg", 50, TRUE) - if(!do_mob(usr, target, 2.5 SECONDS)) + if(!do_after(usr, 2.5 SECONDS, target)) return if(ishuman(target)) var/mob/living/carbon/human/H = target diff --git a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm index 029e73b6dd11..153c94faa3c5 100644 --- a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm +++ b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm @@ -212,7 +212,7 @@ user.visible_message( span_notice("[user] tries to pry the lid off of [src] with [item]."), span_notice("You begin prying the lid off of [src] with [item]. This should take about [DisplayTimeText(pry_time)].")) - if(!do_mob(user, src, pry_time)) + if(!do_after(user, pry_time, src)) return bust_open() user.visible_message( @@ -246,7 +246,7 @@ return // Broken? Let's fix it. to_chat(resident, span_notice("The secret latch to lock [src] from the inside is broken. You set it back into place...")) - if(!do_mob(resident, src, 5 SECONDS)) + if(!do_after(resident, 5 SECONDS, src)) to_chat(resident, span_notice("You fail to fix [src]'s mechanism.")) return to_chat(resident, span_notice("You fix the mechanism and lock it.")) diff --git a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm index 0053aeace628..70d34569230c 100644 --- a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm +++ b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_crypt.dm @@ -695,7 +695,7 @@ if(issilicon(living_target)) to_chat(user, span_danger("You realize that Silicon cannot be vassalized, therefore it is useless to buckle them.")) return - if(do_mob(user, living_target, 5 SECONDS)) + if(do_after(user, 5 SECONDS, living_target)) attach_victim(living_target, user) /obj/structure/bloodsucker/vassalrack/proc/attach_victim(mob/living/target, mob/living/user) @@ -1010,7 +1010,7 @@ to_chat(user, span_notice("Do you wish to rebuild this body? This will remove any restraints they might have, and will cost 150 Blood!")) var/revive_response = tgui_alert(usr, "Would you like to revive [target]?", "Ghetto Medbay", list("Yes", "No")) if(revive_response == "Yes") - if(!do_mob(user, src, 7 SECONDS)) + if(!do_after(user, 7 SECONDS, src)) to_chat(user, span_danger("The ritual has been interrupted!")) return if(prob(70 - bloodsuckerdatum.bloodsucker_level * 7)) //calculation, stops going wrong at level 10 @@ -1047,7 +1047,7 @@ to_chat(user, span_notice("You decide to leave your Vassal just the way they are.")) return to_chat(user, span_warning("You start mutating your Vassal into a [answer]...")) - if(!do_mob(user, src, 5 SECONDS)) + if(!do_after(user, 5 SECONDS, src)) to_chat(user, span_danger("The ritual has been interrupted!")) return playsound(target.loc, 'sound/weapons/slash.ogg', 50, TRUE, -1) @@ -1056,10 +1056,10 @@ if(HAS_TRAIT(target, TRAIT_HUSK)) to_chat(user, span_warning("[target] is already a Husk!")) return - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return playsound(target.loc, 'sound/weapons/slash.ogg', 50, TRUE, -1) - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return to_chat(user, span_notice("You suck all the blood out of [target], turning them into a Living Husk!")) to_chat(target, span_notice("Your master has mutated you into a Living Husk!")) @@ -1079,7 +1079,7 @@ if(meat_points < meat_cost) to_chat(user, span_warning("You need atleast [meat_cost - meat_points] more meat points to do this.")) return - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return playsound(target.loc, 'sound/weapons/slash.ogg', 50, TRUE, -1) to_chat(user, span_notice("You transfer your blood and toy with [target]'s flesh, leaving their body as a head and arm almalgam.")) @@ -1099,7 +1099,7 @@ if(meat_points < meat_cost) to_chat(user, span_warning("You need atleast [meat_cost - meat_points] more meat points to do this.")) return - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return playsound(target.loc, 'sound/weapons/slash.ogg', 50, TRUE, -1) to_chat(user, span_notice("You transfer your blood and toy with [target]'s flesh and bones, leaving their body as a boney and flesh amalgam.")) @@ -1118,10 +1118,10 @@ if(meat_points < meat_cost) to_chat(user, span_warning("You need atleast [meat_cost - meat_points] more meat points to do this.")) return - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return playsound(target.loc, 'sound/weapons/slash.ogg', 50, TRUE, -1) - if(!do_mob(user, target, 1 SECONDS)) + if(!do_after(user, 1 SECONDS, target)) return to_chat(user, span_notice("You transfer your blood and toy with [target]'s flesh and bones, leaving their body as a huge pile of flesh and organs.")) to_chat(target, span_notice("Your master has mutated you into a gargantuan monster!")) @@ -1246,7 +1246,7 @@ switch(input("Do you wish to spend 50 Blood to deactivate [target]'s mindshield?") in list("Yes", "No")) if("Yes") user.blood_volume -= 50 - if(!do_mob(user, target, 20 SECONDS)) + if(!do_after(user, 20 SECONDS, target)) to_chat(user, span_danger("The ritual has been interrupted!")) return FALSE remove_loyalties(target) @@ -1270,7 +1270,7 @@ to_chat(user, span_warning("[target] doesn't have a mindshield for you to turn off!")) return /// Good to go - Buckle them! - if(do_mob(user, target, 5 SECONDS)) + if(do_after(user, 5 SECONDS, target)) attach_mob(target, user) /obj/structure/bloodsucker/candelabrum/proc/attach_mob(mob/living/target, mob/living/user) diff --git a/code/modules/antagonists/changeling/powers/absorb.dm b/code/modules/antagonists/changeling/powers/absorb.dm index a630f2f15079..42816e7c9e19 100644 --- a/code/modules/antagonists/changeling/powers/absorb.dm +++ b/code/modules/antagonists/changeling/powers/absorb.dm @@ -44,7 +44,7 @@ target.take_overall_damage(40) SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("Absorb DNA", "[i]")) - if(!do_mob(user, target, absorbtimer)) + if(!do_after(user, absorbtimer, target)) to_chat(user, span_warning("Our absorption of [target] has been interrupted!")) changeling.isabsorbing = 0 return diff --git a/code/modules/antagonists/changeling/powers/linglink.dm b/code/modules/antagonists/changeling/powers/linglink.dm index 95f58d836d96..090d0055ee17 100644 --- a/code/modules/antagonists/changeling/powers/linglink.dm +++ b/code/modules/antagonists/changeling/powers/linglink.dm @@ -61,7 +61,7 @@ addtimer(CALLBACK(src, PROC_REF(sever_connection), user, target), 3 MINUTES) return SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("[name]", "[i]")) - if(!do_mob(user, target, 2 SECONDS)) + if(!do_after(user, 2 SECONDS, target)) to_chat(user, span_warning("Our link with [target] has ended!")) changeling.islinking = FALSE target.mind.linglink = FALSE diff --git a/code/modules/antagonists/clockcult/clock_helpers/slab_abilities.dm b/code/modules/antagonists/clockcult/clock_helpers/slab_abilities.dm index 1ed27ec10768..534de8202d3b 100644 --- a/code/modules/antagonists/clockcult/clock_helpers/slab_abilities.dm +++ b/code/modules/antagonists/clockcult/clock_helpers/slab_abilities.dm @@ -60,7 +60,7 @@ caller.visible_message(span_danger("[caller] begins forming manacles around [L]'s wrists!"), \ "[span_neovgre_small("You begin shaping replicant alloy into manacles around [L]'s wrists...")]") to_chat(L, span_userdanger("[caller] begins forming manacles around your wrists!")) - if(do_mob(caller, L, 30)) + if(do_after(caller, 3 SECONDS, L)) if(!(istype(L.handcuffed,/obj/item/restraints/handcuffs/clockwork))) L.set_handcuffed(new /obj/item/restraints/handcuffs/clockwork(L)) L.update_handcuffed() diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 83e4b9a3711e..5fa4bce78f38 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -559,7 +559,7 @@ playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2) C.visible_message(span_danger("[user] begins restraining [C] with dark magic!"), \ span_userdanger("[user] begins shaping dark magic shackles around your wrists!")) - if(do_mob(user, C, 30)) + if(do_after(user, 3 SECONDS, C)) if(!C.handcuffed) C.set_handcuffed(new /obj/item/restraints/handcuffs/energy/cult/used(C)) C.update_handcuffed() diff --git a/code/modules/antagonists/horror/horror.dm b/code/modules/antagonists/horror/horror.dm index 475b87cbd314..a7d2e8e5f8ca 100644 --- a/code/modules/antagonists/horror/horror.dm +++ b/code/modules/antagonists/horror/horror.dm @@ -106,7 +106,7 @@ to_chat(src, span_warning("You slither your tentacles up [C] and begin probing at [C.p_their()] ear canal...")) // Yogs -- pronouns - if(!do_mob(src, C, 3 SECONDS)) + if(!do_after(src, 3 SECONDS, C)) to_chat(src, span_warning("As [C] moves away, you are dislodged and fall to the ground.")) return diff --git a/code/modules/antagonists/horror/horror_datums.dm b/code/modules/antagonists/horror/horror_datums.dm index 14cd039fbf26..70630fa5f7a6 100644 --- a/code/modules/antagonists/horror/horror_datums.dm +++ b/code/modules/antagonists/horror/horror_datums.dm @@ -143,7 +143,7 @@ to_chat(user, span_notice("Take a breath before you blow [src] again.")) return to_chat(user, span_notice("You take a deep breath and prepare to blow into [src]...")) - if(do_mob(user, src, 10 SECONDS)) + if(do_after(user, 10 SECONDS, src)) if(cooldown > world.time) return cooldown = world.time + 10 SECONDS diff --git a/code/modules/antagonists/monsterhunter/monstertrack.dm b/code/modules/antagonists/monsterhunter/monstertrack.dm index e4a3c1ca2ad1..bba9404fd2b3 100644 --- a/code/modules/antagonists/monsterhunter/monstertrack.dm +++ b/code/modules/antagonists/monsterhunter/monstertrack.dm @@ -18,7 +18,7 @@ . = ..() /// Return text indicating direction to_chat(owner, span_notice("You look around, scanning your environment and discerning signs of any filthy, wretched affronts to the natural order...")) - if(!do_mob(owner, owner, 6 SECONDS)) + if(!do_after(owner, 6 SECONDS)) to_chat(owner,span_warning("You were interrupted and lost the tracks!")) DeactivatePower() return diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 740985bdff35..2602394c49d4 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -44,7 +44,7 @@ else if(!C.force_drink_text(src, C, user)) return - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return if(!reagents || !reagents.total_volume) return // The drink might be empty after the delay, such as by spam-feeding diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index e046b5a5c804..500c3265c37f 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -50,7 +50,7 @@ user.visible_message(span_notice("[user] swallows some of contents of \the [src]."), span_notice("You swallow some of the contents of \the [src].")) else user.visible_message(span_warning("[user] attempts to feed [M] from [src].")) - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return if(!reagents || !reagents.total_volume) return // The condiment might be empty after the delay. diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 6e7bce38d3ff..a6751b164404 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -111,7 +111,7 @@ All foods are distributed among various categories. Use common sense. if(!isbrain(M)) //If you're feeding it to someone else. if(!C.force_eat_text(fullness, src, C, user)) return - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return log_combat(user, M, "fed", reagents.log_list()) else diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index fecd8f48e0dd..7c15236d28ec 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -91,7 +91,7 @@ else H.visible_message(span_notice("[user] holds [src] against [H]'s body, coaxing the regenerating tendrils from [src]...")) balloon_alert(user, "Applying core...") - if(!do_mob(user, H, 2 SECONDS)) //come on teamwork bonus? + if(!do_after(user, 2 SECONDS, H)) //come on teamwork bonus? to_chat(user, span_warning("You are interrupted, causing [src]'s tendrils to retreat back into its form.")) return balloon_alert(user, "Core applied!") diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 25777afd2a95..11096fa37b3e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -55,7 +55,7 @@ if(href_list["pouches"] && usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) visible_message(span_danger("[usr] tries to empty [src]'s pouches."), \ span_userdanger("[usr] tries to empty [src]'s pouches.")) - if(do_mob(usr, src, POCKET_STRIP_DELAY * 0.5)) + if(do_after(usr, POCKET_STRIP_DELAY * 0.5, src)) dropItemToGround(r_store) dropItemToGround(l_store) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 5b93b73fff03..6a3364d455f7 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -263,7 +263,7 @@ if(ITEM && istype(ITEM, /obj/item/tank) && wear_mask && (wear_mask.clothing_flags & MASKINTERNALS)) visible_message(span_danger("[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name]."), \ span_userdanger("[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name].")) - if(do_mob(usr, src, POCKET_STRIP_DELAY)) + if(do_after(usr, POCKET_STRIP_DELAY, src)) if(internal) cutoff_internals() else if(ITEM && istype(ITEM, /obj/item/tank)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 61777dccb0ca..a478c861539c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -295,7 +295,7 @@ else return - if(do_mob(usr, src, POCKET_STRIP_DELAY/delay_denominator)) //placing an item into the pocket is 4 times faster + if(do_after(usr, POCKET_STRIP_DELAY/delay_denominator, src)) //placing an item into the pocket is 4 times faster if(pocket_item) if(pocket_item == (pocket_id == ITEM_SLOT_RPOCKET ? r_store : l_store)) //item still in the pocket we search dropItemToGround(pocket_item) @@ -637,7 +637,7 @@ if(C.cpr_time < world.time + 30) visible_message(span_notice("[src] is trying to perform CPR on [C.name]!"), \ span_notice("You try to perform CPR on [C.name]... Hold still!")) - if(!do_mob(src, C)) + if(!do_after(src, 3 SECONDS, C)) to_chat(src, span_warning("You fail to perform CPR on [C]!")) return 0 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 3e5aae56dd8f..c87d8ef68da3 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -172,7 +172,7 @@ var/static/mutable_appearance/overcharge //shameless copycode from lightning spell copied from another codebase copied from another codebase 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_ALL)) 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) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 4cfe2d44b62d..b08aa000b8c7 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -306,7 +306,7 @@ return IsStandingStill() /mob/living/carbon/monkey/proc/pickpocket(mob/M) - if(do_mob(src, M, MONKEY_ITEM_SNATCH_DELAY) && pickupTarget) + if(do_after(src, MONKEY_ITEM_SNATCH_DELAY, M) && pickupTarget) for(var/obj/item/I in M.held_items) if(istype(I, /obj/item/clothing/mob_holder)) //prevents monkeys from stealing themselves (temporalily deletes them if they do) continue diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f036a920f4a7..ed1e7a056de4 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -877,7 +877,7 @@ span_userdanger("[src] tries to remove [who]'s [what.name].")) what.add_fingerprint(src) SEND_SIGNAL(what, COMSIG_ITEM_PRESTRIP) - if(do_mob(src, who, what.strip_delay)) + if(do_after(src, what.strip_delay, who)) if(what && Adjacent(who)) if(islist(where)) var/list/L = where @@ -915,7 +915,7 @@ return visible_message(span_notice("[src] tries to put [what] on [who].")) - if(do_mob(src, who, what.equip_delay_other)) + if(do_after(src, what.equip_delay_other, who)) if(what && Adjacent(who) && what.mob_can_equip(who, src, final_where, TRUE, TRUE)) if(temporarilyRemoveItemFromInventory(what)) if(where_list) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 812637a30fc6..26226ea0d19e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -195,7 +195,7 @@ log_combat(user, src, "attempted to neck grab", addition="neck grab") if(GRAB_NECK) log_combat(user, src, "attempted to strangle", addition="kill grab") - if(!do_mob(user, src, grab_upgrade_time)) + if(!do_after(user, grab_upgrade_time, src)) return FALSE if(!user.pulling || user.pulling != src || user.grab_state != old_grab_state) return FALSE diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index e38f4bd6c3bd..3bae9ed842cb 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -646,7 +646,7 @@ span_userdanger("[src] is trying to inject you!")) var/failed = FALSE - if(do_mob(src, patient, 30)) + if(do_after(src, 3 SECONDS, patient)) if((get_dist(src, patient) <= 1) && (on) && assess_patient(patient)) if(reagent_id == "internal_beaker") if(use_beaker && reagent_glass && reagent_glass.reagents.total_volume) diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm index 1de376e10e7c..979fac94dbfd 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/support.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm @@ -132,7 +132,7 @@ span_userdanger("You start to faintly glow, and you feel strangely weightless!")) do_attack_animation(A) - if(!do_mob(src, A, 60)) //now start the channel + if(!do_after(src, 6 SECONDS, A)) //now start the channel to_chat(src, "You need to hold still!") return diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index 9ea668a203db..c117420b0f4d 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -185,7 +185,7 @@ if (target.reagents && target.is_injectable(src, allowmobs = TRUE) && !istype(target, /obj/item/reagent_containers/food/snacks/cheesewedge)) src.visible_message(span_warning("[src] starts licking [target] passionately!"), span_notice("You start licking [target]...")) - if(do_mob(src, target, 2 SECONDS)) + if(do_after(src, 2 SECONDS, target)) target.reagents.add_reagent(/datum/reagent/rat_spit, rand(1,3), no_react = TRUE) to_chat(src, span_notice("You finish licking [target].")) else if(istype(target, /obj/item/reagent_containers/food/snacks/cheesewedge)) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index deadab326b3d..91d8a1abb3dd 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -668,7 +668,7 @@ semicd = TRUE - if(!bypass_timer && (!do_mob(user, target, 120) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH)) + if(!bypass_timer && (!do_after(user, 12 SECONDS, target) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH)) if(user) if(user == target) user.visible_message(span_notice("[user] decided not to shoot.")) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index e9b44fa45d48..5a6128e1ccdf 100755 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -38,7 +38,7 @@ if(M != user) M.visible_message(span_danger("[user] attempts to feed something to [M]."), \ span_userdanger("[user] attempts to feed something to you.")) - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return if(!reagents || !reagents.total_volume) return // The drink might be empty after the delay, such as by spam-feeding diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index aeb3ced5e764..84b5d1ad316d 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -459,7 +459,7 @@ to_chat(user, span_notice("You begin to inject [C] with [src].")) //Checks - if(!do_mob(user, C, (C == user) ? inject_self : inject_wait)) + if(!do_after(user, (C == user) ? inject_self : inject_wait, C)) return if((!penetrates && !C.can_inject(user, 1)) || !container?.reagents?.total_volume || C.reagents.total_volume >= C.reagents.maximum_volume) return @@ -506,7 +506,7 @@ to_chat(user, span_notice("You begin to spray [C] with [src].")) //Checks Again - if(!do_mob(user, C, (C == user) ? spray_self : spray_wait)) + if(!do_after(user, (C == user) ? spray_self : spray_wait, C)) return if(!C.can_inject(user, 1) || C.reagents.total_volume >= C.reagents.maximum_volume) return @@ -543,7 +543,7 @@ if(target != user) target.visible_message(span_danger("[user] is trying to take a blood sample from [target]!"), \ span_userdanger("[user] is trying to take a blood sample from [target]!")) - if(!do_mob(user, target)) + if(!do_after(user, 3 SECONDS, target)) return if(container.reagents.total_volume >= container.reagents.maximum_volume) return diff --git a/code/modules/reagents/reagent_containers/medspray.dm b/code/modules/reagents/reagent_containers/medspray.dm index c182c852bd68..f2ffaa70488e 100644 --- a/code/modules/reagents/reagent_containers/medspray.dm +++ b/code/modules/reagents/reagent_containers/medspray.dm @@ -50,7 +50,7 @@ if(M == user) M.visible_message(span_notice("[user] attempts to [apply_method] [src] on [user.p_them()]self.")) if(self_delay) - if(!do_mob(user, M, self_delay)) + if(!do_after(user, self_delay, M)) return if(!reagents || !reagents.total_volume) return @@ -60,7 +60,7 @@ log_combat(user, M, "attempted to apply", src, reagents.log_list()) M.visible_message(span_danger("[user] attempts to [apply_method] [src] on [M]."), \ span_userdanger("[user] attempts to [apply_method] [src] on [M].")) - if(!do_mob(user, M, other_delay)) + if(!do_after(user, other_delay, M)) return if(!reagents || !reagents.total_volume) return diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 2657b6462583..7baa9ea617b4 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -34,14 +34,14 @@ if(M == user) M.visible_message(span_notice("[user] attempts to [apply_method] [src].")) if(self_delay) - if(!do_mob(user, M, self_delay)) + if(!do_after(user, self_delay, M)) return FALSE to_chat(M, span_notice("You [apply_method] [src].")) else M.visible_message(span_danger("[user] attempts to force [M] to [apply_method] [src]."), \ span_userdanger("[user] attempts to force [M] to [apply_method] [src].")) - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return FALSE M.visible_message(span_danger("[user] forces [M] to [apply_method] [src]."), \ span_userdanger("[user] forces [M] to [apply_method] [src].")) diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index f17095b8583b..d2dbd76f3c28 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -188,7 +188,7 @@ /obj/item/reagent_containers/spray/cleaner/suicide_act(mob/user) user.visible_message(span_suicide("[user] is putting the nozzle of \the [src] in [user.p_their()] mouth. It looks like [user.p_theyre()] trying to commit suicide!")) - if(do_mob(user,user,30)) + if(do_after(user, 3 SECONDS)) if(reagents.total_volume >= amount_per_transfer_from_this)//if not empty user.visible_message(span_suicide("[user] pulls the trigger!")) src.spray(user) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 52f7d7da604e..cce4ba371e2d 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -78,7 +78,7 @@ target.visible_message(span_danger("[user] is trying to take a blood sample from [target]!"), \ span_userdanger("[user] is trying to take a blood sample from [target]!")) busy = TRUE - if(!do_mob(user, target, extra_checks=CALLBACK(L, /mob/living/proc/can_inject, null, TRUE, BODY_ZONE_CHEST, proj_piercing))) + if(!do_after(user, 3 SECONDS, target, extra_checks=CALLBACK(L, /mob/living/proc/can_inject, null, TRUE, BODY_ZONE_CHEST, proj_piercing))) busy = FALSE return if(reagents.total_volume >= reagents.maximum_volume) @@ -130,7 +130,7 @@ if(L != user) L.visible_message(span_danger("[user] is trying to inject [L]!"), \ span_userdanger("[user] is trying to inject [L]!")) - if(!do_mob(user, L, extra_checks=CALLBACK(L, /mob/living/proc/can_inject, null, FALSE, BODY_ZONE_CHEST, proj_piercing))) + if(!do_after(user, 3 SECONDS, L, extra_checks=CALLBACK(L, /mob/living/proc/can_inject, null, FALSE, BODY_ZONE_CHEST, proj_piercing))) return if(!reagents.total_volume) return diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 38031365e711..e0a4768daf5d 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -130,7 +130,7 @@ user.visible_message("[user] starts climbing into [src].", span_notice("You start climbing into [src]...")) else target.visible_message(span_danger("[user] starts putting [target] into [src]."), span_userdanger("[user] starts putting you into [src]!")) - if(do_mob(user, target, 20)) + if(do_after(user, 2 SECONDS, target)) if (!loc) return target.forceMove(src) diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 6ece919e6b8c..81c9af519540 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -952,7 +952,7 @@ return if(user != L) L.visible_message(span_notice("[user] tries to feed [src] to [L]..."), span_boldwarning("[user] tries to feed [src] to you!")) - if(!do_mob(user, L, 10 SECONDS)) + if(!do_after(user, 10 SECONDS, L)) return if(iscarbon(L)) var/mob/living/carbon/C = L diff --git a/code/modules/spells/spell_types/devil.dm b/code/modules/spells/spell_types/devil.dm index fa10bbc0f116..150e750113bf 100644 --- a/code/modules/spells/spell_types/devil.dm +++ b/code/modules/spells/spell_types/devil.dm @@ -114,7 +114,7 @@ if(is_jaunting(user)) if(valid_location(user)) to_chat(user, span_warning("You are now phasing in.")) - if(do_mob(user,user,150)) + if(do_after(user, 15 SECONDS)) if(valid_location(user)) user.infernalphasein() else @@ -127,7 +127,7 @@ user.notransform = TRUE user.fakefire() to_chat(src, span_warning("You begin to phase back into sinful flames.")) - if(do_mob(user,user,150)) + if(do_after(user, 15 SECONDS)) user.infernalphaseout() else to_chat(user, span_warning("You must remain still while exiting.")) diff --git a/code/modules/surgery/helpers.dm b/code/modules/surgery/helpers.dm index d4afbd49b49c..1e2323cb72b9 100644 --- a/code/modules/surgery/helpers.dm +++ b/code/modules/surgery/helpers.dm @@ -92,7 +92,7 @@ /proc/attempt_cancel_surgery(datum/surgery/S, obj/item/I, mob/living/M, mob/user) var/selected_zone = user.zone_selected to_chat(user, span_notice("You begin to cancel \the [S].")) - if(!do_mob(user, M, 3 SECONDS)) + if(!do_after(user, 3 SECONDS, M)) return if(S.status == 1) M.surgeries -= S diff --git a/code/modules/swarmers/swarmer.dm b/code/modules/swarmers/swarmer.dm index ed0ddf3655f2..1df79557fef5 100644 --- a/code/modules/swarmers/swarmer.dm +++ b/code/modules/swarmers/swarmer.dm @@ -232,7 +232,7 @@ to_chat(src, span_info("Attempting to remove this being from our presence.")) - if(!do_mob(src, target, 30)) + if(!do_after(src, 3 SECONDS, target)) return teleport_target(target) @@ -283,7 +283,7 @@ if(last_alert < world.time) last_alert = world.time + 5 SECONDS priority_announce("Connection encryption violation in machine: [target]! Deconstruction projected to complete in: 30 SECONDS") - if(do_mob(src, target, dismantle_time)) + if(do_after(src, dismantle_time, target)) balloon_or_message(src, "dismantling complete", \ span_info("Dismantling complete.")) var/atom/target_loc = target.drop_location() @@ -338,7 +338,7 @@ balloon_or_message(src, "not enough resources", \ span_warning("We do not have the resources for this!")) return - if(!do_mob(src, src, 1 SECONDS)) + if(!do_after(src, 1 SECONDS)) return Fabricate(/obj/structure/swarmer/blockade, 4) @@ -360,7 +360,7 @@ balloon_or_message(src, "not a suitable location", \ span_warning("This is not a suitable location for replicating ourselves. We need more room.")) return - if(!do_mob(src, src, 5 SECONDS)) + if(!do_after(src, 5 SECONDS)) return var/createtype = swarmer_type_to_create() if(!createtype) @@ -390,7 +390,7 @@ if(!isturf(loc)) return to_chat(src, span_info("Attempting to repair damage to our body, stand by...")) - if(!do_mob(src, src, 10 SECONDS)) + if(!do_after(src, 10 SECONDS)) return adjustHealth(-maxHealth) balloon_or_message(src, "successfully repaired" ,\ diff --git a/code/modules/vehicles/cars/car.dm b/code/modules/vehicles/cars/car.dm index 52f43d6030cf..921ccae0e0d9 100644 --- a/code/modules/vehicles/cars/car.dm +++ b/code/modules/vehicles/cars/car.dm @@ -80,7 +80,7 @@ if(occupant_amount() >= max_occupants) return FALSE var/atom/old_loc = loc - if(do_mob(forcer, M, get_enter_delay(M), extra_checks=CALLBACK(src, /obj/vehicle/sealed/car/proc/is_car_stationary, old_loc))) + if(do_after(forcer, get_enter_delay(M), M, extra_checks=CALLBACK(src, /obj/vehicle/sealed/car/proc/is_car_stationary, old_loc))) mob_forced_enter(M, silent) return TRUE return FALSE diff --git a/yogstation/code/datums/antagonists/vampire.dm b/yogstation/code/datums/antagonists/vampire.dm index db7cf3def63d..716435b6a169 100644 --- a/yogstation/code/datums/antagonists/vampire.dm +++ b/yogstation/code/datums/antagonists/vampire.dm @@ -278,7 +278,7 @@ H.LAssailant = null else H.LAssailant = WEAKREF(O) - while(do_mob(O, H, 50)) + while(do_after(O, 5 SECONDS, H)) if(!is_vampire(O)) to_chat(O, span_warning("Your fangs have disappeared!")) return diff --git a/yogstation/code/datums/martial/explosive_fist.dm b/yogstation/code/datums/martial/explosive_fist.dm index 649da6e3e952..ac0f0016c9bc 100644 --- a/yogstation/code/datums/martial/explosive_fist.dm +++ b/yogstation/code/datums/martial/explosive_fist.dm @@ -288,7 +288,7 @@ /datum/martial_art/explosive_fist/proc/proceed_lifeforce_trade(mob/living/carbon/human/A, mob/living/carbon/human/D)//lifeforce trade loop if(!can_suck_life(A, D)) return - if(!do_mob(A, D, 1 SECONDS)) + if(!do_after(A, 1 SECONDS, D)) return if(!can_suck_life(A, D)) return diff --git a/yogstation/code/datums/martial/garden_warfare.dm b/yogstation/code/datums/martial/garden_warfare.dm index 9be45af909f7..cf466aa7ff1c 100644 --- a/yogstation/code/datums/martial/garden_warfare.dm +++ b/yogstation/code/datums/martial/garden_warfare.dm @@ -146,7 +146,7 @@ /datum/martial_art/gardern_warfare/proc/final_strangle(mob/living/carbon/human/A, mob/living/carbon/human/D) if(!can_strangle(A, D)) return - if(!do_mob(A, D, 1 SECONDS)) + if(!do_after(A, 1 SECONDS, D)) return if(!can_strangle(A, D)) return diff --git a/yogstation/code/game/gamemodes/vampire/vampire_powers.dm b/yogstation/code/game/gamemodes/vampire/vampire_powers.dm index 31a057fea264..a02259ea3d55 100644 --- a/yogstation/code/game/gamemodes/vampire/vampire_powers.dm +++ b/yogstation/code/game/gamemodes/vampire/vampire_powers.dm @@ -253,7 +253,7 @@ return to_chat(target, span_boldwarning("Your knees suddenly feel heavy. Your body begins to sink to the floor.")) to_chat(user, span_notice("[target] is now under your spell. In four seconds they will be rendered unconscious as long as they are within close range.")) - if(do_mob(user, target, 40, TRUE)) // 4 seconds... + if(do_after(user, 4 SECONDS, target)) // 4 seconds... if(get_dist(user, T) <= 3) flash_color(T, flash_color="#472040", flash_time=30) // it's the vampires color! T.SetSleeping(300) @@ -524,7 +524,7 @@ if(3) to_chat(target, span_danger("The world blanks out, and you see a demo- no ange- demon- lil- glory- blessing... Lilith.")) to_chat(user, span_notice("Excitement builds up in you as [target] sees the blessing of Lilith.")) - if(!do_mob(user, target, 70)) + if(!do_after(user, 7 SECONDS, target)) to_chat(user, span_danger("The pact has failed! [target] has not became a vampire.")) to_chat(target, span_notice("The visions stop, and you relax.")) vamp.usable_blood += blood_used / 2 // Refund half the cost diff --git a/yogstation/code/modules/antagonists/darkspawn/darkspawn_objects/dark_bead.dm b/yogstation/code/modules/antagonists/darkspawn/darkspawn_objects/dark_bead.dm index d84b955f0cdc..48b4bc757cc9 100644 --- a/yogstation/code/modules/antagonists/darkspawn/darkspawn_objects/dark_bead.dm +++ b/yogstation/code/modules/antagonists/darkspawn/darkspawn_objects/dark_bead.dm @@ -65,7 +65,7 @@ to_chat(L, span_userdanger("AAAAAAAAAAAAAA-")) L.silent += 4 playsound(L, 'yogstation/sound/magic/devour_will.ogg', 65, FALSE) //T A S T Y S O U L S - if(!do_mob(user, L, 3 SECONDS)) + if(!do_after(user, 3 SECONDS, L)) REMOVE_TRAIT(L, TRAIT_PARALYSIS, "bead-trait") user.Knockdown(3 SECONDS) to_chat(L, span_boldwarning("All right. You're all right.")) @@ -77,7 +77,7 @@ "AAAAAAAAAAAAAAA-") to_chat(user, span_velvet("cera qo...
You begin siphoning [L]'s will...")) playsound(L, 'yogstation/sound/magic/devour_will_long.ogg', 65, FALSE) - if(!do_mob(user, L, 5 SECONDS)) + if(!do_after(user, 5 SECONDS, L)) REMOVE_TRAIT(L, TRAIT_PARALYSIS, "bead-trait") user.Knockdown(5 SECONDS) to_chat(L, span_boldwarning("All right. You're all right.")) diff --git a/yogstation/code/modules/antagonists/shadowling/shadowling_abilities.dm b/yogstation/code/modules/antagonists/shadowling/shadowling_abilities.dm index fa3c739017ff..db2087d4c817 100644 --- a/yogstation/code/modules/antagonists/shadowling/shadowling_abilities.dm +++ b/yogstation/code/modules/antagonists/shadowling/shadowling_abilities.dm @@ -300,7 +300,7 @@ to_chat(user, span_notice("They are protected by an implant. You begin to shut down the nanobots in their brain - this will take some time...")) user.visible_message(span_warning("[user] pauses, then dips their head in concentration!")) to_chat(target, span_boldannounce("You feel your mental protection faltering!")) - if(!do_mob(user, target, 65 SECONDS)) //65 seconds to remove a loyalty implant. yikes! + if(!do_after(user, 65 SECONDS, target)) //65 seconds to remove a loyalty implant. yikes! to_chat(user, span_warning("The enthralling has been interrupted - your target's mind returns to its previous state.")) to_chat(target, span_userdanger("You wrest yourself away from [user]'s hands and compose yourself!")) enthralling = FALSE @@ -315,7 +315,7 @@ to_chat(user, span_notice("You begin planting the tumor that will control the new thrall...")) user.visible_message(span_warning("A strange energy passes from [user]'s hands into [target]'s head!")) to_chat(target, span_boldannounce("You feel your memories twisting, morphing. A sense of horror dominates your mind.")) - if(!do_mob(user, target, 7 SECONDS)) //around 21 seconds total for enthralling, 86 for someone with a loyalty implant + if(!do_after(user, 7 SECONDS, target)) //around 21 seconds total for enthralling, 86 for someone with a loyalty implant to_chat(user, span_warning("The enthralling has been interrupted - your target's mind returns to its previous state.")) to_chat(target, span_userdanger("You wrest yourself away from [user]'s hands and compose yourself!")) enthralling = FALSE @@ -638,7 +638,7 @@ user.visible_message(span_danger("[user] places their hands over [thrallToEmpower]'s face, red light shining from beneath."), \ span_shadowling("You place your hands on [thrallToEmpower]'s face and begin gathering energy...")) to_chat(thrallToEmpower, span_userdanger("[user] places their hands over your face. You feel energy gathering. Stand still...")) - if(!do_mob(user, thrallToEmpower, 8 SECONDS)) + if(!do_after(user, 8 SECONDS, thrallToEmpower)) to_chat(user, span_warning("Your concentration snaps. The flow of energy ebbs.")) return to_chat(user, span_shadowling("You release a massive surge of power into [thrallToEmpower]!")) @@ -649,7 +649,7 @@ thrallToEmpower.Knockdown(5) thrallToEmpower.visible_message(span_warning("[thrallToEmpower] collapses, their skin and face distorting!"), \ span_userdanger("AAAAAAAAAAAAAAAAAAAGH-")) - if (!do_mob(user, thrallToEmpower, 5)) + if (!do_after(user, 5, thrallToEmpower)) thrallToEmpower.Unconscious(1 MINUTES) thrallToEmpower.visible_message(span_warning("[thrallToEmpower] gasps, and passes out!"), span_warning("That... feels nice....")) to_chat(user, span_warning("We have been interrupted! [thrallToEmpower] will need to rest to recover.")) @@ -703,7 +703,7 @@ user.visible_message(span_danger("[user] kneels over [thrallToRevive], placing their hands on \his chest."), \ span_shadowling("You crouch over the body of your thrall and begin gathering energy...")) thrallToRevive.notify_ghost_cloning("Your masters are resuscitating you! Re-enter your corpse if you wish to be brought to life.", source = thrallToRevive) - if(!do_mob(user, thrallToRevive, 30)) + if(!do_after(user, 3 SECONDS, thrallToRevive)) to_chat(user, span_warning("Your concentration snaps. The flow of energy ebbs.")) return to_chat(user, span_shadowling("You release a massive surge of power into [thrallToRevive]!")) @@ -711,18 +711,19 @@ playsound(thrallToRevive, 'sound/weapons/Egloves.ogg', 50, 1) playsound(thrallToRevive, 'sound/machines/defib_zap.ogg', 50, 1) user.Beam(thrallToRevive,icon_state="red_lightning",time=1) - var/b = do_mob(user, thrallToRevive, 20) if(thrallToRevive.revive(full_heal = 1)) - thrallToRevive.visible_message(span_boldannounce("[thrallToRevive] heaves in breath, dim red light shining in their eyes."), \ - span_shadowling("You have returned. One of your masters has brought you from the darkness beyond.")) + thrallToRevive.visible_message( + span_boldannounce("[thrallToRevive] heaves in breath, dim red light shining in their eyes."), \ + span_shadowling("You have returned. One of your masters has brought you from the darkness beyond."), \ + ) thrallToRevive.Knockdown(4) thrallToRevive.emote("gasp") playsound(thrallToRevive, "bodyfall", 50, 1) - if (!b) + if (!do_after(user, 2 SECONDS, thrallToRevive)) thrallToRevive.Knockdown(50) thrallToRevive.Unconscious(500) thrallToRevive.visible_message(span_boldannounce("[thrallToRevive] collapses in exhaustion."), \ - span_warning("You collapse in exhaustion... nap..... dark.")) + span_warning("You collapse in exhaustion... nap..... dark.")) return TRUE diff --git a/yogstation/code/modules/antagonists/shadowling/special_shadowling_abilities.dm b/yogstation/code/modules/antagonists/shadowling/special_shadowling_abilities.dm index a1d0daeafa56..4b1b2f9f39a0 100644 --- a/yogstation/code/modules/antagonists/shadowling/special_shadowling_abilities.dm +++ b/yogstation/code/modules/antagonists/shadowling/special_shadowling_abilities.dm @@ -33,7 +33,7 @@ var/temp_flags = H.status_flags H.status_flags |= GODMODE //Can't die while hatching H.unequip_everything() - if(!do_mob(H,H,50,1)) + if(!do_after(H, 5 SECONDS)) return var/turf/shadowturf = get_turf(user) for(var/turf/open/floor/F in orange(1, user)) @@ -43,28 +43,28 @@ new /obj/structure/alien/weeds/node(shadowturf) //Dim lighting in the chrysalis -- removes itself afterwards H.visible_message(span_warning("A chrysalis forms around [H], sealing them inside."), \ span_shadowling("You create your chrysalis and begin to contort within.")) - if(!do_mob(H,H,100,1)) + if(!do_after(H, 10 SECONDS)) return H.visible_message(span_warning("The skin on [H]'s back begins to split apart. Black spines slowly emerge from the divide."), \ span_shadowling("Spines pierce your back. Your claws break apart your fingers. You feel excruciating pain as your true form begins its exit.")) - if(!do_mob(H,H,90,1)) + if(!do_after(H, 9 SECONDS)) return H.visible_message(span_warning("[H], skin shifting, begins tearing at the walls around them."), \ span_shadowling("Your false skin slips away. You begin tearing at the fragile membrane protecting you.")) - if(!do_mob(H,H,80,1)) + if(!do_after(H, 8 SECONDS)) return playsound(H.loc, 'sound/weapons/slash.ogg', 25, 1) to_chat(H, "You rip and slice.") - if(!do_mob(H,H,10,1)) + if(!do_after(H, 1 SECONDS)) return playsound(H.loc, 'sound/weapons/slashmiss.ogg', 25, 1) to_chat(H, "The chrysalis falls like water before you.") - if(!do_mob(H,H,10,1)) + if(!do_after(H, 1 SECONDS)) return playsound(H.loc, 'sound/weapons/slice.ogg', 25, 1) to_chat(H, "You are free!") H.status_flags = temp_flags - if(!do_mob(H,H,10,1)) + if(!do_after(H, 1 SECONDS)) return playsound(H.loc, 'sound/effects/ghost.ogg', 100, 1) var/newNameId = pick(GLOB.nightmare_names) @@ -101,7 +101,7 @@ H.set_species(/datum/species/shadow/ling) //can't be a shadowling without being a shadowling H.dna.remove_all_mutations(list(MUT_NORMAL, MUT_EXTRA), TRUE) Remove(H) - if(!do_mob(H,H,10,1)) + if(!do_after(H, 10 SECONDS)) return to_chat(H, span_shadowling("Your powers are awoken. You may now live to your fullest extent. Remember your goal. Cooperate with your thralls and allies.")) @@ -162,28 +162,28 @@ span_shadowling("You rise into the air and get ready for your transformation.")) for(var/obj/item/I in H) //drops all items H.unequip_everything(I) - if(!do_mob(H,H,50,1)) + if(!do_after(H, 5 SECONDS)) return H.visible_message(span_warning("[H]'s skin begins to crack and harden."), \ span_shadowling("Your flesh begins creating a shield around yourself.")) - if(!do_mob(H,H,100,1)) + if(!do_after(H, 10 SECONDS)) return H.visible_message(span_warning("The small horns on [H]'s head slowly grow and elongate."), \ span_shadowling("Your body continues to mutate. Your telepathic abilities grow.")) //y-your horns are so big, senpai...!~ - if(!do_mob(H,H,90,1)) + if(!do_after(H, 9 SECONDS)) return H.visible_message(span_warning("[H]'s body begins to violently stretch and contort."), \ span_shadowling("You begin to rend apart the final barriers to godhood.")) - if(!do_mob(H,H,40,1)) + if(!do_after(H, 4 SECONDS)) return to_chat(H, "Yes!") - if(!do_mob(H,H,10,1)) + if(!do_after(H, 1 SECONDS)) return to_chat(H, "[span_big("YES!!")]") - if(!do_mob(H,H,10,1)) + if(!do_after(H, 1 SECONDS)) return to_chat(H, "[span_reallybig("YE--")]") - if(!do_mob(H,H,1,1)) + if(!do_after(H, 0.1 SECONDS)) return for(var/mob/living/M in orange(7, H)) M.Knockdown(10) diff --git a/yogstation/code/modules/guardian/abilities/minor/teleport.dm b/yogstation/code/modules/guardian/abilities/minor/teleport.dm index 0829f839a818..b45052654c18 100644 --- a/yogstation/code/modules/guardian/abilities/minor/teleport.dm +++ b/yogstation/code/modules/guardian/abilities/minor/teleport.dm @@ -42,7 +42,7 @@ target.visible_message(span_danger("[target] starts to glow faintly!"), span_userdanger("You start to faintly glow, and you feel strangely weightless!")) guardian.do_attack_animation(target) - if(!do_mob(guardian, target, 5 SECONDS)) //now start the channel + if(!do_after(guardian, 5 SECONDS, target)) //now start the channel to_chat(guardian, span_bolddanger("You need to hold still!")) return diff --git a/yogstation/code/modules/guardian/standarrow.dm b/yogstation/code/modules/guardian/standarrow.dm index f55350021711..6b35b794c782 100644 --- a/yogstation/code/modules/guardian/standarrow.dm +++ b/yogstation/code/modules/guardian/standarrow.dm @@ -36,7 +36,7 @@ var/mob/living/carbon/H = M var/mob/living/simple_animal/hostile/guardian/G = M user.visible_message(span_warning("[user] prepares to stab [H] with [src]!"), span_notice("You raise [src] into the air.")) - if (do_mob(user, H, 5 SECONDS, uninterruptible=FALSE)) + if (do_after(user, 5 SECONDS, H)) if (LAZYLEN(H.hasparasites()) || (H.mind && H.mind.has_antag_datum(/datum/antagonist/changeling)) || (isguardian(M) && (users[G] || G.requiem || G.transforming || !can_requiem))) H.visible_message(span_holoparasite("[src] rejects [H]!")) return diff --git a/yogstation/code/modules/mob/living/carbon/carbon.dm b/yogstation/code/modules/mob/living/carbon/carbon.dm index abbec2868985..bc250511a6d1 100644 --- a/yogstation/code/modules/mob/living/carbon/carbon.dm +++ b/yogstation/code/modules/mob/living/carbon/carbon.dm @@ -34,7 +34,7 @@ /mob/living/carbon/proc/devour_mob(mob/living/carbon/C, devour_time = 130) C.visible_message(span_danger("[src] is attempting to devour [C]!"), \ span_userdanger("[src] is attempting to devour you!")) - if(!do_mob(src, C, devour_time)) + if(!do_after(src, devour_time, C)) return if(pulling && pulling == C && grab_state >= GRAB_AGGRESSIVE && a_intent == INTENT_GRAB) C.visible_message(span_danger("[src] devours [C]!"), \ diff --git a/yogstation/code/modules/reagents/reagent_containers/gummies.dm b/yogstation/code/modules/reagents/reagent_containers/gummies.dm index 0abb4c9264ea..bd00ffda4385 100644 --- a/yogstation/code/modules/reagents/reagent_containers/gummies.dm +++ b/yogstation/code/modules/reagents/reagent_containers/gummies.dm @@ -40,14 +40,14 @@ if(M == user) M.visible_message(span_notice("[user] attempts to [apply_method] [src].")) if(self_delay) - if(!do_mob(user, M, self_delay)) + if(!do_after(user, self_delay, M)) return FALSE to_chat(M, span_notice("You [apply_method] [src].")) else M.visible_message(span_danger("[user] attempts to force [M] to [apply_method] [src]."), \ span_userdanger("[user] attempts to force [M] to [apply_method] [src].")) - if(!do_mob(user, M)) + if(!do_after(user, 3 SECONDS, M)) return FALSE M.visible_message(span_danger("[user] forces [M] to [apply_method] [src]."), \ span_userdanger("[user] forces [M] to [apply_method] [src].")) From 045730bd5c7fa3a154de9e1a937ecd60761ac759 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 23 Jul 2023 11:18:38 -0400 Subject: [PATCH 05/13] Now breaks the compile :+1: --- code/datums/progressbar.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index e3f56dc3cbb9..828ad3246289 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -39,7 +39,7 @@ bar.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA user = User - LAZYADDASSOC(user.progressbars, bar_loc, src) //TODO: LAZYADDASSOCLIST + LAZYADDASSOCLIST(user.progressbars, bar_loc, src) var/list/bars = user.progressbars[bar_loc] listindex = bars.len From f7eac136e0860341d25c5f8b20aa2c871ebb1acc Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Fri, 28 Jul 2023 19:04:36 -0400 Subject: [PATCH 06/13] Goes over current do_afters and fixes problems I found --- code/game/machinery/computer/law.dm | 2 +- code/game/machinery/decontamination.dm | 2 +- code/game/machinery/dna_scanner.dm | 2 +- code/game/objects/effects/spiders.dm | 2 +- code/game/objects/items/clown_items.dm | 6 +++--- code/game/objects/items/implants/implantchair.dm | 2 +- code/game/objects/items/stacks/stack.dm | 2 +- .../structures/crates_lockers/closets/bluespace_locker.dm | 2 +- code/game/objects/structures/flora.dm | 2 +- code/game/objects/structures/kitchen_spike.dm | 2 +- code/game/objects/structures/morgue.dm | 2 +- code/modules/antagonists/abductor/machinery/experiment.dm | 2 +- .../antagonists/clockcult/clock_structures/stargazer.dm | 2 +- code/modules/religion/religion_structures.dm | 2 +- code/modules/research/nanites/nanite_chamber.dm | 2 +- code/modules/research/nanites/public_chamber.dm | 2 +- code/modules/shuttle/navigation_computer.dm | 2 +- yogstation/code/game/objects/items/wielded/vxtvulhammer.dm | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 1ae69d38f956..1d94d7aaa442 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -57,7 +57,7 @@ user.visible_message(span_warning("[user] begins typing on [src].")) to_chat(user, span_warning("You begin to alter the laws of [current] to enable it to assist you in your goals. This will take 30 seconds.")) var/obj/item/aiModule/core/full/revolutionary/M = new - if(do_after(user, 300, src)) + if(do_after(user, 30 SECONDS, src)) if(upload_check(user)) M.install(current.laws, user) else diff --git a/code/game/machinery/decontamination.dm b/code/game/machinery/decontamination.dm index d0eaa02f941e..878cb7e0d2be 100644 --- a/code/game/machinery/decontamination.dm +++ b/code/game/machinery/decontamination.dm @@ -223,7 +223,7 @@ user.visible_message(span_notice("You hear someone kicking against the doors of [src]!"), \ span_notice("You start kicking against the doors... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a thump from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src ) return user.visible_message(span_warning("[user] successfully broke out of [src]!"), \ diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 7492975e1ac3..116bfc7f9649 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -79,7 +79,7 @@ user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \ span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a metallic creaking from [src].")) - if(do_after(user,(breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src || state_open || !locked) return locked = FALSE diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index a71ab92540fb..9ed7e0a2a23e 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -216,7 +216,7 @@ user.last_special = world.time + CLICK_CD_BREAKOUT to_chat(user, span_notice("You struggle against the tight bonds... (This will take about [DisplayTimeText(breakout_time)].)")) visible_message("You see something struggling and writhing in \the [src]!") - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src) return qdel(src) diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm index f3ae6e3a40cf..1c6cad4140e7 100644 --- a/code/game/objects/items/clown_items.dm +++ b/code/game/objects/items/clown_items.dm @@ -104,7 +104,7 @@ to_chat(user, span_warning("You need to take that [target.name] off before cleaning it!")) else if(istype(target, /obj/effect/decal/cleanable)) user.visible_message("[user] begins to scrub \the [target.name] out with [src].", span_warning("You begin to scrub \the [target.name] out with [src]...")) - if(do_after(user, src.cleanspeed, target)) + if(do_after(user, cleanspeed, target)) to_chat(user, span_notice("You scrub \the [target.name] out.")) qdel(target) decreaseUses(user) @@ -118,7 +118,7 @@ return else if(istype(target, /obj/structure/window)) user.visible_message("[user] begins to clean \the [target.name] with [src]...", span_notice("You begin to clean \the [target.name] with [src]...")) - if(do_after(user, src.cleanspeed, target)) + if(do_after(user, cleanspeed, target)) to_chat(user, span_notice("You clean \the [target.name].")) target.remove_atom_colour(WASHABLE_COLOUR_PRIORITY) var/obj/structure/window/our_window = target @@ -130,7 +130,7 @@ decreaseUses(user) else user.visible_message("[user] begins to clean \the [target.name] with [src]...", span_notice("You begin to clean \the [target.name] with [src]...")) - if(do_after(user, src.cleanspeed, target)) + if(do_after(user, cleanspeed, target)) to_chat(user, span_notice("You clean \the [target.name].")) target.wash(CLEAN_SCRUB) target.remove_atom_colour(WASHABLE_COLOUR_PRIORITY) diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index df97c796fc88..e3aadfe0fe34 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -130,7 +130,7 @@ user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \ span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a metallic creaking from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src || state_open) return user.visible_message(span_warning("[user] successfully broke out of [src]!"), \ diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 74258fa79e39..c4b03c4c9928 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -205,7 +205,7 @@ var/adjusted_time = 0 usr.visible_message("[usr] starts building \a [R.title].", "You start building \a [R.title]...") adjusted_time = R.time - if(!do_after(usr, adjusted_time, target = usr)) + if(!do_after(usr, adjusted_time, usr)) return if(!building_checks(R, multiplier)) return diff --git a/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm b/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm index 07592148e1dc..817974090a18 100644 --- a/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm +++ b/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm @@ -74,7 +74,7 @@ user.last_special = world.time + CLICK_CD_BREAKOUT other.visible_message(span_warning("[other] begins to shake violently!")) to_chat(user, span_notice("You start pushing the door open... (this will take about [DisplayTimeText(other.breakout_time)].)")) - if(do_after(user, (other.breakout_time), src)) + if(do_after(user, other.breakout_time, src)) if(!user || user.stat != CONSCIOUS || other.opened || (!other.locked && !other.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/flora.dm b/code/game/objects/structures/flora.dm index 678e3983b9d8..6d2233c94104 100644 --- a/code/game/objects/structures/flora.dm +++ b/code/game/objects/structures/flora.dm @@ -18,7 +18,7 @@ if(W.hitsound) playsound(get_turf(src), W.hitsound, 100, 0, 0) user.visible_message(span_notice("[user] begins to cut down [src] with [W]."),span_notice("You begin to cut down [src] with [W]."), "You hear the sound of sawing.") - if(do_after(user, 1000/W.force, src)) //5 seconds with 20 force, 8 seconds with a hatchet, 20 seconds with a shard. + if(do_after(user, (1000 / W.force), src)) //5 seconds with 20 force, 8 seconds with a hatchet, 20 seconds with a shard. user.visible_message(span_notice("[user] fells [src] with the [W]."),span_notice("You fell [src] with the [W]."), "You hear the sound of a tree falling.") playsound(get_turf(src), 'sound/effects/meteorimpact.ogg', 100 , 0, 0) for(var/i=1 to log_amount) diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index b69624f8a005..6ec31322253d 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -64,7 +64,7 @@ /obj/structure/kitchenspike/attack_hand(mob/user) if(VIABLE_MOB_CHECK(user.pulling) && user.a_intent == INTENT_GRAB && !has_buckled_mobs()) var/mob/living/L = user.pulling - if(do_after(user, src, 120)) + if(do_after(user, 12 SECONDS, src)) if(has_buckled_mobs()) //to prevent spam/queing up attacks return if(L.buckled) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 045bb3fbc9ff..13f49071368a 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -112,7 +112,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an user.visible_message(null, \ span_notice("You lean on the back of [src] and start pushing the tray open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a metallic creaking from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src ) return user.visible_message(span_warning("[user] successfully broke out of [src]!"), \ diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index 9c29c3516d5b..d210a4effbe7 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -47,7 +47,7 @@ user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \ span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_hear("You hear a metallic creaking from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src || state_open) return user.visible_message(span_warning("[user] successfully broke out of [src]!"), \ diff --git a/code/modules/antagonists/clockcult/clock_structures/stargazer.dm b/code/modules/antagonists/clockcult/clock_structures/stargazer.dm index 729b95052f15..ed7d2dc75e5e 100644 --- a/code/modules/antagonists/clockcult/clock_structures/stargazer.dm +++ b/code/modules/antagonists/clockcult/clock_structures/stargazer.dm @@ -108,7 +108,7 @@ to_chat(user, "[I] has already been enhanced!") return to_chat(user, "You begin placing [I] onto [src].") - if(do_after(user, 60, I)) + if(do_after(user, 6 SECONDS, I)) if(cooldowntime > world.time) to_chat(user, "[src] is still warming up, it will be ready in [DisplayTimeText(cooldowntime - world.time)].") return diff --git a/code/modules/religion/religion_structures.dm b/code/modules/religion/religion_structures.dm index 4a3d455f9438..4684912245ac 100644 --- a/code/modules/religion/religion_structures.dm +++ b/code/modules/religion/religion_structures.dm @@ -28,7 +28,7 @@ to_chat(user, span_warning("[pushed_mob] is buckled to [pushed_mob.buckled]!")) return ..() to_chat(user, span_notice("You try to coax [pushed_mob] onto [src]...")) - if(!do_after(user, (5 SECONDS), pushed_mob)) + if(!do_after(user, 5 SECONDS, pushed_mob)) return ..() pushed_mob.forceMove(loc) return ..() diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index f7dec9341ae9..eab01d5c3544 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -155,7 +155,7 @@ user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \ span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a metallic creaking from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src || state_open || !locked || busy) return locked = FALSE diff --git a/code/modules/research/nanites/public_chamber.dm b/code/modules/research/nanites/public_chamber.dm index a90708d6f12e..05fe09ab5cd0 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -110,7 +110,7 @@ user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \ span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \ span_italics("You hear a metallic creaking from [src].")) - if(do_after(user, (breakout_time), src)) + if(do_after(user, breakout_time, src)) if(!user || user.stat != CONSCIOUS || user.loc != src || state_open || !locked || busy) return locked = FALSE diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index dea8db39f1fc..6483d3153f1a 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -120,7 +120,7 @@ if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED)) to_chat(current_user, span_warning("Targeting transit location, please wait [DisplayTimeText(designate_time)]...")) designating_target_loc = the_eye.loc - var/wait_completed = do_after(current_user, designate_time, designating_target_loc, timed_action_flags = IGNORE_HELD_ITEM, 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/yogstation/code/game/objects/items/wielded/vxtvulhammer.dm b/yogstation/code/game/objects/items/wielded/vxtvulhammer.dm index 61669d8568c3..d61350831a92 100644 --- a/yogstation/code/game/objects/items/wielded/vxtvulhammer.dm +++ b/yogstation/code/game/objects/items/wielded/vxtvulhammer.dm @@ -109,7 +109,7 @@ to_chat(user, span_notice("You begin charging the weapon, concentration flowing into it...")) user.visible_message(span_warning("[user] flicks the hammer on, tilting [user.p_their()] head down as if in thought.")) spark_system.start() //Generates sparks when you charge - if(!do_mob(user, user, ispreternis(user)? 5 SECONDS : 6 SECONDS)) + if(!do_after(user, ispreternis(user)? 5 SECONDS : 6 SECONDS)) if(!charging) //So no duplicate messages return to_chat(user, span_notice("You flip the switch off as you lose your focus.")) From 5842499cdcf7653e919226bace3bc3153959b7c8 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:08:26 -0400 Subject: [PATCH 07/13] Increases CPR speed --- code/modules/mob/living/carbon/human/human.dm | 106 +++++++++++------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a478c861539c..a41eb4e0f1ed 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -621,55 +621,83 @@ to_chat(src, span_warning("\The [S] pulls \the [hand] from your grip!")) rad_act(current_size * 3) -/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/C) - CHECK_DNA_AND_SPECIES(C) +#define CPR_PANIC_SPEED (0.8 SECONDS) - if(C.stat == DEAD || (HAS_TRAIT(C, TRAIT_FAKEDEATH))) - to_chat(src, span_warning("[C.name] is dead!")) +/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/target) + CHECK_DNA_AND_SPECIES(target) + + if(target == src) return - if(is_mouth_covered()) - to_chat(src, span_warning("Remove your mask first!")) - return 0 - if(C.is_mouth_covered()) - to_chat(src, span_warning("Remove [p_their()] mask first!")) - return 0 - - if(C.cpr_time < world.time + 30) - visible_message(span_notice("[src] is trying to perform CPR on [C.name]!"), \ - span_notice("You try to perform CPR on [C.name]... Hold still!")) - if(!do_after(src, 3 SECONDS, C)) - to_chat(src, span_warning("You fail to perform CPR on [C]!")) - return 0 - - var/they_breathe = !HAS_TRAIT_FROM(C, TRAIT_NOBREATH, SPECIES_TRAIT) - var/they_lung = C.getorganslot(ORGAN_SLOT_LUNGS) - var/they_ashlung = C.getorgan(/obj/item/organ/lungs/ashwalker) // yogs - Do they have ashwalker lungs? - var/we_ashlung = getorgan(/obj/item/organ/lungs/ashwalker) // yogs - Does the guy doing CPR have ashwalker lungs? - if(C.health > C.crit_threshold) - return + var/panicking = FALSE + + do + + if (DOING_INTERACTION_WITH_TARGET(src, target)) + return FALSE + + if (target.stat == DEAD || HAS_TRAIT(target, TRAIT_FAKEDEATH)) + to_chat(src, span_warning("[target.name] is dead!")) + return FALSE + + if (is_mouth_covered()) + to_chat(src, span_warning("Remove your mask first!")) + return FALSE + + if (target.is_mouth_covered()) + to_chat(src, span_warning("Remove [p_their()] mask first!")) + return FALSE + + if (!getorganslot(ORGAN_SLOT_LUNGS)) + to_chat(src, span_warning("You have no lungs to breathe with, so you cannot perform CPR!")) + return FALSE + + if (HAS_TRAIT(src, TRAIT_NOBREATH)) + to_chat(src, span_warning("You do not breathe, so you cannot perform CPR!")) + return FALSE - src.visible_message("[src] performs CPR on [C.name]!", span_notice("You perform CPR on [C.name].")) + visible_message(span_notice("[src] is trying to perform CPR on [target.name]!"), \ + span_notice("You try to perform CPR on [target.name]... Hold still!")) + + if (!do_after(src, delay = panicking ? CPR_PANIC_SPEED : (3 SECONDS), target = target)) + to_chat(src, span_warning("You fail to perform CPR on [target]!")) + return FALSE + + if (target.health > target.crit_threshold) + return FALSE + + visible_message(span_notice("[src] performs CPR on [target.name]!"), span_notice("You perform CPR on [target.name].")) SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "saved_life", /datum/mood_event/saved_life) - C.cpr_time = world.time - log_combat(src, C, "CPRed") + log_combat(src, target, "CPRed") SSachievements.unlock_achievement(/datum/achievement/cpr, client) + + var/they_ashlung = target.getorgan(/obj/item/organ/lungs/ashwalker) // yogs - Do they have ashwalker lungs? + var/we_ashlung = getorgan(/obj/item/organ/lungs/ashwalker) // yogs - Does the guy doing CPR have ashwalker lungs? + + if (HAS_TRAIT(target, TRAIT_NOBREATH)) + to_chat(target, span_unconscious("You feel a breath of fresh air... which is a sensation you don't recognise...")) + else if (!target.getorganslot(ORGAN_SLOT_LUNGS)) + to_chat(target, span_unconscious("You feel a breath of fresh air... but you don't feel any better...")) // yogs start - can't CPR people with ash walker lungs whithout having them yourself - if(they_breathe && !!they_ashlung != !!we_ashlung) - C.adjustOxyLoss(10) - C.updatehealth() - to_chat(C, "You feel a breath of fresh air enter your lungs... you feel worse...") + else if(!!they_ashlung != !!we_ashlung) + target.adjustOxyLoss(10) + target.updatehealth() + to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs... you feel worse...")) SSachievements.unlock_achievement(/datum/achievement/anticpr, client) //you can get both achievements at the same time I guess //yogs end - else if(they_breathe && they_lung) - var/suff = min(C.getOxyLoss(), 7) - C.adjustOxyLoss(-suff) - C.updatehealth() - to_chat(C, span_unconscious("You feel a breath of fresh air enter your lungs... It feels good...")) - else if(they_breathe && !they_lung) - to_chat(C, span_unconscious("You feel a breath of fresh air... but you don't feel any better...")) else - to_chat(C, span_unconscious("You feel a breath of fresh air... which is a sensation you don't recognise...")) + target.adjustOxyLoss(-min(target.getOxyLoss(), 7)) + to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs... It feels good...")) + + if (target.health <= target.crit_threshold) + if (!panicking) + to_chat(src, span_warning("[target] still isn't up! You try harder!")) + panicking = TRUE + else + panicking = FALSE + while (panicking) + +#undef CPR_PANIC_SPEED /mob/living/carbon/human/cuff_resist(obj/item/I) if(dna && (dna.check_mutation(HULK) || dna.check_mutation(ACTIVE_HULK))) From abcca7e673c0e0b21473f1fd057258dd5cd4e0c7 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:52:01 -0400 Subject: [PATCH 08/13] you eat food faster too --- code/modules/food_and_drinks/food/snacks.dm | 90 ++++++++++++--------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index a6751b164404..b96a40e7b8d0 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -81,71 +81,83 @@ All foods are distributed among various categories. Use common sense. /obj/item/reagent_containers/food/snacks/attack_self(mob/user) return +#define FOOD_FAST_EATING (1 SECONDS) -/obj/item/reagent_containers/food/snacks/attack(mob/living/M, mob/living/user, def_zone) +/obj/item/reagent_containers/food/snacks/attack(mob/living/carbon/eater, mob/living/user, def_zone) if(user.a_intent == INTENT_HARM) return ..() + + if(!iscarbon(eater)) + return ..() + if(!eatverb) eatverb = pick("bite","chew","nibble","gnaw","gobble","chomp") - if(!reagents.total_volume) //Shouldn't be needed but it checks to see if it has anything left in it. - to_chat(user, span_notice("None of [src] left, oh no!")) - qdel(src) - return FALSE - if(iscarbon(M)) - var/mob/living/carbon/C = M - if(!canconsume(M, user)) + + var/eating_fast = FALSE + + do + if(!reagents.total_volume) //Shouldn't be needed but it checks to see if it has anything left in it. + to_chat(user, span_notice("None of [src] left, oh no!")) + qdel(src) return FALSE - var/fullness = M.nutrition + 10 - for(var/datum/reagent/consumable/con in M.reagents.reagent_list) //we add the nutrition value of what we're currently digesting + if (DOING_INTERACTION_WITH_TARGET(eater, src)) + return FALSE + + if(!canconsume(eater, user)) + return FALSE + + var/fullness = eater.nutrition + 10 + for(var/datum/reagent/consumable/con in eater.reagents.reagent_list) //we add the nutrition value of what we're currently digesting fullness += con.nutriment_factor * con.volume / con.metabolization_rate - if(M == user) //If you're eating it yourself. - if(junkiness && M.satiety < -150 && M.nutrition > NUTRITION_LEVEL_STARVING + 50 && !HAS_TRAIT(user, TRAIT_VORACIOUS)) - to_chat(M, span_notice("You don't feel like eating any more junk food at the moment.")) + var/time_to_eat = 3 SECONDS + if(user == eater) + if(eating_fast) + time_to_eat = FOOD_FAST_EATING + if(HAS_TRAIT(eater, TRAIT_VORACIOUS)) + time_to_eat /= 2 + else if(junkiness && eater.satiety < -150 && eater.nutrition > NUTRITION_LEVEL_STARVING + 50) + to_chat(eater, span_notice("You don't feel like eating any more junk food at the moment.")) return FALSE - - if(HAS_TRAIT(M, TRAIT_VORACIOUS)) - M.changeNext_move(CLICK_CD_MELEE * 0.5) //nom nom nom else - if(!isbrain(M)) //If you're feeding it to someone else. - if(!C.force_eat_text(fullness, src, C, user)) - return - if(!do_after(user, 3 SECONDS, M)) - return - log_combat(user, M, "fed", reagents.log_list()) - else - to_chat(user, span_warning("[M] doesn't seem to have a mouth!")) + if(!eater.force_eat_text(fullness, src, eater, user)) return + time_to_eat = 3 SECONDS - if(!C.eat_text(fullness, eatverb, src, C, user)) + if (!do_after(user, delay = time_to_eat, target = eater)) + return FALSE + + log_combat(user, eater, "fed", reagents.log_list()) + if(!eater.eat_text(fullness, eatverb, src, eater, user)) return if(!junkiness) var/ate_without_table = TRUE - for(var/obj/structure/table/table in range(1, M)) + for(var/obj/structure/table/table in range(1, eater)) ate_without_table = FALSE break if(ate_without_table) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "no_table", /datum/mood_event/ate_without_table) + SEND_SIGNAL(eater, COMSIG_ADD_MOOD_EVENT, "no_table", /datum/mood_event/ate_without_table) else - SEND_SIGNAL(M, COMSIG_CLEAR_MOOD_EVENT, "no_table") + SEND_SIGNAL(eater, COMSIG_CLEAR_MOOD_EVENT, "no_table") - if(reagents) //Handle ingestion of the reagent. - if(M.satiety > -200) - M.satiety -= junkiness - playsound(M.loc,'sound/items/eatfood.ogg', rand(10,50), 1) + if(reagents) //Handle ingestion of the reagent. + if(eater.satiety > -200) + eater.satiety -= junkiness + playsound(eater.loc,'sound/items/eatfood.ogg', rand(10,50), 1) if(reagents.total_volume) - SEND_SIGNAL(src, COMSIG_FOOD_EATEN, M, user) + SEND_SIGNAL(src, COMSIG_FOOD_EATEN, eater, user) var/fraction = min(bitesize / reagents.total_volume, 1) - reagents.reaction(M, INGEST, fraction) - reagents.trans_to(M, bitesize, transfered_by = user) + reagents.reaction(eater, INGEST, fraction) + reagents.trans_to(eater, bitesize, transfered_by = user) bitecount++ - On_Consume(M) - checkLiked(fraction, M) - return TRUE + On_Consume(eater) + checkLiked(fraction, eater) - return 0 + eating_fast = TRUE + while (eating_fast) + return TRUE /obj/item/reagent_containers/food/snacks/examine(mob/user) . = ..() From 691b8934545753d98f04fab991d8021d00a37558 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 29 Jul 2023 21:49:29 -0400 Subject: [PATCH 09/13] Fixes stripping mobs --- code/modules/mob/living/carbon/carbon.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/living/living.dm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6ef8bfc11502..d72ac31dd206 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -263,7 +263,7 @@ if(ITEM && istype(ITEM, /obj/item/tank) && wear_mask && (wear_mask.clothing_flags & MASKINTERNALS)) visible_message(span_danger("[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name]."), \ span_userdanger("[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM.name].")) - if(do_after(usr, POCKET_STRIP_DELAY, src)) + if(do_after(usr, POCKET_STRIP_DELAY, src, interaction_key = REF(ITEM))) if(internal) cutoff_internals() else if(ITEM && istype(ITEM, /obj/item/tank)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a41eb4e0f1ed..76536131199b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -295,7 +295,7 @@ else return - if(do_after(usr, POCKET_STRIP_DELAY/delay_denominator, src)) //placing an item into the pocket is 4 times faster + if(do_after(usr, POCKET_STRIP_DELAY/delay_denominator, src, interaction_key = REF(pocket_item))) //placing an item into the pocket is 4 times faster if(pocket_item) if(pocket_item == (pocket_id == ITEM_SLOT_RPOCKET ? r_store : l_store)) //item still in the pocket we search dropItemToGround(pocket_item) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 427b4aa1d07c..3c4a2f620f30 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -877,7 +877,7 @@ span_userdanger("[src] tries to remove [who]'s [what.name].")) what.add_fingerprint(src) SEND_SIGNAL(what, COMSIG_ITEM_PRESTRIP) - if(do_after(src, what.strip_delay, who)) + if(do_after(src, what.strip_delay, who, interaction_key = REF(what))) if(what && Adjacent(who)) if(islist(where)) var/list/L = where From 0e57a01564220696f8d983245104f16404e4e2ed Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sun, 30 Jul 2023 01:28:19 -0400 Subject: [PATCH 10/13] Revert "you eat food faster too" This reverts commit abcca7e673c0e0b21473f1fd057258dd5cd4e0c7. --- code/modules/food_and_drinks/food/snacks.dm | 90 +++++++++------------ 1 file changed, 39 insertions(+), 51 deletions(-) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index b96a40e7b8d0..a6751b164404 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -81,83 +81,71 @@ All foods are distributed among various categories. Use common sense. /obj/item/reagent_containers/food/snacks/attack_self(mob/user) return -#define FOOD_FAST_EATING (1 SECONDS) -/obj/item/reagent_containers/food/snacks/attack(mob/living/carbon/eater, mob/living/user, def_zone) +/obj/item/reagent_containers/food/snacks/attack(mob/living/M, mob/living/user, def_zone) if(user.a_intent == INTENT_HARM) return ..() - - if(!iscarbon(eater)) - return ..() - if(!eatverb) eatverb = pick("bite","chew","nibble","gnaw","gobble","chomp") - - var/eating_fast = FALSE - - do - if(!reagents.total_volume) //Shouldn't be needed but it checks to see if it has anything left in it. - to_chat(user, span_notice("None of [src] left, oh no!")) - qdel(src) + if(!reagents.total_volume) //Shouldn't be needed but it checks to see if it has anything left in it. + to_chat(user, span_notice("None of [src] left, oh no!")) + qdel(src) + return FALSE + if(iscarbon(M)) + var/mob/living/carbon/C = M + if(!canconsume(M, user)) return FALSE - if (DOING_INTERACTION_WITH_TARGET(eater, src)) - return FALSE - - if(!canconsume(eater, user)) - return FALSE - - var/fullness = eater.nutrition + 10 - for(var/datum/reagent/consumable/con in eater.reagents.reagent_list) //we add the nutrition value of what we're currently digesting + var/fullness = M.nutrition + 10 + for(var/datum/reagent/consumable/con in M.reagents.reagent_list) //we add the nutrition value of what we're currently digesting fullness += con.nutriment_factor * con.volume / con.metabolization_rate - var/time_to_eat = 3 SECONDS - if(user == eater) - if(eating_fast) - time_to_eat = FOOD_FAST_EATING - if(HAS_TRAIT(eater, TRAIT_VORACIOUS)) - time_to_eat /= 2 - else if(junkiness && eater.satiety < -150 && eater.nutrition > NUTRITION_LEVEL_STARVING + 50) - to_chat(eater, span_notice("You don't feel like eating any more junk food at the moment.")) + if(M == user) //If you're eating it yourself. + if(junkiness && M.satiety < -150 && M.nutrition > NUTRITION_LEVEL_STARVING + 50 && !HAS_TRAIT(user, TRAIT_VORACIOUS)) + to_chat(M, span_notice("You don't feel like eating any more junk food at the moment.")) return FALSE + + if(HAS_TRAIT(M, TRAIT_VORACIOUS)) + M.changeNext_move(CLICK_CD_MELEE * 0.5) //nom nom nom else - if(!eater.force_eat_text(fullness, src, eater, user)) + if(!isbrain(M)) //If you're feeding it to someone else. + if(!C.force_eat_text(fullness, src, C, user)) + return + if(!do_after(user, 3 SECONDS, M)) + return + log_combat(user, M, "fed", reagents.log_list()) + else + to_chat(user, span_warning("[M] doesn't seem to have a mouth!")) return - time_to_eat = 3 SECONDS - if (!do_after(user, delay = time_to_eat, target = eater)) - return FALSE - - log_combat(user, eater, "fed", reagents.log_list()) - if(!eater.eat_text(fullness, eatverb, src, eater, user)) + if(!C.eat_text(fullness, eatverb, src, C, user)) return if(!junkiness) var/ate_without_table = TRUE - for(var/obj/structure/table/table in range(1, eater)) + for(var/obj/structure/table/table in range(1, M)) ate_without_table = FALSE break if(ate_without_table) - SEND_SIGNAL(eater, COMSIG_ADD_MOOD_EVENT, "no_table", /datum/mood_event/ate_without_table) + SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "no_table", /datum/mood_event/ate_without_table) else - SEND_SIGNAL(eater, COMSIG_CLEAR_MOOD_EVENT, "no_table") + SEND_SIGNAL(M, COMSIG_CLEAR_MOOD_EVENT, "no_table") - if(reagents) //Handle ingestion of the reagent. - if(eater.satiety > -200) - eater.satiety -= junkiness - playsound(eater.loc,'sound/items/eatfood.ogg', rand(10,50), 1) + if(reagents) //Handle ingestion of the reagent. + if(M.satiety > -200) + M.satiety -= junkiness + playsound(M.loc,'sound/items/eatfood.ogg', rand(10,50), 1) if(reagents.total_volume) - SEND_SIGNAL(src, COMSIG_FOOD_EATEN, eater, user) + SEND_SIGNAL(src, COMSIG_FOOD_EATEN, M, user) var/fraction = min(bitesize / reagents.total_volume, 1) - reagents.reaction(eater, INGEST, fraction) - reagents.trans_to(eater, bitesize, transfered_by = user) + reagents.reaction(M, INGEST, fraction) + reagents.trans_to(M, bitesize, transfered_by = user) bitecount++ - On_Consume(eater) - checkLiked(fraction, eater) + On_Consume(M) + checkLiked(fraction, M) + return TRUE - eating_fast = TRUE - while (eating_fast) - return TRUE + return 0 /obj/item/reagent_containers/food/snacks/examine(mob/user) . = ..() From 7a7b97d4b42bbc4109209760ef94d07685dca61f Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Tue, 1 Aug 2023 06:36:42 +0000 Subject: [PATCH 11/13] Fixes accidental swapover --- code/modules/projectiles/guns/ballistic/bow.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/projectiles/guns/ballistic/bow.dm b/code/modules/projectiles/guns/ballistic/bow.dm index 1237f44a7b1e..32ff1dea9e7b 100644 --- a/code/modules/projectiles/guns/ballistic/bow.dm +++ b/code/modules/projectiles/guns/ballistic/bow.dm @@ -83,7 +83,7 @@ else if(get_ammo()) drawing = TRUE update_slowdown() - if(!do_after(user, draw_time, src, timed_action_flags = (move_drawing ? IGNORE_HELD_ITEM : IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM))) + if(!do_after(user, draw_time, src, timed_action_flags = (move_drawing ? IGNORE_USER_LOC_CHANGE|IGNORE_HELD_ITEM : IGNORE_HELD_ITEM))) drawing = FALSE update_slowdown() return TRUE From 6508ee48bdebc2e92fc4f548b1ce89264461d092 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 5 Aug 2023 13:01:44 -0400 Subject: [PATCH 12/13] Update horror.dm --- code/modules/antagonists/horror/horror.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/antagonists/horror/horror.dm b/code/modules/antagonists/horror/horror.dm index a7d2e8e5f8ca..b6b3a33a297c 100644 --- a/code/modules/antagonists/horror/horror.dm +++ b/code/modules/antagonists/horror/horror.dm @@ -212,7 +212,7 @@ return to_chat(src, "You begin consuming [victim.name]'s soul!") - if(do_after(src, 30 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE)) + if(do_after(src, 30 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE)) consume() /mob/living/simple_animal/horror/proc/consume() @@ -532,7 +532,7 @@ to_chat(victim, span_userdanger("An odd, uncomfortable pressure begins to build inside your skull, behind your ear...")) leaving = TRUE - if(do_after(src, 10 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_leaving)))) + if(do_after(src, 10 SECONDS, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_leaving)))) release_host() /mob/living/simple_animal/horror/proc/release_host() @@ -724,7 +724,7 @@ var/delay = 20 SECONDS if(has_upgrade("fast_control")) delay -= 12 SECONDS - if(do_after(src, delay, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_bonding)))) + if(do_after(src, delay, victim, timed_action_flags = IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(is_bonding)))) assume_control() /mob/living/simple_animal/horror/proc/assume_control() From eed9c8e59ecac9b0f12e8fc7e8ec080b8f58e6b2 Mon Sep 17 00:00:00 2001 From: JohnFulpWillard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Fri, 18 Aug 2023 00:11:52 -0400 Subject: [PATCH 13/13] Update hecata.dm --- code/modules/antagonists/bloodsuckers/powers/targeted/hecata.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/antagonists/bloodsuckers/powers/targeted/hecata.dm b/code/modules/antagonists/bloodsuckers/powers/targeted/hecata.dm index 0ae7b0b837df..ecf555ca1b19 100644 --- a/code/modules/antagonists/bloodsuckers/powers/targeted/hecata.dm +++ b/code/modules/antagonists/bloodsuckers/powers/targeted/hecata.dm @@ -63,7 +63,7 @@ var/datum/antagonist/bloodsucker/bloodsuckerdatum = user.mind.has_antag_datum(/datum/antagonist/bloodsucker) if(target.stat == DEAD && user.Adjacent(target)) owner.balloon_alert(owner, "attempting to revive...") - if(!do_mob(user, target, 6 SECONDS, NONE, TRUE)) + if(!do_after(user, 6 SECONDS, target)) return FALSE if(IS_VASSAL(target)) power_activated_sucessfully()