Just deleted about 400 bot accounts and a bunch of spam. To mitigate this in the future, we've enabled reCaptcha on signup. Let me know if someone got caught in the crossfire.

Commit 2348f416 authored by Sood's avatar Sood Committed by GitHub
Browse files

Population statistics collection (#13995)

* Population statistics collection

* fix

* I may have forgotten this line
parent a23c60cf
......@@ -30,6 +30,7 @@
var/explosion_stats = list()
var/uplink_purchases = list()
var/badass_bundles = list()
var/population_polls = list()
// Blood spilled in c.liters
var/blood_spilled = 0
var/crates_ordered = 0
......@@ -50,6 +51,13 @@
var/mixed_gamemodes = null
var/round_start_time = null
/datum/stat/population_stat
var/time
var/popcount = 0
/datum/stat/population_stat/New()
time = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
/datum/stat/death_stat
var/mob_typepath = "null"
var/death_x = 0
......@@ -177,6 +185,10 @@
tech_level_total += KT.level
return tech_level_total
/datum/stat_collector/proc/writePopulationStats(statfile)
for(var/datum/stat/population_stat/PS in population_polls)
statfile << "POPCOUNT|[PS.time]|[PS.popcount]"
/datum/stat_collector/proc/antagCheck(statfile)
for(var/datum/mind/Mind in ticker.minds)
for(var/datum/objective/objective in Mind.objectives)
......@@ -254,9 +266,24 @@
revsquad.writeStats(statfile)
antagCheck(statfile)
writePopulationStats(statfile)
Write_Footer(statfile)
world << "Statistics written to file in [(start_time - world.realtime)/10] seconds." // I think that's right?
// TODO write all living mobs to DB
// Global stuff
/proc/population_poll()
var/playercount = 0
for(var/mob/M in player_list)
if(M.client)
playercount += 1
stat_collection.population_polls += (new /datum/stat/population_stat(playercount))
/proc/population_poll_loop()
while(1)
population_poll()
sleep(5 MINUTES) // we're called inside a spawn() so we'll be fine
......@@ -224,6 +224,8 @@ var/datum/controller/gameticker/ticker
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
stat_collection.round_start_time = world.realtime
spawn(5 MINUTES) // poll every 5 minutes
population_poll_loop()
wageSetup()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment