mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-03-20 18:52:51 +00:00
* Unit Test rework & Master/Ticker update * Fixes and working unit testing * Fixes * Test fixes and FA update * Fixed runtimes * Radio subsystem * move that glob wherever later * ident * CIBUILDING compile option * Fixed runtimes * Some changes to the workflow * CI Split * More split * Pathing * Linters and Annotators * ci dir fix * Missing undef fixed * Enable grep checks * More test conversions * More split * Correct file * Removes unneeded inputs * oop * More dependency changes * More conversions * Conversion fixes * Fixes * Some assert fixes * Corrects start gate * Converted some README.dms to README.mds * Removes duplicate proc * Removes unused defines * Example configs * fix dll access viol by double calling * Post-rebase fixes * Cleans up names global list * Undef restart counter * More code/game/ cleanup * Statpanel update * Skybox * add * Fix ticker * Roundend fix * Persistence dependency update * Reordering * Reordering * Reordering * Initstage fix * . * . * Reorder * Reorder * Circle * Mobs * Air * Test fix * CI Script Fix * Configs * More ticker stuff * This is now in 'reboot world' * Restart world announcements * no glob in PreInit * to define * Update * Removed old include * Make this file normal again * moved * test * shared unit testing objects * Updates batched_spritesheets and universal_icon * . * job data debug * rm that * init order * show us * . * i wonder * . * . * urg * do we not have a job ID? * . * rm sleep for now * updated rust-g linux binaries * binaries update 2 * binaries update 3 * testing something * change that * test something * . * . * . * locavar * test * move that * . * debug * don't run this test * strack trace it * cleaner * . * . * cras again * also comment this out * return to official rust g * Update robot_icons.dm * monitor the generation * . --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
138 lines
4.3 KiB
Plaintext
138 lines
4.3 KiB
Plaintext
//
|
|
// Mobs Subsystem - Process mob.Life()
|
|
//
|
|
|
|
//VOREStation Edits - Contains temporary debugging code to diagnose extreme tick consumption.
|
|
//Revert file to Polaris version when done.
|
|
|
|
SUBSYSTEM_DEF(mobs)
|
|
name = "Mobs"
|
|
priority = FIRE_PRIORITY_MOBS
|
|
wait = 2 SECONDS
|
|
flags = SS_KEEP_TIMING|SS_NO_INIT
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
|
|
|
dependencies = list(
|
|
/datum/controller/subsystem/atoms,
|
|
/datum/controller/subsystem/points_of_interest,
|
|
/datum/controller/subsystem/shuttles
|
|
)
|
|
|
|
var/list/currentrun = list()
|
|
var/log_extensively = FALSE
|
|
var/list/timelog = list()
|
|
|
|
var/slept_mobs = 0
|
|
var/list/process_z = list()
|
|
|
|
var/list/death_list = list()
|
|
|
|
/datum/controller/subsystem/mobs/stat_entry(msg)
|
|
msg = "P: [GLOB.mob_list.len] | S: [slept_mobs] | D: [death_list.len]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/mobs/fire(resumed = 0)
|
|
if (!resumed)
|
|
src.currentrun = GLOB.mob_list.Copy()
|
|
process_z.len = GLOB.living_players_by_zlevel.len
|
|
slept_mobs = 0
|
|
for(var/level in 1 to process_z.len)
|
|
process_z[level] = GLOB.living_players_by_zlevel[level].len
|
|
// Lets handle all of these while we have time, should always remain extremely small...
|
|
if(death_list.len) // Don't contact DB if this list is empty
|
|
if(CONFIG_GET(flag/sql_enabled))
|
|
establish_db_connection()
|
|
if(!SSdbcore.IsConnected())
|
|
log_game("SQL ERROR during death reporting. Failed to connect.")
|
|
else
|
|
SSdbcore.MassInsert(format_table_name("death"), death_list)
|
|
death_list.Cut()
|
|
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
var/times_fired = src.times_fired
|
|
while(currentrun.len)
|
|
var/mob/M = currentrun[currentrun.len]
|
|
currentrun.len--
|
|
|
|
if(!M || QDELETED(M))
|
|
GLOB.mob_list -= M
|
|
continue
|
|
else if(M.low_priority && !(M.loc && get_z(M) && process_z[get_z(M)]))
|
|
slept_mobs++
|
|
continue
|
|
|
|
M.Life(times_fired)
|
|
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/controller/subsystem/mobs/proc/log_recent()
|
|
var/msg = "Debug output from the [name] subsystem:\n"
|
|
msg += "- This subsystem is processed tail-first -\n"
|
|
if(!currentrun || !GLOB.mob_list)
|
|
msg += "ERROR: A critical list [currentrun ? "mob_list" : "currentrun"] is gone!"
|
|
log_game(msg)
|
|
log_world(msg)
|
|
return
|
|
msg += "Lists: currentrun: [currentrun.len], mob_list: [GLOB.mob_list.len]\n"
|
|
|
|
if(!currentrun.len)
|
|
msg += "!!The subsystem just finished the mob_list list, and currentrun is empty (or has never run).\n"
|
|
msg += "!!The info below is the tail of mob_list instead of currentrun.\n"
|
|
|
|
var/datum/D = currentrun.len ? currentrun[currentrun.len] : GLOB.mob_list[GLOB.mob_list.len]
|
|
msg += "Tail entry: [describeThis(D)] (this is likely the item AFTER the problem item)\n"
|
|
|
|
var/position = GLOB.mob_list.Find(D)
|
|
if(!position)
|
|
msg += "Unable to find context of tail entry in mob_list list.\n"
|
|
else
|
|
if(position != GLOB.mob_list.len)
|
|
var/additional = GLOB.mob_list.Find(D, position+1)
|
|
if(additional)
|
|
msg += "WARNING: Tail entry found more than once in mob_list list! Context is for the first found.\n"
|
|
var/start = clamp(position-2,1,GLOB.mob_list.len)
|
|
var/end = clamp(position+2,1,GLOB.mob_list.len)
|
|
msg += "2 previous elements, then tail, then 2 next elements of mob_list list for context:\n"
|
|
msg += "---\n"
|
|
for(var/i in start to end)
|
|
msg += "[describeThis(GLOB.mob_list[i])][i == position ? " << TAIL" : ""]\n"
|
|
msg += "---\n"
|
|
log_game(msg)
|
|
log_world(msg)
|
|
|
|
/datum/controller/subsystem/mobs/proc/report_death(var/mob/living/L)
|
|
if(!L)
|
|
return
|
|
if(!L.key || !L.mind)
|
|
return
|
|
if(!SSticker || !SSticker.mode)
|
|
return
|
|
SSticker.mode.check_win()
|
|
|
|
// Don't bother with the rest if we've not got a DB to do anything with
|
|
if(!CONFIG_GET(flag/enable_stat_tracking) || !CONFIG_GET(flag/sql_enabled))
|
|
return
|
|
|
|
var/area/placeofdeath = get_area(L)
|
|
var/podname = placeofdeath ? placeofdeath.name : "Unknown area"
|
|
|
|
var/list/data = list(
|
|
"name" = "[L.real_name]",
|
|
"byondkey" = "[L.key]",
|
|
"job" = "[L.mind.assigned_role]",
|
|
"special" = "[L.mind.special_role]",
|
|
"pod" = podname,
|
|
"tod" = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss"),
|
|
"laname" = L.lastattacker ? L.lastattacker:real_name : "",
|
|
"lakey" = L.lastattacker ? L.lastattacker:key : "",
|
|
"gender" = L.gender,
|
|
"bruteloss" = L.getBruteLoss(),
|
|
"fireloss" = L.getFireLoss(),
|
|
"brainloss" = L.brainloss,
|
|
"oxyloss" = L.getOxyLoss(),
|
|
"coord" = "[L.x], [L.y], [L.z]"
|
|
)
|
|
death_list += list(data)
|