[MIRROR] Verb manager subsystem & Speech controller (#9559)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2024-11-29 20:46:55 +01:00
committed by GitHub
co-authored by Heroman3003 Kashargul
parent d0b64d915e
commit 06f69815dd
14 changed files with 157 additions and 146 deletions
@@ -8,15 +8,15 @@
* plus TICK_BYOND_RESERVE from the tick and uses up to that amount of time (minus the percentage of the tick used by the time it executes subsystems)
* on subsystems running cool things like atmospherics or Life or SSInput or whatever.
*
* Without this subsystem, verbs are likely to cause overtime if the MC uses all of the time it has alloted for itself in the tick, and SendMaps
* Without this subsystem, verbs are likely to cause overtime if the MC uses all of the time it has allotted for itself in the tick, and SendMaps
* uses as much as its expected to, and an expensive verb ends up executing that tick. This is because the MC is completely blind to the cost of
* verbs, it can't account for it at all. The only chance for verbs to not cause overtime in a tick where the MC used as much of the tick
* as it alloted itself and where SendMaps costed as much as it was expected to is if the verb(s) take less than TICK_BYOND_RESERVE percent of
* the tick, which isnt much. Not to mention if SendMaps takes more than 30% of the tick and the MC forces itself to take at least 70% of the
* as it allotted itself and where SendMaps costed as much as it was expected to is if the verb(s) take less than TICK_BYOND_RESERVE percent of
* the tick, which isn't much. Not to mention if SendMaps takes more than 30% of the tick and the MC forces itself to take at least 70% of the
* normal tick duration which causes ticks to naturally overrun even in the absence of verbs.
*
* With this subsystem, the MC can account for the cost of verbs and thus stop major overruns of ticks. This means that the most important subsystems
* like SSinput can start at the same time they were supposed to, leading to a smoother experience for the player since ticks arent riddled with
* like SSinput can start at the same time they were supposed to, leading to a smoother experience for the player since ticks aren't riddled with
* minor hangs over and over again.
*/
SUBSYSTEM_DEF(verb_manager)
@@ -36,17 +36,17 @@ SUBSYSTEM_DEF(verb_manager)
///if TRUE we treat usr's with holders just like usr's without holders. otherwise they always execute immediately
var/can_queue_admin_verbs = FALSE
///if this is true all verbs immediately execute and dont queue. in case the mc is fucked or something
///if this is true all verbs immediately execute and don't queue. in case the mc is fucked or something
var/FOR_ADMINS_IF_VERBS_FUCKED_immediately_execute_all_verbs = FALSE
///used for subtypes to determine if they use their own stats for the stat entry
var/use_default_stats = TRUE
///if TRUE this will... message admins every time a verb is queued to this subsystem for the next tick with stats.
///for obvious reasons dont make this be TRUE on the code level this is for admins to turn on
///for obvious reasons don't make this be TRUE on the code level this is for admins to turn on
var/message_admins_on_queue = FALSE
///always queue if possible. overides can_queue_admin_verbs but not FOR_ADMINS_IF_VERBS_FUCKED_immediately_execute_all_verbs
///always queue if possible. overrides can_queue_admin_verbs but not FOR_ADMINS_IF_VERBS_FUCKED_immediately_execute_all_verbs
var/always_queue = FALSE
/**
@@ -87,7 +87,7 @@ SUBSYSTEM_DEF(verb_manager)
#else
if(QDELETED(usr) || isnull(usr.client))
stack_trace("_queue_verb() returned false because it wasnt called from player input!")
stack_trace("_queue_verb() returned false because it wasn't called from player input!")
return FALSE
#endif
@@ -163,5 +163,5 @@ SUBSYSTEM_DEF(verb_manager)
/datum/controller/subsystem/verb_manager/stat_entry(msg)
. = ..()
if (use_default_stats)
if(use_default_stats)
. += "V/S: [round(verbs_executed_per_second, 0.01)]"