mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +00:00
[MIRROR] fixes _queue_verb() runtiming from /client/Click() thousands of times [MDB IGNORE] (#17034)
* fixes _queue_verb() runtiming from /client/Click() thousands of times (#70647) * fixes _queue_verb() runtiming from /client/Click() and adds info * Update code/controllers/subsystem/verb_manager.dm Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * fixes _queue_verb() runtiming from /client/Click() thousands of times Co-authored-by: Kylerace <kylerlumpkin1@gmail.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
This commit is contained in:
@@ -82,7 +82,7 @@ VERB_MANAGER_SUBSYSTEM_DEF(input)
|
||||
stack_trace("non /datum/callback/verb_callback instance inside SSinput's verb_queue!")
|
||||
continue
|
||||
|
||||
average_click_delay = MC_AVG_FAST_UP_SLOW_DOWN(average_click_delay, (REALTIMEOFDAY - queued_click.creation_time) SECONDS)
|
||||
average_click_delay = MC_AVG_FAST_UP_SLOW_DOWN(average_click_delay, TICKS2DS((DS2TICKS(world.time) - queued_click.creation_time)) SECONDS)
|
||||
queued_click.InvokeAsync()
|
||||
|
||||
current_clicks++
|
||||
|
||||
@@ -56,9 +56,24 @@ SUBSYSTEM_DEF(verb_manager)
|
||||
* returns TRUE if the queuing was successful, FALSE otherwise.
|
||||
*/
|
||||
/proc/_queue_verb(datum/callback/verb_callback/incoming_callback, tick_check, datum/controller/subsystem/verb_manager/subsystem_to_use = SSverb_manager, ...)
|
||||
if(QDELETED(incoming_callback) \
|
||||
|| QDELETED(incoming_callback.object))
|
||||
stack_trace("_queue_verb() returned false because it was given an invalid callback!")
|
||||
if(QDELETED(incoming_callback))
|
||||
var/destroyed_string
|
||||
if(!incoming_callback)
|
||||
destroyed_string = "callback is null."
|
||||
else
|
||||
destroyed_string = "callback was deleted [DS2TICKS(world.time - incoming_callback.gc_destroyed)] ticks ago. callback was created [DS2TICKS(world.time) - incoming_callback.creation_time] ticks ago."
|
||||
|
||||
stack_trace("_queue_verb() returned false because it was given a deleted callback! [destroyed_string]")
|
||||
return FALSE
|
||||
|
||||
if(!istext(incoming_callback.object) && QDELETED(incoming_callback.object)) //just in case the object is GLOBAL_PROC
|
||||
var/destroyed_string
|
||||
if(!incoming_callback.object)
|
||||
destroyed_string = "callback.object is null."
|
||||
else
|
||||
destroyed_string = "callback.object was deleted [DS2TICKS(world.time - incoming_callback.object.gc_destroyed)] ticks ago. callback was created [DS2TICKS(world.time) - incoming_callback.creation_time] ticks ago."
|
||||
|
||||
stack_trace("_queue_verb() returned false because it was given a callback acting on a qdeleted object! [destroyed_string]")
|
||||
return FALSE
|
||||
|
||||
//we want unit tests to be able to directly call verbs that attempt to queue, and since unit tests should test internal behavior, we want the queue
|
||||
|
||||
Reference in New Issue
Block a user