Caches the status topic to prevent low-effort DDoSes

This commit is contained in:
deathride58
2020-01-08 18:47:45 -05:00
parent d9783d2bba
commit 33df154689
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -138,6 +138,9 @@
keyword = "status"
/datum/world_topic/status/Run(list/input)
if(GLOB.topic_status_lastcache <= world.time + 5)
return GLOB.topic_status_cache
GLOB.topic_status_lastcache = world.time
. = list()
.["version"] = GLOB.game_version
.["mode"] = "hidden" //CIT CHANGE - hides the gamemode in topic() calls to prevent meta'ing the gamemode
@@ -180,4 +183,5 @@
// Shuttle status, see /__DEFINES/stat.dm
.["shuttle_timer"] = SSshuttle.emergency.timeLeft()
// Shuttle timer, in seconds
GLOB.topic_status_cache = .
+3
View File
@@ -2,6 +2,9 @@
GLOBAL_VAR(restart_counter)
GLOBAL_VAR(topic_status_lastcache)
GLOBAL_LIST(topic_status_cache)
//This happens after the Master subsystem new(s) (it's a global datum)
//So subsystems globals exist, but are not initialised
/world/New()