mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> Co-authored-by: C.L. <killer65311@gmail.com>
28 lines
853 B
Plaintext
28 lines
853 B
Plaintext
///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
|
|
|
|
/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
|