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:
Cody Brittain
2023-09-27 12:17:14 +00:00
committed by GitHub
parent 085e7c8107
commit 0a3dac31e0
125 changed files with 531 additions and 314 deletions
+1 -1
View File
@@ -197,7 +197,7 @@
if(size) // defined size means we're hoisting and it'll take time
user.visible_message(SPAN_NOTICE("[user] begins to [movtext] \the [hoistee]!"), SPAN_NOTICE("You begin to [movtext] \the [hoistee]!"), SPAN_NOTICE("You hear the sound of a crank."))
if (do_after(user, (1 SECONDS) * size / 4, act_target = src))
if (do_after(user, (1 SECONDS) * size / 4, src))
. = move_dir(movedir)
if(.)
+2 -4
View File
@@ -56,8 +56,7 @@
place_ladder(A,user)
/obj/item/ladder_mobile/proc/handle_action(atom/A, mob/user)
if(!do_after(user, 30, act_target = user))
to_chat(user, SPAN_WARNING("You were interrupted while placing the ladder!"))
if(!do_after(user, 30, user))
return FALSE
if(!A || QDELETED(src) || QDELETED(user))
// Shit was deleted during delay, call is no longer valid.
@@ -86,8 +85,7 @@
user.visible_message(SPAN_NOTICE("\The [user] starts folding up \the [src]."),
SPAN_NOTICE("You start folding up \the [src]."))
if(!do_after(user, 30, act_target = src))
to_chat(user, SPAN_WARNING("You are interrupted!"))
if(!do_after(user, 30, src))
return
if(QDELETED(src))
+1 -1
View File
@@ -199,7 +199,7 @@
if(prob(climb_chance))
will_succeed = TRUE
if(do_after(src, climb_speed, extra_checks = CALLBACK(src, PROC_REF(climb_check), will_succeed, climb_chance, climb_speed, direction, destination)))
if(do_after(src, climb_speed))
if(will_succeed)
visible_message(SPAN_NOTICE("\The [src] climbs [(direction == UP) ? "upwards" : "downwards"]."),
SPAN_NOTICE("You climb [(direction == UP) ? "upwards" : "downwards"]."))
+1 -1
View File
@@ -59,7 +59,7 @@
if(LAZYLEN(destroy_tools))
if(is_type_in_list(C, destroy_tools))
user.visible_message("<b>[user]</b> starts breaking down \the [src] with \the [C]!", SPAN_NOTICE("You start breaking down \the [src] with \the [C]."))
if(do_after(user, 10 SECONDS, TRUE))
if(do_after(user, 10 SECONDS, src, DO_REPAIR_CONSTRUCT))
user.visible_message("<b>[user]</b> breaks down \the [src] with \the [C]!", SPAN_NOTICE("You break down \the [src] with \the [C]."))
qdel(src)
return