diff --git a/code/__DEFINES/_tick.dm b/code/__DEFINES/_tick.dm index 1ac004b5673..47b88720ba5 100644 --- a/code/__DEFINES/_tick.dm +++ b/code/__DEFINES/_tick.dm @@ -20,6 +20,11 @@ /// runs stoplag if tick_usage is above the limit #define CHECK_TICK ( TICK_CHECK ? stoplag() : 0 ) +/// Checks if a sleeping proc is running before or after the master controller +#define RUNNING_BEFORE_MASTER ( Master.last_run != null && Master.last_run != world.time ) +/// Returns true if a verb ought to yield to the MC (IE: queue up to be processed by a subsystem) +#define VERB_SHOULD_YIELD ( TICK_CHECK || RUNNING_BEFORE_MASTER ) + /// Returns true if tick usage is above 95, for high priority usage #define TICK_CHECK_HIGH_PRIORITY ( TICK_USAGE > 95 ) /// runs stoplag if tick_usage is above 95, for high priority usage diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm index 4d4651b305b..8b01cc283c6 100644 --- a/code/datums/chatmessage.dm +++ b/code/datums/chatmessage.dm @@ -171,7 +171,7 @@ WXH_TO_HEIGHT(owned_by.MeasureText(complete_text, null, CHAT_MESSAGE_WIDTH), mheight) - if(!TICK_CHECK) + if(!VERB_SHOULD_YIELD) return finish_image_generation(mheight, target, owner, complete_text, lifespan) var/datum/callback/our_callback = CALLBACK(src, PROC_REF(finish_image_generation), mheight, target, owner, complete_text, lifespan)