Runechat no longer breaks if the tick lag changes (#53570)

Resets the runechat bucket when the tick lag changes
This commit is contained in:
Couls
2020-09-10 13:10:00 -04:00
committed by GitHub
parent 64196b4b77
commit 353d0fb702

View File

@@ -50,6 +50,7 @@ SUBSYSTEM_DEF(runechat)
if (MC_TICK_CHECK)
return
// Check for when we need to loop the buckets, this occurs when
// the head_offset is approaching BUCKET_LEN ticks in the past
if (practical_offset > BUCKET_LEN)
@@ -57,6 +58,11 @@ SUBSYSTEM_DEF(runechat)
practical_offset = 1
resumed = FALSE
// Check for when we have to reset buckets, typically from auto-reset
if ((length(bucket_list) != BUCKET_LEN) || (world.tick_lag != bucket_resolution))
reset_buckets()
bucket_list = src.bucket_list
resumed = FALSE
// Store a reference to the 'working' chatmessage so that we can resume if the MC
// has us stop mid-way through processing
var/static/datum/chatmessage/cm
@@ -119,6 +125,11 @@ SUBSYSTEM_DEF(runechat)
bucket_list |= SSrunechat.bucket_list
second_queue |= SSrunechat.second_queue
/datum/controller/subsystem/runechat/proc/reset_buckets()
bucket_list.len = BUCKET_LEN
head_offset = world.time
bucket_resolution = world.tick_lag
/**
* Enters the runechat subsystem with this chatmessage, inserting it into the end-of-life queue
*