mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-26 17:22:56 +00:00
What it says on the can; now we can better compensate for processing spikes by queueing and accounting for verb times (assuming we actually use this framework to invoke the bulk of them). I have added its use to some of them, more can be ported as time goes on, eventually everything but the most trivial ones should go through this. No player facing changes. Hopefully. Praise be the omnissiah.
30 lines
855 B
Plaintext
30 lines
855 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
|
|
|
|
|