Merge pull request #44548 from vuonojenmustaturska/sanity

Add periodic cleaning of several player-containing lists to server tasks
This commit is contained in:
oranges
2019-06-17 13:56:41 +12:00
committed by GitHub

View File

@@ -8,6 +8,7 @@ SUBSYSTEM_DEF(server_maint)
init_order = INIT_ORDER_SERVER_MAINT
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun
var/cleanup_ticker = 0
/datum/controller/subsystem/server_maint/PreInit()
world.hub_password = "" //quickly! before the hubbies see us.
@@ -23,6 +24,32 @@ SUBSYSTEM_DEF(server_maint)
log_world("Found a null in clients list!")
src.currentrun = GLOB.clients.Copy()
switch (cleanup_ticker) // do only one of these at a time, once per 5 fires
if (0)
if(listclearnulls(GLOB.player_list))
log_world("Found a null in player_list!")
cleanup_ticker++
if (5)
if(listclearnulls(GLOB.mob_list))
log_world("Found a null in mob_list!")
cleanup_ticker++
if (10)
if(listclearnulls(GLOB.alive_mob_list))
log_world("Found a null in alive_mob_list!")
cleanup_ticker++
if (15)
if(listclearnulls(GLOB.suicided_mob_list))
log_world("Found a null in suicided_mob_list!")
cleanup_ticker++
if (20)
if(listclearnulls(GLOB.dead_mob_list))
log_world("Found a null in dead_mob_list!")
cleanup_ticker++
if (25)
cleanup_ticker = 0
else
cleanup_ticker++
var/list/currentrun = src.currentrun
var/round_started = SSticker.HasRoundStarted()