VS: Bellies should probably be a processing subsystem

This commit is contained in:
Aronai Sieyes
2020-03-30 12:18:40 -04:00
parent b77334cb95
commit 1205f01b0d

View File

@@ -12,9 +12,20 @@ SUBSYSTEM_DEF(bellies)
flags = SS_KEEP_TIMING|SS_NO_INIT
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
var/static/list/belly_list = list()
var/list/belly_list = list()
var/list/currentrun = list()
var/ignored_bellies = 0
var/obj/belly/current_belly
/datum/controller/subsystem/bellies/Recover()
log_debug("[name] subsystem Recover().")
if(SSbellies.current_belly)
log_debug("current_belly was: (\ref[SSbellies.current_belly])[SSbellies.current_belly]([SSbellies.current_belly.type])(SSbellies.current_belly.owner) - currentrun: [SSbellies.currentrun.len] vs total: [SSbellies.belly_list.len]")
var/list/old_bellies = SSbellies.belly_list.Copy()
for(var/datum/D in old_bellies)
if(!isbelly(D))
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
belly_list |= D
/datum/controller/subsystem/bellies/stat_entry()
..("#: [belly_list.len] | P: [ignored_bellies]")
@@ -28,14 +39,17 @@ SUBSYSTEM_DEF(bellies)
var/list/currentrun = src.currentrun
var/times_fired = src.times_fired
while(currentrun.len)
var/obj/belly/B = currentrun[currentrun.len]
current_belly = currentrun[currentrun.len]
currentrun.len--
if(QDELETED(B))
belly_list -= B
if(QDELETED(current_belly))
belly_list -= current_belly
else
if(B.process_belly(times_fired,wait) == SSBELLIES_IGNORED)
if(current_belly.process_belly(times_fired,wait) == SSBELLIES_IGNORED)
ignored_bellies++
if (MC_TICK_CHECK)
current_belly = null
return
current_belly = null