diff --git a/code/controllers/subsystem/verb_manager.dm b/code/controllers/subsystem/verb_manager.dm index c120876c538..337386cff8e 100644 --- a/code/controllers/subsystem/verb_manager.dm +++ b/code/controllers/subsystem/verb_manager.dm @@ -83,13 +83,15 @@ SUBSYSTEM_DEF(verb_manager) incoming_callback.user = WEAKREF(incoming_callback.object) var/datum/callback/new_us = CALLBACK(arglist(list(GLOBAL_PROC, GLOBAL_PROC_REF(_queue_verb)) + args.Copy())) return world.push_usr(incoming_callback.object, new_us) -#endif - //debatable whether this is needed, this is just to try and ensure that you dont use this to queue stuff that isnt from player input. - if(QDELETED(usr)) +#else + + if(QDELETED(usr) || isnull(usr.client)) stack_trace("_queue_verb() returned false because it wasnt called from player input!") return FALSE +#endif + if(!istype(subsystem_to_use)) stack_trace("_queue_verb() returned false because it was given an invalid subsystem to queue for!") return FALSE diff --git a/code/datums/verb_callbacks.dm b/code/datums/verb_callbacks.dm index 6468974260f..563ac3ac4d4 100644 --- a/code/datums/verb_callbacks.dm +++ b/code/datums/verb_callbacks.dm @@ -1,4 +1,5 @@ ///like normal callbacks but they also record their creation time for measurement purposes +///they also require the same usr/user that made the callback to both still exist and to still have a client in order to execute /datum/callback/verb_callback ///the tick this callback datum was created in. used for testing latency var/creation_time = 0 @@ -6,3 +7,23 @@ /datum/callback/verb_callback/New(thingtocall, proctocall, ...) creation_time = DS2TICKS(world.time) . = ..() + +#ifndef UNIT_TESTS +/datum/callback/verb_callback/Invoke(...) + var/mob/our_user = user?.resolve() + if(QDELETED(our_user) || isnull(our_user.client)) + return + var/mob/temp = usr + . = ..() + usr = temp + +/datum/callback/verb_callback/InvokeAsync(...) + var/mob/our_user = user?.resolve() + if(QDELETED(our_user) || isnull(our_user.client)) + return + var/mob/temp = usr + . = ..() + usr = temp +#endif + +