mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 15:42:35 +00:00
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.
* this is probably important
* Remove cascade disabling SSgarbage
* Fixed a bug where dust() did not qdel the target mob
* Misc fixes
* Fix decals surviving break-to-plating
* Subsystem flag tweaks
* Apparently subsystems are new'd before config is.
* Fix paper icons
* Speculative fix for insane lag
* Better machinery stat
* Make organs not use SSoverlay
* Misc bugfixes & tweaks
* Nightmode fixes
* Changelog for SMC
* Port /tg/'s improved MC crash handling
* Add some more SS Recover() procs
* supply_controller -> SScargo
* More New() -> Initialize()
* pAI and robot construction overlays
* Fix cargo unit tests
* Merge the DMM Suite's atom/New() into atoms_init
* Lighting pre-baking
* Lighting initialization logging
* Fix some bad SS init orders
* Fix SSlighting logging; rename Processes to MC
* Speculative fix for insane GC lag
* Prebaked openturf/icon_smooth & fix lighting prebake
* SS init status; SSatoms LATEQDEL
* Fix bug with MC init stat panel
* Fix parallax
* Misc
* Ignore SS_NO_DISPLAY during init
* apparently this is important
* REEEEEE
* Image GC fixes; broadcaster radio-new sanity
* RCON Cleanup
* Move pAI recruiter into subsystem
* Move global solars list into sun subsystem
* Make chickens not use a global
* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup
* Speed up space init a little
* Fix bad timer flags on floor drying
* Subsystem panic-restart verb for mins
* Explosion speedup
* Minor subsystem & MC logging tweaks
* SSopenturf improvements
* Make pipenet actually initialize (whoops)
* Minor tweaks
* Implement lighting rounding
* comments are hard okay
* Minor lattice tweaks
* Fix some timer issues & better closet init
* Timer sanity
* Request console tweaks + Storage init sanity
* Minor SSmachiner RCON improvements
* Further reduce world-start timer count
* Standardize subsystem logging
* Garbage hard delete profiling from /tg/
* Timer hang detection & recovery
* Log machines that sleep in process() and fuck up SSmachinery
* Fix an issue with external airlocks sleeping in process()
* Failsafe logging
* Minor tweaks
* Revert "Request console tweaks + Storage init sanity"
This reverts commit 98d3579e35.
* Re-implement RC changes
* Fix SQL FT saving
* Fix SSmachinery sleep in disposals
* Minor SS tweaks
* Paper fixes
* Blood drying fixes
* Merge gameticker and SSticker
* Minor global list init cleanup
* Lagcheck biogenerator & bags
* Tweak SScargo init order; RIG Initialize()
* Caching tweaks
* Remove rogue comma
* Initialize fixes
* Lighting destroy cleanup
* Fix emagging airlocks
* Initial SSicon implementation
* Tweaks & Fixes
* Fire + Air alarm queued icon updates
* Overlays + Queued icon cleanup
* Runtime & background fixes
* Kill some meaningless set statements
* Kill some image qdels
* Bump up lighting rounding val
* Fix adv. scanner destroy runtimes
* Remove unneeded icon update limiting
* Move icon smoothing into helpers
* Show a warning if DM 510 compiles without memory leak hack enabled
* Re-organize subsystems & MC defines a little
* Airlock SFX
* Log of Changes
* Make SSicon_update disable itself when not doing anything
* Fix respawn verb runtime when used early in server-init
* Add more information to MC's stat_entry()
* Replace direct refernces to gcDestroyed with QDEL* macros
* plant_controller -> SSplants
* More plant tweaks
* Add more humor to changelog
* Move parallax globals into SSparallax
* Lighting responsiveness tweaks
* Fix parallax init order & better MC init panel stat
* Make mobs GC
* More overlays + Remove intercom spawn()
* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.
* Update changelog
* Mob GC tweaks
* Del() cleanup
* Fix insomniac ZAS connection edges
* Minor pAI cleanup
* Convert more things to SSoverlay; fix duplicated overlay in field gens
* SM Bluespace turf tweaks
* Update SSgarbage debug globals list
* Human-type qdel tweaks
* Subsystem suspension; stat_entry improvements
* SQL Statistics cleanup
* Fix runtimes with ambrosia
* More disable() -> suspend(); fix nightmode again
* Human qdel fix; minor tweaks
* Update turbolift to work with StonedMC
* Make lifts use timers instead of a subsystem
* Make SSassets start earlier
* Convert the radio controller into a subsystem
* Fix some missing CHECK_TICKs in asteroid generation
* MC stat tweaks; make shouldnt_see a typecache
* Kill some redundant debug-controller entries
* radio_controller -> SSradio
* Better SSgarbage hard-del logging from /tg/ upstream
* Logging tweaks + GELF
* Misc client caching improvements
* Slime SSoverlay
* Oven icon fixes
* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.
* Holder tweaks + Welding tool Initialize()
* Fix some bad subsystem logging
* Fix suit cooling units spawning without cells
* Starlight tweaks
* Gibber infinite gib fix
* More SSoverlay stuff
* Make crates use CUT_OVERLAY_IN
* Make SSarrivals suspend instead of disable
* Make openturf use split/phased tick checks
* Speculative fix for unwet timer runtimes
* Blood overlay tweaks/fixes
* Update crusher to play nice with SMC + SSoverlay
* Openturf improvements and fixes
* Minor turbolift tweaks
* Lighting performance improvements + ChangeTurf tweaks
* this is probably important
* Fix wall weld noises on changeturf
* More ChangeTurf tweaks
* Explosion tweaks
* Pre-game lobby tweaks
* Openturf tweaks
* Prevent admins from starting the game before init finishes
* Fix Travis
* Kill an unused var
* Fix ChangeTurf runtimes on openturfs
* Fixes
* Browser datum fixes, asset caching
* Update changelog
* Changelog
* Lobby tweaks
* Ticker tweaks; kill ticker var
* Further lobby tweaks
* Cascade tweaks
* air_master -> SSair
* Reduce overhead from radio autosay
* alarm_manager -> SSalarm
* bomb_processor -> SSexplosives
* corp_regs -> SSlaw
* ZAS overlay fixes
* Small wall icon optimization
* Fix effects master
* Assembly tweaks
* Megavend fixes
* Shuttle fixes
* Camera alert performance improvements
* Fix some world.log spam from lighting overlays
* Fix some Initialize() procs
* Openspace responsiveness tweaks
* Make HE pipes animate through openturfs
* Kill a spawn
268 lines
9.3 KiB
Plaintext
268 lines
9.3 KiB
Plaintext
/var/datum/controller/subsystem/statistics/SSfeedback
|
|
|
|
/datum/controller/subsystem/statistics
|
|
name = "Statistics & Inactivity"
|
|
wait = 1 MINUTE
|
|
flags = SS_NO_TICK_CHECK | SS_BACKGROUND
|
|
priority = SS_PRIORITY_STATISTICS
|
|
|
|
var/list/messages = list() //Stores messages of non-standard frequencies
|
|
var/list/messages_admin = list()
|
|
|
|
var/list/msg_common = list()
|
|
var/list/msg_science = list()
|
|
var/list/msg_command = list()
|
|
var/list/msg_medical = list()
|
|
var/list/msg_engineering = list()
|
|
var/list/msg_security = list()
|
|
var/list/msg_deathsquad = list()
|
|
var/list/msg_syndicate = list()
|
|
var/list/msg_cargo = list()
|
|
var/list/msg_service = list()
|
|
|
|
var/list/datum/feedback_variable/feedback = list()
|
|
|
|
/datum/controller/subsystem/statistics/New()
|
|
NEW_SS_GLOBAL(SSfeedback)
|
|
|
|
/datum/controller/subsystem/statistics/Initialize(timeofday)
|
|
if (!config.kick_inactive && !(config.sql_enabled && config.sql_stats))
|
|
can_fire = FALSE
|
|
|
|
/datum/controller/subsystem/statistics/fire()
|
|
// Handle AFK.
|
|
if (config.kick_inactive)
|
|
var/inactivity_threshold = config.kick_inactive MINUTES
|
|
for (var/client/C in clients)
|
|
if (!istype(C.mob, /mob/dead))
|
|
if (C.is_afk(inactivity_threshold))
|
|
log_access("AFK: [key_name(C)]")
|
|
C << span("warning", "You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.")
|
|
qdel(C)
|
|
|
|
// Handle population polling.
|
|
if (config.sql_enabled && config.sql_stats)
|
|
var/admincount = admins.len
|
|
var/playercount = 0
|
|
for(var/mob/M in player_list)
|
|
if(M.client)
|
|
playercount += 1
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
log_game("SQL ERROR during population polling. Failed to connect.")
|
|
else
|
|
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
|
var/DBQuery/query = dbcon.NewQuery("INSERT INTO `ss13_population` (`playercount`, `admincount`, `time`) VALUES ([playercount], [admincount], '[sqltime]')")
|
|
if(!query.Execute())
|
|
var/err = query.ErrorMsg()
|
|
log_game("SQL ERROR during population polling. Error : \[[err]\]\n")
|
|
|
|
/datum/controller/subsystem/statistics/Recover()
|
|
src.messages = SSfeedback.messages
|
|
src.messages_admin = SSfeedback.messages_admin
|
|
|
|
src.msg_common = SSfeedback.msg_common
|
|
src.msg_science = SSfeedback.msg_science
|
|
src.msg_command = SSfeedback.msg_command
|
|
src.msg_medical = SSfeedback.msg_medical
|
|
src.msg_engineering = SSfeedback.msg_engineering
|
|
src.msg_security = SSfeedback.msg_security
|
|
src.msg_deathsquad = SSfeedback.msg_deathsquad
|
|
src.msg_syndicate = SSfeedback.msg_syndicate
|
|
src.msg_cargo = SSfeedback.msg_cargo
|
|
src.msg_service = SSfeedback.msg_service
|
|
|
|
src.feedback = SSfeedback.feedback
|
|
|
|
/datum/controller/subsystem/statistics/proc/find_feedback_datum(variable)
|
|
for (var/datum/feedback_variable/FV in feedback)
|
|
if (FV.get_variable() == variable)
|
|
return FV
|
|
|
|
var/datum/feedback_variable/FV = new(variable)
|
|
feedback += FV
|
|
return FV
|
|
|
|
/datum/controller/subsystem/statistics/proc/get_round_feedback()
|
|
return feedback
|
|
|
|
/datum/controller/subsystem/statistics/proc/round_end_data_gathering()
|
|
var/pda_msg_amt = 0
|
|
var/rc_msg_amt = 0
|
|
|
|
for(var/obj/machinery/message_server/MS in machines)
|
|
if(MS.pda_msgs.len > pda_msg_amt)
|
|
pda_msg_amt = MS.pda_msgs.len
|
|
if(MS.rc_msgs.len > rc_msg_amt)
|
|
rc_msg_amt = MS.rc_msgs.len
|
|
|
|
feedback_set_details("radio_usage","")
|
|
|
|
feedback_add_details("radio_usage","COM-[msg_common.len]")
|
|
feedback_add_details("radio_usage","SCI-[msg_science.len]")
|
|
feedback_add_details("radio_usage","HEA-[msg_command.len]")
|
|
feedback_add_details("radio_usage","MED-[msg_medical.len]")
|
|
feedback_add_details("radio_usage","ENG-[msg_engineering.len]")
|
|
feedback_add_details("radio_usage","SEC-[msg_security.len]")
|
|
feedback_add_details("radio_usage","DTH-[msg_deathsquad.len]")
|
|
feedback_add_details("radio_usage","SYN-[msg_syndicate.len]")
|
|
feedback_add_details("radio_usage","CAR-[msg_cargo.len]")
|
|
feedback_add_details("radio_usage","SRV-[msg_service.len]")
|
|
feedback_add_details("radio_usage","OTH-[messages.len]")
|
|
feedback_add_details("radio_usage","PDA-[pda_msg_amt]")
|
|
feedback_add_details("radio_usage","RC-[rc_msg_amt]")
|
|
|
|
|
|
feedback_set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
|
|
|
|
// Called on world reboot.
|
|
/datum/controller/subsystem/statistics/Shutdown()
|
|
if(!feedback)
|
|
return
|
|
|
|
if (!config.sql_enabled || !config.sql_stats)
|
|
return
|
|
|
|
round_end_data_gathering() //round_end time logging and some other data processing
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
return
|
|
|
|
for(var/datum/feedback_variable/FV in feedback)
|
|
var/sql = "INSERT INTO ss13_feedback VALUES (null, Now(), \"[game_id]\", \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
|
|
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
|
query_insert.Execute()
|
|
|
|
|
|
// Sanitize inputs to avoid SQL injection attacks
|
|
/proc/sql_sanitize_text(var/text)
|
|
text = replacetext(text, "'", "''")
|
|
text = replacetext(text, ";", "")
|
|
text = replacetext(text, "&", "")
|
|
return text
|
|
|
|
/proc/feedback_set(var/variable,var/value)
|
|
if(!SSfeedback)
|
|
return
|
|
|
|
variable = sql_sanitize_text(variable)
|
|
|
|
var/datum/feedback_variable/FV = SSfeedback.find_feedback_datum(variable)
|
|
|
|
if(!FV) return
|
|
|
|
FV.set_value(value)
|
|
|
|
/proc/feedback_inc(var/variable,var/value)
|
|
if(!SSfeedback) return
|
|
|
|
variable = sql_sanitize_text(variable)
|
|
|
|
var/datum/feedback_variable/FV = SSfeedback.find_feedback_datum(variable)
|
|
|
|
if(!FV) return
|
|
|
|
FV.inc(value)
|
|
|
|
/proc/feedback_dec(var/variable,var/value)
|
|
if(!SSfeedback) return
|
|
|
|
variable = sql_sanitize_text(variable)
|
|
|
|
var/datum/feedback_variable/FV = SSfeedback.find_feedback_datum(variable)
|
|
|
|
if(!FV) return
|
|
|
|
FV.dec(value)
|
|
|
|
/proc/feedback_set_details(var/variable,var/details)
|
|
if(!SSfeedback) return
|
|
|
|
variable = sql_sanitize_text(variable)
|
|
details = sql_sanitize_text(details)
|
|
|
|
var/datum/feedback_variable/FV = SSfeedback.find_feedback_datum(variable)
|
|
|
|
if(!FV) return
|
|
|
|
FV.set_details(details)
|
|
|
|
/proc/feedback_add_details(var/variable,var/details)
|
|
if(!SSfeedback) return
|
|
|
|
variable = sql_sanitize_text(variable)
|
|
details = sql_sanitize_text(details)
|
|
|
|
var/datum/feedback_variable/FV = SSfeedback.find_feedback_datum(variable)
|
|
|
|
if(!FV) return
|
|
|
|
FV.add_details(details)
|
|
|
|
/proc/sql_report_death(var/mob/living/carbon/human/H)
|
|
if(!config.sql_enabled || !config.sql_stats)
|
|
return
|
|
if(!H)
|
|
return
|
|
if(!H.key || !H.mind)
|
|
return
|
|
|
|
var/area/placeofdeath = get_area(H)
|
|
var/podname = placeofdeath ? placeofdeath.name : "Unknown area"
|
|
|
|
var/sqlname = sanitizeSQL(H.real_name)
|
|
var/sqlkey = sanitizeSQL(H.key)
|
|
var/sqlpod = sanitizeSQL(podname)
|
|
var/sqlspecial = sanitizeSQL(H.mind.special_role)
|
|
var/sqljob = sanitizeSQL(H.mind.assigned_role)
|
|
var/laname
|
|
var/lakey
|
|
if(H.lastattacker)
|
|
laname = sanitizeSQL(H.lastattacker:real_name)
|
|
lakey = sanitizeSQL(H.lastattacker:key)
|
|
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
|
var/coord = "[H.x], [H.y], [H.z]"
|
|
//world << "INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.bruteloss], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()])"
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
log_game("SQL ERROR during death reporting. Failed to connect.")
|
|
else
|
|
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
|
if(!query.Execute())
|
|
var/err = query.ErrorMsg()
|
|
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|
|
|
|
|
|
/proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H)
|
|
if(!config.sql_enabled || !config.sql_stats)
|
|
return
|
|
if(!H)
|
|
return
|
|
if(!H.key || !H.mind)
|
|
return
|
|
|
|
var/area/placeofdeath = get_area(H)
|
|
var/podname = placeofdeath ? placeofdeath.name : "Unknown area"
|
|
|
|
var/sqlname = sanitizeSQL(H.real_name)
|
|
var/sqlkey = sanitizeSQL(H.key)
|
|
var/sqlpod = sanitizeSQL(podname)
|
|
var/sqlspecial = sanitizeSQL(H.mind.special_role)
|
|
var/sqljob = sanitizeSQL(H.mind.assigned_role)
|
|
var/laname
|
|
var/lakey
|
|
if(H.lastattacker)
|
|
laname = sanitizeSQL(H.lastattacker:real_name)
|
|
lakey = sanitizeSQL(H.lastattacker:key)
|
|
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
|
var/coord = "[H.x], [H.y], [H.z]"
|
|
//world << "INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.bruteloss], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()])"
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
log_game("SQL ERROR during death reporting. Failed to connect.")
|
|
else
|
|
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
|
if(!query.Execute())
|
|
var/err = query.ErrorMsg()
|
|
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|