mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
[TM] Verb Queue - Port of TG SSverb subsystem (#19863)
* Some verbs queue up now * Damn you 515 * Screw you Topic * Update client_procs.dm * Fixes for unit testing * Update MC.dm * verb * Update callback.dm * Tweaks * Linters might not have liked that, * More tweaks, and fix * Update verb_manager.dm
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
var/datum/object = GLOBAL_PROC
|
||||
var/delegate
|
||||
var/list/arguments
|
||||
var/usr_uid
|
||||
|
||||
/datum/callback/New(thingtocall, proctocall, ...)
|
||||
if(thingtocall)
|
||||
@@ -47,6 +48,8 @@
|
||||
delegate = proctocall
|
||||
if(length(args) > 2)
|
||||
arguments = args.Copy(3)
|
||||
if(usr)
|
||||
usr_uid = usr.UID()
|
||||
|
||||
/proc/ImmediateInvokeAsync(thingtocall, proctocall, ...)
|
||||
set waitfor = FALSE
|
||||
@@ -62,6 +65,12 @@
|
||||
call(thingtocall, proctocall)(arglist(calling_arguments))
|
||||
|
||||
/datum/callback/proc/Invoke(...)
|
||||
if(!usr && usr_uid)
|
||||
var/mob/M = locateUID(usr_uid)
|
||||
if(M)
|
||||
if(length(args))
|
||||
return world.invoke_callback_with_usr(arglist(list(M, src) + args))
|
||||
return world.invoke_callback_with_usr(M, src)
|
||||
if(!object)
|
||||
return
|
||||
var/list/calling_arguments = arguments
|
||||
@@ -77,6 +86,14 @@
|
||||
//copy and pasted because fuck proc overhead
|
||||
/datum/callback/proc/InvokeAsync(...)
|
||||
set waitfor = FALSE
|
||||
|
||||
if(!usr && usr_uid)
|
||||
var/mob/M = locateUID(usr_uid)
|
||||
if(M)
|
||||
if(length(args))
|
||||
return world.invoke_callback_with_usr(arglist(list(M, src) + args))
|
||||
return world.invoke_callback_with_usr(M, src)
|
||||
|
||||
if(!object)
|
||||
return
|
||||
var/list/calling_arguments = arguments
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
///like normal callbacks but they also record their creation time for measurement purposes
|
||||
/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)
|
||||
. = ..()
|
||||
Reference in New Issue
Block a user