mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 20:43:10 +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:
@@ -146,7 +146,7 @@
|
||||
if(can_wire)
|
||||
user.visible_message(SPAN_NOTICE("[user] starts setting up [W.name] on [src]."),
|
||||
SPAN_NOTICE("You start setting up [W.name] on [src]."))
|
||||
if(do_after(user, 20, act_target = src) && can_wire)
|
||||
if(do_after(user, 20, src, DO_REPAIR_CONSTRUCT) && can_wire)
|
||||
// Make sure there's still enough wire in the stack
|
||||
if(!B.use(1))
|
||||
return
|
||||
@@ -167,7 +167,7 @@
|
||||
if(is_wired)
|
||||
user.visible_message(SPAN_NOTICE("[user] begin removing the barbed wire on [src]."),
|
||||
SPAN_NOTICE("You begin removing the barbed wire on [src]."))
|
||||
if(do_after(user, 20, act_target = src))
|
||||
if(do_after(user, 20, src, DO_REPAIR_CONSTRUCT))
|
||||
if(!is_wired)
|
||||
return
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
user.visible_message(SPAN_NOTICE("[user] starts adding more [SB] to [src]."), \
|
||||
SPAN_NOTICE("You start adding liquid bags to [src]."))
|
||||
for(var/i = build_stage to BARRICADE_LIQUIDBAG_5)
|
||||
if(build_stage >= BARRICADE_LIQUIDBAG_5 || !do_after(user, 5, act_target = src) || build_stage >= BARRICADE_LIQUIDBAG_5)
|
||||
if(build_stage >= BARRICADE_LIQUIDBAG_5 || !do_after(user, 5, src, DO_REPAIR_CONSTRUCT) || build_stage >= BARRICADE_LIQUIDBAG_5)
|
||||
break
|
||||
SB.use(1)
|
||||
increment_build_stage()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
to_chat(user, SPAN_WARNING("You need one plank of wood to repair [src]."))
|
||||
return
|
||||
visible_message(SPAN_NOTICE("[user] begins to repair [src]."))
|
||||
if(do_after(user, 2 SECONDS, act_target = src) && (health < maxhealth))
|
||||
if(do_after(user, 2 SECONDS, src, DO_REPAIR_CONSTRUCT) && (health < maxhealth))
|
||||
if(D.use(1))
|
||||
update_health(-0.5*maxhealth)
|
||||
update_damage_state()
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
return
|
||||
var/obj/item/closet_teleporter/CT = W
|
||||
user.visible_message(SPAN_NOTICE("\The [user] starts attaching \the [CT] to \the [src]..."), SPAN_NOTICE("You begin attaching \the [CT] to \the [src]..."), range = 3)
|
||||
if(do_after(user, 30, TRUE, src))
|
||||
if(do_after(user, 30, src, DO_REPAIR_CONSTRUCT))
|
||||
user.visible_message(SPAN_NOTICE("\The [user] attaches \the [CT] to \the [src]."), SPAN_NOTICE("You attach \the [CT] to \the [src]."), range = 3)
|
||||
linked_teleporter = CT
|
||||
CT.attached_closet = src
|
||||
@@ -325,7 +325,7 @@
|
||||
if(W.isscrewdriver()) // Moved here so you can only detach linked teleporters when the door is open. So you can like unscrew and bolt the locker normally in most circumstances.
|
||||
if(linked_teleporter)
|
||||
user.visible_message(SPAN_NOTICE("\The [user] starts detaching \the [linked_teleporter] from \the [src]..."), SPAN_NOTICE("You begin detaching \the [linked_teleporter] from \the [src]..."), range = 3)
|
||||
if(do_after(user, 30, TRUE, src))
|
||||
if(do_after(user, 30, src, DO_REPAIR_CONSTRUCT))
|
||||
user.visible_message(SPAN_NOTICE("\The [user] detaches \the [linked_teleporter] from \the [src]."), SPAN_NOTICE("You detach \the [linked_teleporter] from \the [src]."), range = 3)
|
||||
linked_teleporter.attached_closet = null
|
||||
user.put_in_hands(linked_teleporter)
|
||||
@@ -340,7 +340,7 @@
|
||||
"You hear a welding torch on metal."
|
||||
)
|
||||
playsound(loc, 'sound/items/welder_pry.ogg', 50, 1)
|
||||
if (!do_after(user, 2 SECONDS, act_target = src, extra_checks = CALLBACK(src, PROC_REF(is_open))))
|
||||
if (!do_after(user, 2 SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
return
|
||||
if(!WT.use(0,user))
|
||||
to_chat(user, SPAN_NOTICE("You need more welding fuel to complete this task."))
|
||||
@@ -411,14 +411,14 @@
|
||||
if(screwed)
|
||||
to_chat(user, SPAN_NOTICE("You start to unscrew \the [src] from the floor..."))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
if (do_after(user, 10/W.toolspeed SECONDS, act_target = src))
|
||||
if (do_after(user, 10/W.toolspeed SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
to_chat(user, SPAN_NOTICE("You unscrew the locker!"))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
screwed = FALSE
|
||||
else if(!screwed && wrenched)
|
||||
to_chat(user, SPAN_NOTICE("You start to screw the \the [src] to the floor..."))
|
||||
playsound(src, 'sound/items/Welder.ogg', 80, 1)
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, act_target = src))
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
to_chat(user, SPAN_NOTICE("You screw \the [src]!"))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
screwed = TRUE
|
||||
@@ -426,7 +426,7 @@
|
||||
if(wrenched && !screwed)
|
||||
to_chat(user, SPAN_NOTICE("You start to unfasten the bolts holding \the [src] in place..."))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, act_target = src))
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
to_chat(user, SPAN_NOTICE("You unfasten \the [src]'s bolts!"))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
wrenched = FALSE
|
||||
@@ -434,7 +434,7 @@
|
||||
else if(!wrenched)
|
||||
to_chat(user, SPAN_NOTICE("You start to fasten the bolts holding the locker in place..."))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, act_target = src))
|
||||
if (do_after(user, 15/W.toolspeed SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
to_chat(user, SPAN_NOTICE("You fasten the \the [src]'s bolts!"))
|
||||
playsound(loc, W.usesound, 50, 1)
|
||||
wrenched = TRUE
|
||||
@@ -458,7 +458,7 @@
|
||||
SPAN_WARNING("You start cutting the [src]..."),\
|
||||
SPAN_NOTICE("You hear a loud buzzing sound and metal grinding on metal...")\
|
||||
)
|
||||
if(do_after(user, ChainSawVar.opendelay SECONDS, act_target = user, extra_checks = CALLBACK(src, PROC_REF(CanChainsaw), W)))
|
||||
if(do_after(user, ChainSawVar.opendelay SECONDS, user, DO_REPAIR_CONSTRUCT))
|
||||
user.visible_message(\
|
||||
SPAN_WARNING("[user.name] finishes cutting open \the [src] with the [W]."),\
|
||||
SPAN_WARNING("You finish cutting open the [src]."),\
|
||||
@@ -708,7 +708,7 @@
|
||||
if (bar)
|
||||
bar.update(i)
|
||||
|
||||
if(!do_after(escapee, 50, display_progress = FALSE)) //5 seconds
|
||||
if(!do_after(escapee, 50, do_flags = DO_DEFAULT & ~DO_SHOW_PROGRESS)) //5 seconds
|
||||
breakout = 0
|
||||
qdel(bar)
|
||||
return
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
if (timeneeded > 0)
|
||||
user.visible_message("[user] starts hoisting \the [src] onto \the [table].", "You start hoisting \the [src] onto \the [table]. This will take about [timeneeded * 0.1] seconds.")
|
||||
user.face_atom(src)
|
||||
if (!do_after(user, timeneeded, needhand = TRUE, act_target = src))
|
||||
if (!do_after(user, timeneeded, src))
|
||||
return FALSE
|
||||
else
|
||||
forceMove(get_turf(table))
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
if(!time_to_dig)
|
||||
time_to_dig = 50
|
||||
|
||||
if(do_after(user, time_to_dig * mine_rate, act_target = src))
|
||||
if(do_after(user, time_to_dig * mine_rate, src))
|
||||
if(!src)
|
||||
return
|
||||
harvest()
|
||||
|
||||
@@ -265,7 +265,7 @@
|
||||
SPAN_NOTICE("You start cutting \the [src] apart..."), \
|
||||
SPAN_WARNING("You hear a loud buzzing sound and metal grinding on metal...") \
|
||||
)
|
||||
if(do_after(user, ChainSawVar.opendelay SECONDS, act_target = user, extra_checks = CALLBACK(src, PROC_REF(CanChainsaw), W)))
|
||||
if(do_after(user, ChainSawVar.opendelay SECONDS, user, extra_checks = CALLBACK(src, PROC_REF(CanChainsaw), W)))
|
||||
user.visible_message(\
|
||||
SPAN_DANGER("[user] finishes cutting \the [src] apart with the [W]."), \
|
||||
SPAN_NOTICE("You finish cutting \the [src] apart."), \
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
if(!Adjacent(user)) // Cannot bring up dialogue and walk away.
|
||||
return FALSE
|
||||
user.visible_message(SPAN_WARNING("\The [user] starts to grab hold of \the [src] with destructive intent!"), SPAN_WARNING("You grab hold of \the [src] with destructive intent!"),)
|
||||
if(!do_after(user, 5 SECONDS, act_target = src))
|
||||
if(!do_after(user, 5 SECONDS, src))
|
||||
return FALSE
|
||||
user.visible_message(SPAN_WARNING("\The [user] rips \the [src] in a single, decisive motion!"), SPAN_WARNING("You \the [src] in a single, decisive motion!"))
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 100, 1)
|
||||
@@ -226,7 +226,7 @@
|
||||
..()
|
||||
if(W.isFlameSource())
|
||||
visible_message(SPAN_WARNING("\The [user] starts to burn \the [src] down!"))
|
||||
if(!do_after(user, 2 SECONDS, act_target = src))
|
||||
if(!do_after(user, 2 SECONDS, src))
|
||||
return FALSE
|
||||
visible_message(SPAN_WARNING("\The [user] burns \the [src] down!"))
|
||||
playsound(src.loc, 'sound/items/cigs_lighters/zippo_on.ogg', 100, 1)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
return
|
||||
M.last_special = world.time
|
||||
M.visible_message(SPAN_WARNING("[M] starts struggling to break free of the sticky flesh..."), SPAN_WARNING("You struggle to break free from the gelatinous flesh..."), SPAN_WARNING("You hear squelching..."))
|
||||
if(do_after(M, NEST_RESIST_TIME, TRUE))
|
||||
if(do_after(M, NEST_RESIST_TIME))
|
||||
unbuckle_buckled_mob(M)
|
||||
|
||||
/obj/structure/bed/nest/proc/unbuckle_buckled_mob(var/mob/buck)
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
if(user)
|
||||
playsound(src.loc, I.usesound, 50, 1)
|
||||
user.visible_message("<b>[user]</b> starts taking apart the [src]...", SPAN_NOTICE("You start disassembling the [src]..."))
|
||||
if (!do_after(user, 30, needhand = 0))
|
||||
if (!do_after(user, 30, do_flags = DO_DEFAULT & ~DO_USER_SAME_HAND))
|
||||
return
|
||||
|
||||
dismantle()
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
var/obj/item/grab/G = W
|
||||
var/mob/living/affecting = G.affecting
|
||||
user.visible_message("<span class='notice'>[user] attempts to buckle [affecting] into \the [src]!</span>")
|
||||
if(do_after(user, 20))
|
||||
if(do_after(user, 2 SECONDS, affecting, DO_UNIQUE))
|
||||
affecting.forceMove(loc)
|
||||
spawn(0)
|
||||
if(buckle(affecting))
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/obj/structure/bed/stool/chair/MouseDrop_T(mob/target, mob/user)
|
||||
if(target == user && user.loc != loc && (reverse_dir[dir] & angle2dir(Get_Angle(src, user))))
|
||||
user.visible_message("<b>[user]</b> starts climbing over the back of \the [src]...", SPAN_NOTICE("You start climbing over the back of \the [src]..."))
|
||||
if(do_after(user, 2 SECONDS))
|
||||
if(do_after(user, 2 SECONDS, DO_UNIQUE))
|
||||
user.forceMove(loc)
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
if(!Adjacent(user) || use_check_and_message(user))
|
||||
return
|
||||
user.visible_message("<b>[user]</b> starts climbing into \the [src]...", SPAN_NOTICE("You start climbing into \the [src]..."))
|
||||
if(do_after(user, 3 SECONDS))
|
||||
if(do_after(user, 3 SECONDS, src, DO_UNIQUE))
|
||||
user.visible_message("<b>[user]</b> climbs into \the [src], disappearing from sight.", SPAN_NOTICE("You climb into \the [src], finally finding a good spot to hide."))
|
||||
user.forceMove(src)
|
||||
hider = user
|
||||
@@ -54,7 +54,7 @@
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.a_intent == I_HURT)
|
||||
H.visible_message("<b>[user]</b> starts taking \the [src] apart...", SPAN_NOTICE("You start taking \the [src] apart..."))
|
||||
if(do_after(user, 2 MINUTES))
|
||||
if(do_after(user, 2 MINUTES, src, DO_UNIQUE))
|
||||
H.visible_message("<b>[user]</b> takes \the [src] apart.", SPAN_NOTICE("You takes \the [src] apart."))
|
||||
for(var/i = 1 to 5)
|
||||
var/obj/item/I = give_item()
|
||||
@@ -66,7 +66,7 @@
|
||||
if(hider)
|
||||
to_chat(hider, SPAN_WARNING("[user] is searching the trash pile you're in!"))
|
||||
//Do the searching
|
||||
if(do_after(user, rand(4 SECONDS, 6 SECONDS)))
|
||||
if(do_after(user, rand(4 SECONDS, 6 SECONDS), src, DO_UNIQUE))
|
||||
var/unique_string = "[user.ckey]-[user.real_name]"
|
||||
//If there was a hider, chance to reveal them
|
||||
if(eject_hider(50, user))
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/obj/structure/bed/stool/chair/remote/attackby(obj/item/W, mob/user)
|
||||
if(portable_type && W.iswrench())
|
||||
user.visible_message(SPAN_NOTICE("\The [user] starts dismantling \the [src]..."), SPAN_NOTICE("You start dismantling \the [src]..."))
|
||||
if(do_after(user, 20 SECONDS, TRUE, src))
|
||||
if(do_after(user, 20 SECONDS, src, DO_REPAIR_CONSTRUCT))
|
||||
user.visible_message(SPAN_NOTICE("\The [user] dismantles \the [src]."), SPAN_NOTICE("You dismantle \the [src]."))
|
||||
var/obj/kit = new portable_type(get_turf(src))
|
||||
user.put_in_hands(kit)
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
if(open && !swirlie)
|
||||
user.visible_message(SPAN_DANGER("[user] starts to give [GM.name] a swirlie!"), SPAN_NOTICE("You start to give [GM.name] a swirlie!"))
|
||||
swirlie = GM
|
||||
if(do_after(user, 30, 5, 0))
|
||||
if(do_after(user, 30, GM, do_flags = DO_UNIQUE))
|
||||
user.visible_message(SPAN_DANGER("[user] gives [GM.name] a swirlie!"), SPAN_NOTICE("You give [GM.name] a swirlie!"), "You hear a toilet flushing.")
|
||||
if(!GM.internal)
|
||||
GM.adjustOxyLoss(5)
|
||||
|
||||
Reference in New Issue
Block a user