From 0dc1c2db91d1cb8a7073a8ecad7d0dd04f2b169f Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 11 Sep 2020 23:03:45 +0200 Subject: [PATCH] [MIRROR] Runechat no longer breaks if the tick lag changes (#739) * Runechat no longer breaks if the tick lag changes (#53570) Resets the runechat bucket when the tick lag changes * Runechat no longer breaks if the tick lag changes Co-authored-by: Couls --- code/controllers/subsystem/runechat.dm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/controllers/subsystem/runechat.dm b/code/controllers/subsystem/runechat.dm index c0471a7a089..6b950a8cb50 100644 --- a/code/controllers/subsystem/runechat.dm +++ b/code/controllers/subsystem/runechat.dm @@ -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 *