Files
Aurora.3/code/controllers/subsystems/mob.dm
Lohikar f8cdcd013c More initialize tweaks (#2971)
changes:

Organs now use Initialize().
The observe message now shows the configured respawn delay instead of always 30 minutes.
Seed datums no longer have a timer in New().
External organs no longer have a timer in New()/Initialize()
Converted some spawns in organs to timers.
Floor init no longer breaks to plating first for mapped in tiles.
Added the INITIALIZE_IMMEDIATE macro to make Initialize() not wait for SSatoms init.
Mannequins now use INITIALIZE_IMMEDIATE instead of a custom-defined New().
Mannequins (from get_mannequin) now delete themselves if unused for 5 minutes or longer.
2017-07-28 12:00:36 +03:00

65 lines
1.6 KiB
Plaintext

/var/datum/controller/subsystem/mobs/SSmob
/datum/controller/subsystem/mobs
name = "Mobs"
flags = SS_NO_INIT
priority = SS_PRIORITY_MOB
var/list/slept = list()
var/list/currentrun = list()
var/list/all_mice = list() // Contains all *living* mice.
var/list/mannequins = list() //Contains all mannequins used by character preview
/datum/controller/subsystem/mobs/New()
NEW_SS_GLOBAL(SSmob)
/datum/controller/subsystem/mobs/stat_entry()
..("P:[mob_list.len]")
/datum/controller/subsystem/mobs/fire(resumed = 0)
if (!resumed)
src.currentrun = mob_list.Copy()
var/list/currentrun = src.currentrun
while (currentrun.len)
var/mob/M = currentrun[currentrun.len]
currentrun.len--
if (QDELETED(M))
log_debug("SSmob: QDELETED mob [DEBUG_REF(M)] left in processing list!")
// We can just go ahead and remove them from all the mob lists.
mob_list -= M
dead_mob_list -= M
living_mob_list -= M
if (MC_TICK_CHECK)
return
continue
var/time = world.time
M.Life()
if (time != world.time && !slept[M.type])
slept[M.type] = TRUE
var/diff = world.time - time
log_debug("SSmob: Type '[M.type]' slept for [diff] ds in Life()! Suppressing further warnings.")
if (MC_TICK_CHECK)
return
/datum/controller/subsystem/mobs/proc/get_mannequin(ckey)
. = mannequins[ckey]
if (!.)
. = new /mob/living/carbon/human/dummy/mannequin
mannequins[ckey] = .
addtimer(CALLBACK(src, .proc/del_mannequin, ckey), 5 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE)
/datum/controller/subsystem/mobs/proc/del_mannequin(ckey)
var/mannequin = mannequins[ckey]
qdel(mannequin)
mannequins -= ckey