mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 22:42:26 +01:00
Refactored do_after to use a flag-based system for options (#17127)
* Refactored do_after to use a flag-based system for options * More flags * Ditto * Use the HAS_FLAG macro * do_after pass * Fix burning paper code * Resolve issues from Fluffy's code reviews * .
This commit is contained in:
@@ -41,13 +41,13 @@ Exercise Verbs
|
||||
stop_pushups()
|
||||
return
|
||||
animate(src, pixel_y = target_y, time = 0.8 SECONDS, easing = QUAD_EASING) //down to the floor
|
||||
if(!lying || !do_after(src, 0.6 SECONDS, needhand = TRUE, display_progress = FALSE))
|
||||
if(!lying || !do_after(src, 0.6 SECONDS, do_flags = DO_EXERCISE))
|
||||
visible_message(SPAN_NOTICE("[src] stops doing pushups."), SPAN_NOTICE("You stop doing pushups."), SPAN_NOTICE("You hear movements."))
|
||||
animate(src, pixel_y = 0, time = 0.2 SECONDS, easing = QUAD_EASING)
|
||||
stop_pushups()
|
||||
return
|
||||
animate(src, pixel_y = 0, time = 0.8 SECONDS, easing = QUAD_EASING) //back up
|
||||
if(!lying || !do_after(src, 0.6 SECONDS, needhand = TRUE, display_progress = FALSE))
|
||||
if(!lying || !do_after(src, 0.6 SECONDS, do_flags = DO_EXERCISE))
|
||||
visible_message(SPAN_NOTICE("[src] stops doing pushups."), SPAN_NOTICE("You stop doing pushups."), SPAN_NOTICE("You hear movements."))
|
||||
animate(src, pixel_y = 0, time = 0.2 SECONDS, easing = QUAD_EASING)
|
||||
stop_pushups()
|
||||
|
||||
@@ -479,7 +479,7 @@
|
||||
animate(src, pixel_y = starting_pixel_y + 4, time = 2)
|
||||
animate(src, pixel_y = starting_pixel_y, time = 2)
|
||||
|
||||
if(!do_after(H, 8, FALSE)) //Chest compressions are fast, need to wait for the loading bar to do mouth to mouth
|
||||
if(!do_after(H, 8, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT)) //Chest compressions are fast, need to wait for the loading bar to do mouth to mouth
|
||||
to_chat(H, SPAN_NOTICE("You stop performing [cpr_mode] on \the [src]."))
|
||||
cpr = FALSE //If it cancelled, cancel it. Simple.
|
||||
|
||||
@@ -635,7 +635,7 @@
|
||||
organ.applied_pressure = user
|
||||
|
||||
//apply pressure as long as they stay still and keep grabbing
|
||||
do_after(user, INFINITY, TRUE, display_progress = FALSE)
|
||||
do_after(user, INFINITY, do_flags = (DO_DEFAULT & ~DO_SHOW_PROGRESS) | DO_USER_UNIQUE_ACT)
|
||||
|
||||
organ.applied_pressure = null
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
to_chat(user, SPAN_WARNING("\The [H] doesn't have a head!"))
|
||||
return
|
||||
user.visible_message(SPAN_WARNING("\The [user] is trying to remove something from \the [H]'s headtails!"))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, act_target = H))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, do_flags = DO_EQUIP))
|
||||
var/obj/item/storage/internal/skrell/S = locate() in H.organs_by_name[BP_HEAD]
|
||||
var/obj/item/I = locate() in S
|
||||
if(!I)
|
||||
|
||||
@@ -23,35 +23,35 @@
|
||||
// Handle things that are part of this interface but not removing/replacing a given item.
|
||||
if("mask")
|
||||
visible_message(SPAN_WARNING("\The [user] is trying to adjust \the [src]'s mask!"))
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
var/obj/item/clothing/mask/M = wear_mask
|
||||
M.adjust_mask(user, FALSE)
|
||||
return TRUE
|
||||
if("tank")
|
||||
visible_message(SPAN_WARNING("\The [user] is taking a look at \the [src]'s air tank."))
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
var/obj/item/tank/T = internal
|
||||
to_chat(user, SPAN_NOTICE("\The [T] has [T.air_contents.return_pressure()] kPA left."))
|
||||
to_chat(user, SPAN_NOTICE("The [T] is set to release [T.distribute_pressure] kPA."))
|
||||
return TRUE
|
||||
if("pockets")
|
||||
visible_message("<span class='danger'>\The [user] is trying to empty \the [src]'s pockets!</span>")
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
empty_pockets(user)
|
||||
return 1
|
||||
if("splints")
|
||||
visible_message("<span class='danger'>\The [user] is trying to remove \the [src]'s splints!</span>")
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
remove_splints(user)
|
||||
return 1
|
||||
if("sensors")
|
||||
visible_message("<span class='danger'>\The [user] is trying to set \the [src]'s sensors!</span>")
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
toggle_sensors(user)
|
||||
return 1
|
||||
if("internals")
|
||||
visible_message("<span class='danger'>\The [usr] is trying to set \the [src]'s internals!</span>")
|
||||
if(do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
toggle_internals(user)
|
||||
return 1
|
||||
if("tie")
|
||||
@@ -72,7 +72,7 @@
|
||||
return 0
|
||||
visible_message("<span class='danger'>\The [usr] is trying to remove \the [src]'s [A.name]!</span>")
|
||||
|
||||
if(!do_after(user,HUMAN_STRIP_DELAY, act_target = src))
|
||||
if(!do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
return 0
|
||||
|
||||
if(!A || suit.loc != src || !(A in suit.accessories))
|
||||
|
||||
@@ -39,25 +39,25 @@
|
||||
SPAN_DANGER("\The [src] attempts to escape [wear_suit]!"),
|
||||
SPAN_WARNING("You attempt to escape [wear_suit]. (This will take around 6 minutes and you need to stand still)")
|
||||
)
|
||||
if (!do_after(src, 1.5 MINUTES, act_target = src))
|
||||
if (!do_after(src, 1.5 MINUTES, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
|
||||
return
|
||||
visible_message(
|
||||
SPAN_WARNING("\The [src] is shifting in their [wear_suit]!"),
|
||||
SPAN_WARNING("You start to loosen the [wear_suit].")
|
||||
)
|
||||
if (!do_after(src, 1.5 MINUTES, act_target = src))
|
||||
if (!do_after(src, 1.5 MINUTES, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
|
||||
return
|
||||
visible_message(
|
||||
SPAN_DANGER("\The [src] is moving in their [wear_suit]!"),
|
||||
SPAN_WARNING("You slip one of your arms out of the [wear_suit].")
|
||||
)
|
||||
if (!do_after(src, 1.5 MINUTES, act_target = src))
|
||||
if (!do_after(src, 1.5 MINUTES, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
|
||||
return
|
||||
visible_message(
|
||||
SPAN_DANGER("\The [src] is moving around in their [wear_suit] - it looks like they are about to break out!"),
|
||||
SPAN_WARNING("You start to pull loose the straps on the straightjacket[wear_suit].")
|
||||
)
|
||||
if (do_after(src, 1.5 MINUTES, act_target = src))
|
||||
if (do_after(src, 1.5 MINUTES, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
|
||||
var/obj/ex_suit = wear_suit
|
||||
remove_from_mob(wear_suit)
|
||||
ex_suit.forceMove(get_turf(src))
|
||||
@@ -107,7 +107,7 @@
|
||||
SPAN_WARNING("You attempt to slip out of \the [HC]. (This will take around [displaytime] minutes and you need to stand still)")
|
||||
)
|
||||
|
||||
if(do_after(src, breakouttime))
|
||||
if(do_after(src, breakouttime, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DISABLED))
|
||||
if(!handcuffed)
|
||||
return
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
SPAN_WARNING("You attempt to remove \the [HC]. (This will take around [displaytime] minutes and you need to stand still)")
|
||||
)
|
||||
|
||||
if(do_after(src, breakouttime))
|
||||
if(do_after(src, breakouttime, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DISABLED))
|
||||
if(!legcuffed || buckled_to)
|
||||
return
|
||||
visible_message(
|
||||
@@ -191,7 +191,7 @@
|
||||
SPAN_WARNING("You attempt to break your [handcuffed.name]. (This will take around 10 seconds and you need to stand still)")
|
||||
)
|
||||
|
||||
if(do_after(src, 10 SECONDS))
|
||||
if(do_after(src, 10 SECONDS, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DISABLED))
|
||||
if(!handcuffed)
|
||||
return
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
to_chat(src, SPAN_WARNING("You attempt to break your legcuffs. (This will take around 5 seconds and you need to stand still)"))
|
||||
visible_message(SPAN_DANGER("[src] is trying to break the legcuffs!"))
|
||||
|
||||
if(do_after(src, 50))
|
||||
if(do_after(src, 50, do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DISABLED))
|
||||
if(!legcuffed || buckled_to)
|
||||
return
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/mob/living/Logout()
|
||||
if (stamina_bar)
|
||||
QDEL_NULL(stamina_bar)
|
||||
..()
|
||||
if (mind)
|
||||
//Per BYOND docs key remains set if the player DCs, becomes null if switching bodies.
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
is_in_use = TRUE
|
||||
user.visible_message("<b>[user]</b> begins waving \the [src] around \the [target]...", SPAN_NOTICE("You prepare to wirelessly charge \the [target]..."), range = 3)
|
||||
if(!do_after(user, 50, TRUE, target))
|
||||
if(!do_after(user, 50, target))
|
||||
is_in_use = FALSE
|
||||
return
|
||||
is_in_use = FALSE
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
deploying = 1
|
||||
user.visible_message("<b>[user]</b> starts deploying an inflatable [mode ? "door" : "wall"].", SPAN_NOTICE("You start deploying an inflatable [mode ? "door" : "wall"]!"))
|
||||
playsound(T, 'sound/items/zip.ogg', 75, TRUE)
|
||||
if(do_after(user, 30, needhand = FALSE))
|
||||
if(do_after(user, 30, do_flags = DO_DEFAULT & ~DO_USER_SAME_HAND))
|
||||
new newtype(T)
|
||||
if(mode)
|
||||
stored_doors--
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
if(A?.loc == src)
|
||||
return FALSE
|
||||
visible_message(SPAN_WARNING("\The [src] begins swallowing \the [A] whole!"), SPAN_NOTICE("You begin swallowing \the [A] whole."))
|
||||
if(do_after(src, delay, act_target = A))
|
||||
if(do_after(src, delay, A))
|
||||
visible_message(SPAN_WARNING("\The [src] swallows \the [A] whole!"), SPAN_NOTICE("You swallow \the [A] whole."))
|
||||
A.forceMove(src)
|
||||
return TRUE
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
var/obj/item/stack/material/P = A
|
||||
if(P.material.name == MATERIAL_PHORON)
|
||||
visible_message(SPAN_WARNING("\The [src] starts consuming \the [P]..."), SPAN_NOTICE("You start consuming \the [P]."))
|
||||
if(!do_after(src, 1 SECOND, act_target = P))
|
||||
if(!do_after(src, 1 SECOND, P))
|
||||
return
|
||||
var/self_msg = "You consume \the [P][health < maxHealth ? ", healing yourself" : ""]."
|
||||
adjustBruteLoss(-5 * P.amount)
|
||||
@@ -151,4 +151,4 @@
|
||||
melee_damage_upper = 15
|
||||
resist_mod = 1
|
||||
mob_size = 15
|
||||
environment_smash = 1
|
||||
environment_smash = 1
|
||||
|
||||
Reference in New Issue
Block a user