Merge branch 'master' into upstream-merge-26131
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
name = "Initializing..."
|
||||
var/target
|
||||
|
||||
/obj/effect/statclick/New(loc, text, target) //Don't port this to Initialize it's too critical
|
||||
INITIALIZE_IMMEDIATE(/obj/effect/statclick)
|
||||
|
||||
/obj/effect/statclick/Initialize(mapload, text, target) //Don't port this to Initialize it's too critical
|
||||
..()
|
||||
name = text
|
||||
src.target = target
|
||||
@@ -43,9 +45,9 @@
|
||||
switch(controller)
|
||||
if("Master")
|
||||
Recreate_MC()
|
||||
feedback_add_details("admin_verb","Restart Master Controller")
|
||||
SSblackbox.add_details("admin_verb","Restart Master Controller")
|
||||
if("Failsafe")
|
||||
new /datum/controller/failsafe()
|
||||
feedback_add_details("admin_verb","Restart Failsafe Controller")
|
||||
SSblackbox.add_details("admin_verb","Restart Failsafe Controller")
|
||||
|
||||
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
|
||||
|
||||
@@ -16,13 +16,14 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
|
||||
gvars_datum_in_built_vars = exclude_these.vars + list("gvars_datum_protected_varlist", "gvars_datum_in_built_vars", "gvars_datum_init_order")
|
||||
qdel(exclude_these)
|
||||
|
||||
log_world("[vars.len - gvars_datum_in_built_vars.len] global variables")
|
||||
|
||||
Initialize()
|
||||
|
||||
/datum/controller/global_vars/Destroy(force)
|
||||
stack_trace("Some fucker qdel'd the global holder!")
|
||||
if(!force)
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
stack_trace("Some fucker deleted the global holder!")
|
||||
|
||||
QDEL_NULL(statclick)
|
||||
gvars_datum_protected_varlist.Cut()
|
||||
@@ -36,10 +37,7 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
|
||||
if(!statclick)
|
||||
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)
|
||||
|
||||
var/static/num_globals
|
||||
if(!num_globals)
|
||||
num_globals = vars.len - gvars_datum_in_built_vars.len
|
||||
stat("Globals:", statclick.update("Count: [num_globals]"))
|
||||
stat("Globals:", statclick.update("Edit"))
|
||||
|
||||
/datum/controller/global_vars/can_vv_get(var_name)
|
||||
if(var_name in gvars_datum_protected_varlist)
|
||||
|
||||
+157
-110
@@ -1,111 +1,158 @@
|
||||
#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
|
||||
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
|
||||
#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
|
||||
|
||||
SUBSYSTEM_DEF(atoms)
|
||||
name = "Atoms"
|
||||
#define BAD_INIT_QDEL_BEFORE 1
|
||||
#define BAD_INIT_DIDNT_INIT 2
|
||||
#define BAD_INIT_SLEPT 4
|
||||
#define BAD_INIT_NO_HINT 8
|
||||
|
||||
SUBSYSTEM_DEF(atoms)
|
||||
name = "Atoms"
|
||||
init_order = INIT_ORDER_ATOMS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/initialized = INITIALIZATION_INSSATOMS
|
||||
var/old_initialized
|
||||
|
||||
var/list/late_loaders
|
||||
|
||||
/datum/controller/subsystem/atoms/Initialize(timeofday)
|
||||
GLOB.fire_overlay.appearance_flags = RESET_COLOR
|
||||
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
InitializeAtoms()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms = null)
|
||||
if(initialized == INITIALIZATION_INSSATOMS)
|
||||
return
|
||||
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
|
||||
var/static/list/NewQdelList = list()
|
||||
|
||||
if(atoms)
|
||||
for(var/I in atoms)
|
||||
var/atom/A = I
|
||||
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
|
||||
if(QDELETED(A))
|
||||
if(!(NewQdelList[A.type]))
|
||||
WARNING("Found new qdeletion in type [A.type]!")
|
||||
NewQdelList[A.type] = TRUE
|
||||
continue
|
||||
var/start_tick = world.time
|
||||
if(A.Initialize(TRUE))
|
||||
LAZYADD(late_loaders, A)
|
||||
if(start_tick != world.time)
|
||||
WARNING("[A]: [A.type] slept during it's Initialize!")
|
||||
CHECK_TICK
|
||||
testing("Initialized [atoms.len] atoms")
|
||||
else
|
||||
#ifdef TESTING
|
||||
var/count = 0
|
||||
#endif
|
||||
for(var/atom/A in world)
|
||||
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
|
||||
if(QDELETED(A))
|
||||
if(!(NewQdelList[A.type]))
|
||||
WARNING("Found new qdeletion in type [A.type]!")
|
||||
NewQdelList[A.type] = TRUE
|
||||
continue
|
||||
var/start_tick = world.time
|
||||
if(A.Initialize(TRUE))
|
||||
LAZYADD(late_loaders, A)
|
||||
#ifdef TESTING
|
||||
else
|
||||
++count
|
||||
#endif TESTING
|
||||
if(start_tick != world.time)
|
||||
WARNING("[A]: [A.type] slept during it's Initialize!")
|
||||
CHECK_TICK
|
||||
testing("Roundstart initialized [count] atoms")
|
||||
|
||||
initialized = INITIALIZATION_INNEW_REGULAR
|
||||
|
||||
for(var/I in late_loaders)
|
||||
var/atom/A = I
|
||||
var/start_tick = world.time
|
||||
A.Initialize(FALSE)
|
||||
if(start_tick != world.time)
|
||||
WARNING("[A]: [A.type] slept during it's Initialize!")
|
||||
CHECK_TICK
|
||||
testing("Late-initialized [LAZYLEN(late_loaders)] atoms")
|
||||
LAZYCLEARLIST(late_loaders)
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_begin()
|
||||
old_initialized = initialized
|
||||
initialized = INITIALIZATION_INSSATOMS
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_stop()
|
||||
initialized = old_initialized
|
||||
|
||||
/datum/controller/subsystem/atoms/Recover()
|
||||
initialized = SSatoms.initialized
|
||||
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
|
||||
InitializeAtoms()
|
||||
old_initialized = SSatoms.old_initialized
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/setupGenetics()
|
||||
var/list/avnums = new /list(DNA_STRUC_ENZYMES_BLOCKS)
|
||||
for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++)
|
||||
avnums[i] = i
|
||||
CHECK_TICK
|
||||
|
||||
for(var/A in subtypesof(/datum/mutation/human))
|
||||
var/datum/mutation/human/B = new A()
|
||||
if(B.dna_block == NON_SCANNABLE)
|
||||
continue
|
||||
B.dna_block = pick_n_take(avnums)
|
||||
if(B.quality == POSITIVE)
|
||||
GLOB.good_mutations |= B
|
||||
else if(B.quality == NEGATIVE)
|
||||
GLOB.bad_mutations |= B
|
||||
else if(B.quality == MINOR_NEGATIVE)
|
||||
GLOB.not_good_mutations |= B
|
||||
CHECK_TICK
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/initialized = INITIALIZATION_INSSATOMS
|
||||
var/old_initialized
|
||||
|
||||
var/list/late_loaders
|
||||
var/list/created_atoms
|
||||
|
||||
var/list/BadInitializeCalls = list()
|
||||
|
||||
/datum/controller/subsystem/atoms/Initialize(timeofday)
|
||||
GLOB.fire_overlay.appearance_flags = RESET_COLOR
|
||||
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
InitializeAtoms()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms)
|
||||
if(initialized == INITIALIZATION_INSSATOMS)
|
||||
return
|
||||
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
|
||||
LAZYINITLIST(late_loaders)
|
||||
|
||||
var/count
|
||||
var/list/mapload_arg = list(TRUE)
|
||||
if(atoms)
|
||||
created_atoms = list()
|
||||
count = atoms.len
|
||||
for(var/I in atoms)
|
||||
var/atom/A = I
|
||||
if(!A.initialized)
|
||||
if(InitAtom(I, mapload_arg))
|
||||
atoms -= I
|
||||
CHECK_TICK
|
||||
else
|
||||
count = 0
|
||||
for(var/atom/A in world)
|
||||
if(!A.initialized)
|
||||
InitAtom(A, mapload_arg)
|
||||
++count
|
||||
CHECK_TICK
|
||||
|
||||
log_world("Initialized [count] atoms")
|
||||
|
||||
initialized = INITIALIZATION_INNEW_REGULAR
|
||||
|
||||
if(late_loaders.len)
|
||||
for(var/I in late_loaders)
|
||||
var/atom/A = I
|
||||
A.LateInitialize()
|
||||
testing("Late initialized [late_loaders.len] atoms")
|
||||
late_loaders.Cut()
|
||||
|
||||
if(atoms)
|
||||
. = created_atoms + atoms
|
||||
created_atoms = null
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitAtom(atom/A, list/arguments)
|
||||
var/the_type = A.type
|
||||
if(QDELING(A))
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_QDEL_BEFORE
|
||||
return TRUE
|
||||
|
||||
var/start_tick = world.time
|
||||
|
||||
var/result = A.Initialize(arglist(arguments))
|
||||
|
||||
if(start_tick != world.time)
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_SLEPT
|
||||
|
||||
var/qdeleted = FALSE
|
||||
|
||||
if(result != INITIALIZE_HINT_NORMAL)
|
||||
switch(result)
|
||||
if(INITIALIZE_HINT_LATELOAD)
|
||||
if(arguments[1]) //mapload
|
||||
late_loaders += A
|
||||
else
|
||||
A.LateInitialize()
|
||||
if(INITIALIZE_HINT_QDEL)
|
||||
qdel(A)
|
||||
qdeleted = TRUE
|
||||
else
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_NO_HINT
|
||||
|
||||
if(!A) //possible harddel
|
||||
qdeleted = TRUE
|
||||
else if(!A.initialized)
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT
|
||||
|
||||
return qdeleted || QDELETED(A)
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_begin()
|
||||
old_initialized = initialized
|
||||
initialized = INITIALIZATION_INSSATOMS
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_stop()
|
||||
initialized = old_initialized
|
||||
|
||||
/datum/controller/subsystem/atoms/Recover()
|
||||
initialized = SSatoms.initialized
|
||||
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
|
||||
InitializeAtoms()
|
||||
old_initialized = SSatoms.old_initialized
|
||||
BadInitializeCalls = SSatoms.BadInitializeCalls
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/setupGenetics()
|
||||
var/list/avnums = new /list(DNA_STRUC_ENZYMES_BLOCKS)
|
||||
for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++)
|
||||
avnums[i] = i
|
||||
CHECK_TICK
|
||||
|
||||
for(var/A in subtypesof(/datum/mutation/human))
|
||||
var/datum/mutation/human/B = new A()
|
||||
if(B.dna_block == NON_SCANNABLE)
|
||||
continue
|
||||
B.dna_block = pick_n_take(avnums)
|
||||
if(B.quality == POSITIVE)
|
||||
GLOB.good_mutations |= B
|
||||
else if(B.quality == NEGATIVE)
|
||||
GLOB.bad_mutations |= B
|
||||
else if(B.quality == MINOR_NEGATIVE)
|
||||
GLOB.not_good_mutations |= B
|
||||
CHECK_TICK
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitLog()
|
||||
. = ""
|
||||
for(var/path in BadInitializeCalls)
|
||||
. += "Path : [path] \n"
|
||||
var/fails = BadInitializeCalls[path]
|
||||
if(fails & BAD_INIT_DIDNT_INIT)
|
||||
. += "- Didn't call atom/Initialize()\n"
|
||||
if(fails & BAD_INIT_NO_HINT)
|
||||
. += "- Didn't return an Initialize hint\n"
|
||||
if(fails & BAD_INIT_QDEL_BEFORE)
|
||||
. += "- Qdel'd in New()\n"
|
||||
if(fails & BAD_INIT_SLEPT)
|
||||
. += "- Slept during Initialize()\n"
|
||||
|
||||
/datum/controller/subsystem/atoms/Shutdown()
|
||||
var/initlog = InitLog()
|
||||
if(initlog)
|
||||
log_world(initlog)
|
||||
|
||||
#undef BAD_INIT_QDEL_BEFORE
|
||||
#undef BAD_INIT_DIDNT_INIT
|
||||
#undef BAD_INIT_SLEPT
|
||||
#undef BAD_INIT_NO_HINT
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
SUBSYSTEM_DEF(blackbox)
|
||||
name = "Blackbox"
|
||||
wait = 6000
|
||||
flags = SS_NO_TICK_CHECK
|
||||
|
||||
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_service = list()
|
||||
var/list/msg_cargo = list()
|
||||
var/list/msg_other = list()
|
||||
|
||||
var/list/feedback = list() //list of datum/feedback_variable
|
||||
|
||||
//poll population
|
||||
/datum/controller/subsystem/blackbox/fire()
|
||||
if(!SSdbcore.Connect())
|
||||
return
|
||||
var/playercount = 0
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(M.client)
|
||||
playercount += 1
|
||||
var/admincount = GLOB.admins.len
|
||||
var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
query_record_playercount.Execute()
|
||||
|
||||
/datum/controller/subsystem/blackbox/Recover()
|
||||
msg_common = SSblackbox.msg_common
|
||||
msg_science = SSblackbox.msg_science
|
||||
msg_command = SSblackbox.msg_command
|
||||
msg_medical = SSblackbox.msg_medical
|
||||
msg_engineering = SSblackbox.msg_engineering
|
||||
msg_security = SSblackbox.msg_security
|
||||
msg_deathsquad = SSblackbox.msg_deathsquad
|
||||
msg_syndicate = SSblackbox.msg_syndicate
|
||||
msg_service = SSblackbox.msg_service
|
||||
msg_cargo = SSblackbox.msg_cargo
|
||||
msg_other = SSblackbox.msg_other
|
||||
|
||||
feedback = SSblackbox.feedback
|
||||
|
||||
//no touchie
|
||||
/datum/controller/subsystem/blackbox/can_vv_get(var_name)
|
||||
if(var_name == "feedback")
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/blackbox/vv_edit_var(var_name, var_value)
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/blackbox/Shutdown()
|
||||
var/pda_msg_amt = 0
|
||||
var/rc_msg_amt = 0
|
||||
|
||||
for (var/obj/machinery/message_server/MS in GLOB.message_servers)
|
||||
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
|
||||
|
||||
set_details("radio_usage","")
|
||||
|
||||
add_details("radio_usage","COM-[msg_common.len]")
|
||||
add_details("radio_usage","SCI-[msg_science.len]")
|
||||
add_details("radio_usage","HEA-[msg_command.len]")
|
||||
add_details("radio_usage","MED-[msg_medical.len]")
|
||||
add_details("radio_usage","ENG-[msg_engineering.len]")
|
||||
add_details("radio_usage","SEC-[msg_security.len]")
|
||||
add_details("radio_usage","DTH-[msg_deathsquad.len]")
|
||||
add_details("radio_usage","SYN-[msg_syndicate.len]")
|
||||
add_details("radio_usage","SRV-[msg_service.len]")
|
||||
add_details("radio_usage","CAR-[msg_cargo.len]")
|
||||
add_details("radio_usage","OTH-[msg_other.len]")
|
||||
add_details("radio_usage","PDA-[pda_msg_amt]")
|
||||
add_details("radio_usage","RC-[rc_msg_amt]")
|
||||
|
||||
set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
|
||||
|
||||
if (!SSdbcore.Connect())
|
||||
return
|
||||
|
||||
var/round_id
|
||||
|
||||
var/datum/DBQuery/query_feedback_max_id = SSdbcore.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||
if(!query_feedback_max_id.Execute())
|
||||
return
|
||||
while (query_feedback_max_id.NextRow())
|
||||
round_id = query_feedback_max_id.item[1]
|
||||
|
||||
if (!isnum(round_id))
|
||||
round_id = text2num(round_id)
|
||||
round_id++
|
||||
|
||||
var/sqlrowlist = ""
|
||||
|
||||
for (var/datum/feedback_variable/FV in feedback)
|
||||
if (sqlrowlist != "")
|
||||
sqlrowlist += ", " //a comma (,) at the start of the first row to insert will trigger a SQL error
|
||||
|
||||
sqlrowlist += "(null, Now(), [round_id], \"[sanitizeSQL(FV.get_variable())]\", [FV.get_value()], \"[sanitizeSQL(FV.get_details())]\")"
|
||||
|
||||
if (sqlrowlist == "")
|
||||
return
|
||||
|
||||
var/datum/DBQuery/query_feedback_save = SSdbcore.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||
query_feedback_save.Execute()
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/LogBroadcast(blackbox_msg, freq)
|
||||
switch(freq)
|
||||
if(1459)
|
||||
msg_common += blackbox_msg
|
||||
if(1351)
|
||||
msg_science += blackbox_msg
|
||||
if(1353)
|
||||
msg_command += blackbox_msg
|
||||
if(1355)
|
||||
msg_medical += blackbox_msg
|
||||
if(1357)
|
||||
msg_engineering += blackbox_msg
|
||||
if(1359)
|
||||
msg_security += blackbox_msg
|
||||
if(1441)
|
||||
msg_deathsquad += blackbox_msg
|
||||
if(1213)
|
||||
msg_syndicate += blackbox_msg
|
||||
if(1349)
|
||||
msg_service += blackbox_msg
|
||||
if(1347)
|
||||
msg_cargo += blackbox_msg
|
||||
else
|
||||
msg_other += blackbox_msg
|
||||
|
||||
/datum/controller/subsystem/blackbox/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/blackbox/proc/set_val(variable, value)
|
||||
var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
FV.set_value(value)
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/inc(variable, value)
|
||||
var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
FV.inc(value)
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/dec(variable,value)
|
||||
var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
FV.dec(value)
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/set_details(variable,details)
|
||||
var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
FV.set_details(details)
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/add_details(variable,details)
|
||||
var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
FV.add_details(details)
|
||||
|
||||
/datum/controller/subsystem/blackbox/proc/ReportDeath(mob/living/L)
|
||||
if(!SSdbcore.Connect())
|
||||
return
|
||||
if(!L || !L.key || !L.mind)
|
||||
return
|
||||
var/turf/T = get_turf(L)
|
||||
var/area/placeofdeath = get_area(T.loc)
|
||||
var/sqlname = sanitizeSQL(L.real_name)
|
||||
var/sqlkey = sanitizeSQL(L.ckey)
|
||||
var/sqljob = sanitizeSQL(L.mind.assigned_role)
|
||||
var/sqlspecial = sanitizeSQL(L.mind.special_role)
|
||||
var/sqlpod = sanitizeSQL(placeofdeath.name)
|
||||
var/laname
|
||||
var/lakey
|
||||
if(L.lastattacker && ismob(L.lastattacker))
|
||||
var/mob/LA = L.lastattacker
|
||||
laname = sanitizeSQL(LA.real_name)
|
||||
lakey = sanitizeSQL(LA.key)
|
||||
var/sqlgender = sanitizeSQL(L.gender)
|
||||
var/sqlbrute = sanitizeSQL(L.getBruteLoss())
|
||||
var/sqlfire = sanitizeSQL(L.getFireLoss())
|
||||
var/sqlbrain = sanitizeSQL(L.getBrainLoss())
|
||||
var/sqloxy = sanitizeSQL(L.getOxyLoss())
|
||||
var/sqltox = sanitizeSQL(L.getStaminaLoss())
|
||||
var/sqlclone = sanitizeSQL(L.getStaminaLoss())
|
||||
var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
||||
var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
||||
var/map = sanitizeSQL(SSmapping.config.map_name)
|
||||
var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
query_report_death.Execute()
|
||||
|
||||
|
||||
//feedback variable datum, for storing all kinds of data
|
||||
/datum/feedback_variable
|
||||
var/variable
|
||||
var/value
|
||||
var/details
|
||||
|
||||
/datum/feedback_variable/New(param_variable, param_value = 0)
|
||||
variable = param_variable
|
||||
value = param_value
|
||||
|
||||
/datum/feedback_variable/proc/inc(num = 1)
|
||||
if (isnum(value))
|
||||
value += num
|
||||
else
|
||||
value = text2num(value)
|
||||
if (isnum(value))
|
||||
value += num
|
||||
else
|
||||
value = num
|
||||
|
||||
/datum/feedback_variable/proc/dec(num = 1)
|
||||
if (isnum(value))
|
||||
value -= num
|
||||
else
|
||||
value = text2num(value)
|
||||
if (isnum(value))
|
||||
value -= num
|
||||
else
|
||||
value = -num
|
||||
|
||||
/datum/feedback_variable/proc/set_value(num)
|
||||
if (isnum(num))
|
||||
value = num
|
||||
|
||||
/datum/feedback_variable/proc/get_value()
|
||||
if (!isnum(value))
|
||||
return 0
|
||||
return value
|
||||
|
||||
/datum/feedback_variable/proc/get_variable()
|
||||
return variable
|
||||
|
||||
/datum/feedback_variable/proc/set_details(text)
|
||||
if (istext(text))
|
||||
details = text
|
||||
|
||||
/datum/feedback_variable/proc/add_details(text)
|
||||
if (istext(text))
|
||||
text = replacetext(text, " ", "_")
|
||||
if (!details)
|
||||
details = text
|
||||
else
|
||||
details += " [text]"
|
||||
|
||||
/datum/feedback_variable/proc/get_details()
|
||||
return details
|
||||
|
||||
/datum/feedback_variable/proc/get_parsed()
|
||||
return list(variable,value,details)
|
||||
@@ -0,0 +1,512 @@
|
||||
diff a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm (rejected hunks)
|
||||
@@ -1,253 +1,257 @@
|
||||
-GLOBAL_DATUM_INIT(blackbox, /datum/feedback, new)
|
||||
-
|
||||
-//the feedback datum; stores all feedback
|
||||
-/datum/feedback
|
||||
- var/list/messages = list()
|
||||
- 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_service = list()
|
||||
- var/list/msg_cargo = list()
|
||||
-
|
||||
- var/list/datum/feedback_variable/feedback = new()
|
||||
-
|
||||
-/datum/feedback/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/feedback/proc/get_round_feedback()
|
||||
- return feedback
|
||||
-
|
||||
-/datum/feedback/proc/round_end_data_gathering()
|
||||
- var/pda_msg_amt = 0
|
||||
- var/rc_msg_amt = 0
|
||||
-
|
||||
- for (var/obj/machinery/message_server/MS in GLOB.message_servers)
|
||||
- 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","SRV-[msg_service.len]")
|
||||
- feedback_add_details("radio_usage","CAR-[msg_cargo.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.
|
||||
-
|
||||
-//This proc is only to be called at round end.
|
||||
-/datum/feedback/proc/save_all_data_to_sql()
|
||||
- if (!feedback) return
|
||||
-
|
||||
- round_end_data_gathering() //round_end time logging and some other data processing
|
||||
- if (!GLOB.dbcon.Connect()) return
|
||||
- var/round_id
|
||||
-
|
||||
- var/DBQuery/query_feedback_max_id = GLOB.dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||
- if(!query_feedback_max_id.Execute())
|
||||
- return
|
||||
- while (query_feedback_max_id.NextRow())
|
||||
- round_id = query_feedback_max_id.item[1]
|
||||
-
|
||||
- if (!isnum(round_id))
|
||||
- round_id = text2num(round_id)
|
||||
- round_id++
|
||||
-
|
||||
- var/sqlrowlist = ""
|
||||
-
|
||||
- for (var/datum/feedback_variable/FV in feedback)
|
||||
- if (sqlrowlist != "")
|
||||
- sqlrowlist += ", " //a comma (,) at the start of the first row to insert will trigger a SQL error
|
||||
-
|
||||
- sqlrowlist += "(null, Now(), [round_id], \"[sanitizeSQL(FV.get_variable())]\", [FV.get_value()], \"[sanitizeSQL(FV.get_details())]\")"
|
||||
-
|
||||
- if (sqlrowlist == "")
|
||||
- return
|
||||
-
|
||||
- var/DBQuery/query_feedback_save = GLOB.dbcon.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||
- query_feedback_save.Execute()
|
||||
-
|
||||
-
|
||||
-/proc/feedback_set(variable,value)
|
||||
- if(!GLOB.blackbox)
|
||||
- return
|
||||
-
|
||||
- var/datum/feedback_variable/FV = GLOB.blackbox.find_feedback_datum(variable)
|
||||
-
|
||||
- if(!FV)
|
||||
- return
|
||||
-
|
||||
- FV.set_value(value)
|
||||
-
|
||||
-/proc/feedback_inc(variable,value)
|
||||
- if(!GLOB.blackbox)
|
||||
- return
|
||||
-
|
||||
- var/datum/feedback_variable/FV = GLOB.blackbox.find_feedback_datum(variable)
|
||||
-
|
||||
- if(!FV)
|
||||
- return
|
||||
-
|
||||
- FV.inc(value)
|
||||
-
|
||||
-/proc/feedback_dec(variable,value)
|
||||
- if(!GLOB.blackbox)
|
||||
- return
|
||||
-
|
||||
- var/datum/feedback_variable/FV = GLOB.blackbox.find_feedback_datum(variable)
|
||||
-
|
||||
- if(!FV)
|
||||
- return
|
||||
-
|
||||
- FV.dec(value)
|
||||
-
|
||||
-/proc/feedback_set_details(variable,details)
|
||||
- if(!GLOB.blackbox)
|
||||
- return
|
||||
-
|
||||
- var/datum/feedback_variable/FV = GLOB.blackbox.find_feedback_datum(variable)
|
||||
-
|
||||
- if(!FV)
|
||||
- return
|
||||
-
|
||||
- FV.set_details(details)
|
||||
-
|
||||
-/proc/feedback_add_details(variable,details)
|
||||
- if(!GLOB.blackbox)
|
||||
- return
|
||||
-
|
||||
- var/datum/feedback_variable/FV = GLOB.blackbox.find_feedback_datum(variable)
|
||||
-
|
||||
- if(!FV)
|
||||
- return
|
||||
-
|
||||
- FV.add_details(details)
|
||||
-
|
||||
-//feedback variable datum, for storing all kinds of data
|
||||
-/datum/feedback_variable
|
||||
- var/variable
|
||||
- var/value
|
||||
- var/details
|
||||
-
|
||||
-/datum/feedback_variable/New(var/param_variable,var/param_value = 0)
|
||||
- variable = param_variable
|
||||
- value = param_value
|
||||
-
|
||||
-/datum/feedback_variable/proc/inc(num = 1)
|
||||
- if (isnum(value))
|
||||
- value += num
|
||||
- else
|
||||
- value = text2num(value)
|
||||
- if (isnum(value))
|
||||
- value += num
|
||||
- else
|
||||
- value = num
|
||||
-
|
||||
-/datum/feedback_variable/proc/dec(num = 1)
|
||||
- if (isnum(value))
|
||||
- value -= num
|
||||
- else
|
||||
- value = text2num(value)
|
||||
- if (isnum(value))
|
||||
- value -= num
|
||||
- else
|
||||
- value = -num
|
||||
-
|
||||
-/datum/feedback_variable/proc/set_value(num)
|
||||
- if (isnum(num))
|
||||
- value = num
|
||||
-
|
||||
-/datum/feedback_variable/proc/get_value()
|
||||
- if (!isnum(value))
|
||||
- return 0
|
||||
- return value
|
||||
-
|
||||
-/datum/feedback_variable/proc/get_variable()
|
||||
- return variable
|
||||
-
|
||||
-/datum/feedback_variable/proc/set_details(text)
|
||||
- if (istext(text))
|
||||
- details = text
|
||||
-
|
||||
-/datum/feedback_variable/proc/add_details(text)
|
||||
- if (istext(text))
|
||||
- text = replacetext(text, " ", "_")
|
||||
- if (!details)
|
||||
- details = text
|
||||
- else
|
||||
- details += " [text]"
|
||||
-
|
||||
-/datum/feedback_variable/proc/get_details()
|
||||
- return details
|
||||
-
|
||||
-/datum/feedback_variable/proc/get_parsed()
|
||||
- return list(variable,value,details)
|
||||
-
|
||||
-//sql reporting procs
|
||||
-/proc/sql_poll_population()
|
||||
- if(!config.sql_enabled)
|
||||
- return
|
||||
- if(!GLOB.dbcon.Connect())
|
||||
- return
|
||||
- var/playercount = 0
|
||||
- for(var/mob/M in GLOB.player_list)
|
||||
- if(M.client)
|
||||
- playercount += 1
|
||||
- var/admincount = GLOB.admins.len
|
||||
- var/DBQuery/query_record_playercount = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
- query_record_playercount.Execute()
|
||||
-
|
||||
-/proc/sql_report_death(mob/living/L)
|
||||
- if(!config.sql_enabled)
|
||||
- return
|
||||
- if(!GLOB.dbcon.Connect())
|
||||
- return
|
||||
- if(!L || !L.key || !L.mind)
|
||||
- return
|
||||
- var/turf/T = get_turf(L)
|
||||
- var/area/placeofdeath = get_area(T.loc)
|
||||
- var/sqlname = sanitizeSQL(L.real_name)
|
||||
- var/sqlkey = sanitizeSQL(L.ckey)
|
||||
- var/sqljob = sanitizeSQL(L.mind.assigned_role)
|
||||
- var/sqlspecial = sanitizeSQL(L.mind.special_role)
|
||||
- var/sqlpod = sanitizeSQL(placeofdeath.name)
|
||||
- var/laname
|
||||
- var/lakey
|
||||
- if(L.lastattacker && ismob(L.lastattacker))
|
||||
- var/mob/LA = L.lastattacker
|
||||
- laname = sanitizeSQL(LA.real_name)
|
||||
- lakey = sanitizeSQL(LA.key)
|
||||
- var/sqlgender = sanitizeSQL(L.gender)
|
||||
- var/sqlbrute = sanitizeSQL(L.getBruteLoss())
|
||||
- var/sqlfire = sanitizeSQL(L.getFireLoss())
|
||||
- var/sqlbrain = sanitizeSQL(L.getBrainLoss())
|
||||
- var/sqloxy = sanitizeSQL(L.getOxyLoss())
|
||||
- var/sqltox = sanitizeSQL(L.getStaminaLoss())
|
||||
- var/sqlclone = sanitizeSQL(L.getStaminaLoss())
|
||||
- var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
||||
- var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
||||
- var/map = sanitizeSQL(SSmapping.config.map_name)
|
||||
- var/DBQuery/query_report_death = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
- query_report_death.Execute()
|
||||
+SUBSYSTEM_DEF(blackbox)
|
||||
+ name = "Blackbox"
|
||||
+ wait = 6000
|
||||
+ flags = SS_NO_TICK_CHECK
|
||||
+
|
||||
+ 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_service = list()
|
||||
+ var/list/msg_cargo = list()
|
||||
+ var/list/msg_other = list()
|
||||
+
|
||||
+ var/list/feedback = list() //list of datum/feedback_variable
|
||||
+
|
||||
+//poll population
|
||||
+/datum/controller/subsystem/blackbox/fire()
|
||||
+ if(!GLOB.dbcon.Connect())
|
||||
+ return
|
||||
+ var/playercount = 0
|
||||
+ for(var/mob/M in GLOB.player_list)
|
||||
+ if(M.client)
|
||||
+ playercount += 1
|
||||
+ var/admincount = GLOB.admins.len
|
||||
+ var/DBQuery/query_record_playercount = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
+ query_record_playercount.Execute()
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/Recover()
|
||||
+ msg_common = SSblackbox.msg_common
|
||||
+ msg_science = SSblackbox.msg_science
|
||||
+ msg_command = SSblackbox.msg_command
|
||||
+ msg_medical = SSblackbox.msg_medical
|
||||
+ msg_engineering = SSblackbox.msg_engineering
|
||||
+ msg_security = SSblackbox.msg_security
|
||||
+ msg_deathsquad = SSblackbox.msg_deathsquad
|
||||
+ msg_syndicate = SSblackbox.msg_syndicate
|
||||
+ msg_service = SSblackbox.msg_service
|
||||
+ msg_cargo = SSblackbox.msg_cargo
|
||||
+ msg_other = SSblackbox.msg_other
|
||||
+
|
||||
+ feedback = SSblackbox.feedback
|
||||
+
|
||||
+//no touchie
|
||||
+/datum/controller/subsystem/blackbox/can_vv_get(var_name)
|
||||
+ if(var_name == "feedback")
|
||||
+ return FALSE
|
||||
+ return ..()
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/vv_edit_var(var_name, var_value)
|
||||
+ return FALSE
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/Shutdown()
|
||||
+ var/pda_msg_amt = 0
|
||||
+ var/rc_msg_amt = 0
|
||||
+
|
||||
+ for (var/obj/machinery/message_server/MS in GLOB.message_servers)
|
||||
+ 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
|
||||
+
|
||||
+ set_details("radio_usage","")
|
||||
+
|
||||
+ add_details("radio_usage","COM-[msg_common.len]")
|
||||
+ add_details("radio_usage","SCI-[msg_science.len]")
|
||||
+ add_details("radio_usage","HEA-[msg_command.len]")
|
||||
+ add_details("radio_usage","MED-[msg_medical.len]")
|
||||
+ add_details("radio_usage","ENG-[msg_engineering.len]")
|
||||
+ add_details("radio_usage","SEC-[msg_security.len]")
|
||||
+ add_details("radio_usage","DTH-[msg_deathsquad.len]")
|
||||
+ add_details("radio_usage","SYN-[msg_syndicate.len]")
|
||||
+ add_details("radio_usage","SRV-[msg_service.len]")
|
||||
+ add_details("radio_usage","CAR-[msg_cargo.len]")
|
||||
+ add_details("radio_usage","OTH-[msg_other.len]")
|
||||
+ add_details("radio_usage","PDA-[pda_msg_amt]")
|
||||
+ add_details("radio_usage","RC-[rc_msg_amt]")
|
||||
+
|
||||
+ set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
|
||||
+
|
||||
+ if (!GLOB.dbcon.Connect())
|
||||
+ return
|
||||
+
|
||||
+ var/round_id
|
||||
+
|
||||
+ var/DBQuery/query_feedback_max_id = GLOB.dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||
+ if(!query_feedback_max_id.Execute())
|
||||
+ return
|
||||
+ while (query_feedback_max_id.NextRow())
|
||||
+ round_id = query_feedback_max_id.item[1]
|
||||
+
|
||||
+ if (!isnum(round_id))
|
||||
+ round_id = text2num(round_id)
|
||||
+ round_id++
|
||||
+
|
||||
+ var/sqlrowlist = ""
|
||||
+
|
||||
+ for (var/datum/feedback_variable/FV in feedback)
|
||||
+ if (sqlrowlist != "")
|
||||
+ sqlrowlist += ", " //a comma (,) at the start of the first row to insert will trigger a SQL error
|
||||
+
|
||||
+ sqlrowlist += "(null, Now(), [round_id], \"[sanitizeSQL(FV.get_variable())]\", [FV.get_value()], \"[sanitizeSQL(FV.get_details())]\")"
|
||||
+
|
||||
+ if (sqlrowlist == "")
|
||||
+ return
|
||||
+
|
||||
+ var/DBQuery/query_feedback_save = GLOB.dbcon.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||
+ query_feedback_save.Execute()
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/LogBroadcast(blackbox_msg, freq)
|
||||
+ switch(freq)
|
||||
+ if(1459)
|
||||
+ msg_common += blackbox_msg
|
||||
+ if(1351)
|
||||
+ msg_science += blackbox_msg
|
||||
+ if(1353)
|
||||
+ msg_command += blackbox_msg
|
||||
+ if(1355)
|
||||
+ msg_medical += blackbox_msg
|
||||
+ if(1357)
|
||||
+ msg_engineering += blackbox_msg
|
||||
+ if(1359)
|
||||
+ msg_security += blackbox_msg
|
||||
+ if(1441)
|
||||
+ msg_deathsquad += blackbox_msg
|
||||
+ if(1213)
|
||||
+ msg_syndicate += blackbox_msg
|
||||
+ if(1349)
|
||||
+ msg_service += blackbox_msg
|
||||
+ if(1347)
|
||||
+ msg_cargo += blackbox_msg
|
||||
+ else
|
||||
+ msg_other += blackbox_msg
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/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/blackbox/proc/set_val(variable, value)
|
||||
+ var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
+ FV.set_value(value)
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/inc(variable, value)
|
||||
+ var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
+ FV.inc(value)
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/dec(variable,value)
|
||||
+ var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
+ FV.dec(value)
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/set_details(variable,details)
|
||||
+ var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
+ FV.set_details(details)
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/add_details(variable,details)
|
||||
+ var/datum/feedback_variable/FV = find_feedback_datum(variable)
|
||||
+ FV.add_details(details)
|
||||
+
|
||||
+/datum/controller/subsystem/blackbox/proc/ReportDeath(mob/living/L)
|
||||
+ if(!GLOB.dbcon.Connect())
|
||||
+ return
|
||||
+ if(!L || !L.key || !L.mind)
|
||||
+ return
|
||||
+ var/turf/T = get_turf(L)
|
||||
+ var/area/placeofdeath = get_area(T.loc)
|
||||
+ var/sqlname = sanitizeSQL(L.real_name)
|
||||
+ var/sqlkey = sanitizeSQL(L.ckey)
|
||||
+ var/sqljob = sanitizeSQL(L.mind.assigned_role)
|
||||
+ var/sqlspecial = sanitizeSQL(L.mind.special_role)
|
||||
+ var/sqlpod = sanitizeSQL(placeofdeath.name)
|
||||
+ var/laname
|
||||
+ var/lakey
|
||||
+ if(L.lastattacker && ismob(L.lastattacker))
|
||||
+ var/mob/LA = L.lastattacker
|
||||
+ laname = sanitizeSQL(LA.real_name)
|
||||
+ lakey = sanitizeSQL(LA.key)
|
||||
+ var/sqlgender = sanitizeSQL(L.gender)
|
||||
+ var/sqlbrute = sanitizeSQL(L.getBruteLoss())
|
||||
+ var/sqlfire = sanitizeSQL(L.getFireLoss())
|
||||
+ var/sqlbrain = sanitizeSQL(L.getBrainLoss())
|
||||
+ var/sqloxy = sanitizeSQL(L.getOxyLoss())
|
||||
+ var/sqltox = sanitizeSQL(L.getStaminaLoss())
|
||||
+ var/sqlclone = sanitizeSQL(L.getStaminaLoss())
|
||||
+ var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
||||
+ var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
||||
+ var/map = sanitizeSQL(SSmapping.config.map_name)
|
||||
+ var/DBQuery/query_report_death = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
+ query_report_death.Execute()
|
||||
+
|
||||
+
|
||||
+//feedback variable datum, for storing all kinds of data
|
||||
+/datum/feedback_variable
|
||||
+ var/variable
|
||||
+ var/value
|
||||
+ var/details
|
||||
+
|
||||
+/datum/feedback_variable/New(param_variable, param_value = 0)
|
||||
+ variable = param_variable
|
||||
+ value = param_value
|
||||
+
|
||||
+/datum/feedback_variable/proc/inc(num = 1)
|
||||
+ if (isnum(value))
|
||||
+ value += num
|
||||
+ else
|
||||
+ value = text2num(value)
|
||||
+ if (isnum(value))
|
||||
+ value += num
|
||||
+ else
|
||||
+ value = num
|
||||
+
|
||||
+/datum/feedback_variable/proc/dec(num = 1)
|
||||
+ if (isnum(value))
|
||||
+ value -= num
|
||||
+ else
|
||||
+ value = text2num(value)
|
||||
+ if (isnum(value))
|
||||
+ value -= num
|
||||
+ else
|
||||
+ value = -num
|
||||
+
|
||||
+/datum/feedback_variable/proc/set_value(num)
|
||||
+ if (isnum(num))
|
||||
+ value = num
|
||||
+
|
||||
+/datum/feedback_variable/proc/get_value()
|
||||
+ if (!isnum(value))
|
||||
+ return 0
|
||||
+ return value
|
||||
+
|
||||
+/datum/feedback_variable/proc/get_variable()
|
||||
+ return variable
|
||||
+
|
||||
+/datum/feedback_variable/proc/set_details(text)
|
||||
+ if (istext(text))
|
||||
+ details = text
|
||||
+
|
||||
+/datum/feedback_variable/proc/add_details(text)
|
||||
+ if (istext(text))
|
||||
+ text = replacetext(text, " ", "_")
|
||||
+ if (!details)
|
||||
+ details = text
|
||||
+ else
|
||||
+ details += " [text]"
|
||||
+
|
||||
+/datum/feedback_variable/proc/get_details()
|
||||
+ return details
|
||||
+
|
||||
+/datum/feedback_variable/proc/get_parsed()
|
||||
+ return list(variable,value,details)
|
||||
@@ -66,6 +66,9 @@ SUBSYSTEM_DEF(garbage)
|
||||
HandleToBeQueued()
|
||||
if(state == SS_RUNNING)
|
||||
HandleQueue()
|
||||
|
||||
if (state == SS_PAUSED) //make us wait again before the next run.
|
||||
state = SS_RUNNING
|
||||
|
||||
//If you see this proc high on the profile, what you are really seeing is the garbage collection/soft delete overhead in byond.
|
||||
//Don't attempt to optimize, not worth the effort.
|
||||
@@ -110,24 +113,9 @@ SUBSYSTEM_DEF(garbage)
|
||||
var/type = A.type
|
||||
testing("GC: -- \ref[A] | [type] was unable to be GC'd and was deleted --")
|
||||
didntgc["[type]"]++
|
||||
var/time = world.timeofday
|
||||
var/tick = world.tick_usage
|
||||
var/ticktime = world.time
|
||||
|
||||
HardDelete(A)
|
||||
tick = (world.tick_usage-tick+((world.time-ticktime)/world.tick_lag*100))
|
||||
|
||||
if (tick > highest_del_tickusage)
|
||||
highest_del_tickusage = tick
|
||||
time = world.timeofday - time
|
||||
if (!time && TICK_DELTA_TO_MS(tick) > 1)
|
||||
time = TICK_DELTA_TO_MS(tick)/100
|
||||
if (time > highest_del_time)
|
||||
highest_del_time = time
|
||||
if (time > 10)
|
||||
log_game("Error: [type]([refID]) took longer then 1 second to delete (took [time/10] seconds to delete)")
|
||||
message_admins("Error: [type]([refID]) took longer then 1 second to delete (took [time/10] seconds to delete).")
|
||||
postpone(time/5)
|
||||
break
|
||||
++delslasttick
|
||||
++totaldels
|
||||
else
|
||||
@@ -157,8 +145,28 @@ SUBSYSTEM_DEF(garbage)
|
||||
|
||||
//this is purely to seperate things profile wise.
|
||||
/datum/controller/subsystem/garbage/proc/HardDelete(datum/A)
|
||||
var/time = world.timeofday
|
||||
var/tick = world.tick_usage
|
||||
var/ticktime = world.time
|
||||
|
||||
var/type = A.type
|
||||
var/refID = "\ref[A]"
|
||||
|
||||
del(A)
|
||||
|
||||
|
||||
tick = (world.tick_usage-tick+((world.time-ticktime)/world.tick_lag*100))
|
||||
if (tick > highest_del_tickusage)
|
||||
highest_del_tickusage = tick
|
||||
time = world.timeofday - time
|
||||
if (!time && TICK_DELTA_TO_MS(tick) > 1)
|
||||
time = TICK_DELTA_TO_MS(tick)/100
|
||||
if (time > highest_del_time)
|
||||
highest_del_time = time
|
||||
if (time > 10)
|
||||
log_game("Error: [type]([refID]) took longer then 1 second to delete (took [time/10] seconds to delete)")
|
||||
message_admins("Error: [type]([refID]) took longer then 1 second to delete (took [time/10] seconds to delete).")
|
||||
postpone(time/5)
|
||||
|
||||
/datum/controller/subsystem/garbage/proc/HardQueue(datum/A)
|
||||
if (istype(A) && A.gc_destroyed == GC_CURRENTLY_BEING_QDELETED)
|
||||
tobequeued += A
|
||||
@@ -211,7 +219,7 @@ SUBSYSTEM_DEF(garbage)
|
||||
if (QDEL_HINT_HARDDEL) //qdel should assume this object won't gc, and queue a hard delete using a hard reference to save time from the locate()
|
||||
SSgarbage.HardQueue(D)
|
||||
if (QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste.
|
||||
del(D)
|
||||
SSgarbage.HardDelete(D)
|
||||
if (QDEL_HINT_FINDREFERENCE)//qdel will, if TESTING is enabled, display all references to this object, then queue the object for deletion.
|
||||
SSgarbage.QueueForQueuing(D)
|
||||
#ifdef TESTING
|
||||
|
||||
@@ -483,7 +483,7 @@ SUBSYSTEM_DEF(job)
|
||||
else level4++ //not selected
|
||||
|
||||
tmp_str += "HIGH=[level1]|MEDIUM=[level2]|LOW=[level3]|NEVER=[level4]|BANNED=[level5]|YOUNG=[level6]|-"
|
||||
feedback_add_details("job_preferences",tmp_str)
|
||||
SSblackbox.add_details("job_preferences",tmp_str)
|
||||
|
||||
/datum/controller/subsystem/job/proc/PopcapReached()
|
||||
if(config.hard_popcap || config.extreme_popcap)
|
||||
|
||||
@@ -18,6 +18,8 @@ SUBSYSTEM_DEF(mapping)
|
||||
var/list/shuttle_templates = list()
|
||||
var/list/shelter_templates = list()
|
||||
|
||||
var/loading_ruins = FALSE
|
||||
|
||||
/datum/controller/subsystem/mapping/PreInit()
|
||||
if(!config)
|
||||
#ifdef FORCE_MAP
|
||||
@@ -32,13 +34,13 @@ SUBSYSTEM_DEF(mapping)
|
||||
if(config.defaulted)
|
||||
to_chat(world, "<span class='boldannounce'>Unable to load next map config, defaulting to Box Station</span>")
|
||||
loadWorld()
|
||||
SortAreas()
|
||||
repopulate_sorted_areas()
|
||||
process_teleport_locs() //Sets up the wizard teleport locations
|
||||
preloadTemplates()
|
||||
// Pick a random away mission.
|
||||
createRandomZlevel()
|
||||
// Generate mining.
|
||||
|
||||
loading_ruins = TRUE
|
||||
var/mining_type = config.minetype
|
||||
if (mining_type == "lavaland")
|
||||
seedRuins(list(5), global.config.lavaland_budget, /area/lavaland/surface/outdoors, lava_ruins_templates)
|
||||
@@ -54,7 +56,8 @@ SUBSYSTEM_DEF(mapping)
|
||||
space_zlevels += i
|
||||
|
||||
seedRuins(space_zlevels, global.config.space_budget, /area/space, space_ruins_templates)
|
||||
|
||||
loading_ruins = FALSE
|
||||
repopulate_sorted_areas()
|
||||
// Set up Z-level transistions.
|
||||
setup_map_transitions()
|
||||
..()
|
||||
@@ -116,7 +119,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
INIT_ANNOUNCE("Loading [config.map_name]...")
|
||||
TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION)
|
||||
INIT_ANNOUNCE("Loaded station in [(REALTIMEOFDAY - start_time)/10]s!")
|
||||
feedback_add_details("map_name", config.map_name)
|
||||
SSblackbox.add_details("map_name", config.map_name)
|
||||
|
||||
if(config.minetype != "lavaland")
|
||||
INIT_ANNOUNCE("WARNING: A map without lavaland set as it's minetype was loaded! This is being ignored! Update the maploader code!")
|
||||
@@ -144,31 +147,35 @@ SUBSYSTEM_DEF(mapping)
|
||||
mapvotes[global.config.defaultmap.map_name] += 1
|
||||
continue
|
||||
mapvotes[vote] += 1
|
||||
else
|
||||
for(var/M in global.config.maplist)
|
||||
mapvotes[M] = 1
|
||||
|
||||
//filter votes
|
||||
for (var/map in mapvotes)
|
||||
if (!map)
|
||||
mapvotes.Remove(map)
|
||||
if (!(map in global.config.maplist))
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
var/datum/map_config/VM = global.config.maplist[map]
|
||||
if (!VM)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.voteweight <= 0)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.config_min_users > 0 && players < VM.config_min_users)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.config_max_users > 0 && players > VM.config_max_users)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
//filter votes
|
||||
for (var/map in mapvotes)
|
||||
if (!map)
|
||||
mapvotes.Remove(map)
|
||||
if (!(map in global.config.maplist))
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
var/datum/map_config/VM = global.config.maplist[map]
|
||||
if (!VM)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.voteweight <= 0)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.config_min_users > 0 && players < VM.config_min_users)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
if (VM.config_max_users > 0 && players > VM.config_max_users)
|
||||
mapvotes.Remove(map)
|
||||
continue
|
||||
|
||||
if(global.config.allow_map_voting)
|
||||
mapvotes[map] = mapvotes[map]*VM.voteweight
|
||||
|
||||
var/pickedmap = global.config.allow_map_voting ? pickweight(mapvotes) : pick(global.config.maplist)
|
||||
var/pickedmap = pickweight(mapvotes)
|
||||
if (!pickedmap)
|
||||
return
|
||||
var/datum/map_config/VM = global.config.maplist[pickedmap]
|
||||
|
||||
@@ -19,7 +19,7 @@ SUBSYSTEM_DEF(npcpool)
|
||||
/datum/controller/subsystem/npcpool/stat_entry()
|
||||
..("NPCS:[processing.len]|D:[needsDelegate.len]|A:[needsAssistant.len]|U:[canBeUsed.len]")
|
||||
|
||||
/datum/controller/subsystem/npcpool/proc/stop_processing(mob/living/carbon/human/interactive/I)
|
||||
/datum/controller/subsystem/npcpool/proc/stop_processing(mob/living/I)
|
||||
processing -= I
|
||||
currentrun -= I
|
||||
needsDelegate -= I
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
SUBSYSTEM_DEF(ping)
|
||||
name = "Ping"
|
||||
wait = 6
|
||||
flags = SS_NO_INIT|SS_POST_FIRE_TIMING|SS_FIRE_IN_LOBBY
|
||||
flags = SS_POST_FIRE_TIMING|SS_FIRE_IN_LOBBY
|
||||
priority = 10
|
||||
var/list/currentrun
|
||||
|
||||
/datum/controller/subsystem/ping/Initialize()
|
||||
if (config.hub)
|
||||
world.visibility = 1
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/ping/fire(resumed = FALSE)
|
||||
if (!resumed)
|
||||
src.currentrun = GLOB.clients.Copy()
|
||||
|
||||
var/round_started = Master.round_started
|
||||
var/list/currentrun = src.currentrun
|
||||
while (length(currentrun))
|
||||
var/client/C = currentrun[currentrun.len]
|
||||
@@ -19,7 +25,15 @@ SUBSYSTEM_DEF(ping)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
continue
|
||||
|
||||
if(round_started && C.is_afk(INACTIVITY_KICK))
|
||||
if(!istype(C.mob, /mob/dead))
|
||||
log_access("AFK: [key_name(C)]")
|
||||
to_chat(C, "<span class='danger'>You have been inactive for more than 10 minutes and have been disconnected.</span>")
|
||||
qdel(C)
|
||||
|
||||
winset(C, null, "command=.update_ping+[world.time+world.tick_lag*world.tick_usage/100]")
|
||||
|
||||
if (MC_TICK_CHECK) //one day, when ss13 has 1000 people per server, you guys are gonna be glad I added this tick check
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
diff a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm (rejected hunks)
|
||||
@@ -18,5 +18,3 @@ SUBSYSTEM_DEF(server_maint)
|
||||
to_chat(C, "<span class='danger'>You have been inactive for more than 10 minutes and have been disconnected.</span>")
|
||||
qdel(C)
|
||||
|
||||
- if(config.sql_enabled)
|
||||
- sql_poll_population()
|
||||
@@ -210,12 +210,10 @@ SUBSYSTEM_DEF(shuttle)
|
||||
var/emergency_reason = "\nNature of emergency:\n\n[call_reason]"
|
||||
var/security_num = seclevel2num(get_security_level())
|
||||
switch(security_num)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
emergency.request(null, 2, signal_origin, html_decode(emergency_reason), 0)
|
||||
if(SEC_LEVEL_BLUE)
|
||||
emergency.request(null, 1, signal_origin, html_decode(emergency_reason), 0)
|
||||
if(SEC_LEVEL_RED,SEC_LEVEL_DELTA)
|
||||
emergency.request(null, signal_origin, html_decode(emergency_reason), 1) //There is a serious threat we gotta move no time to give them five minutes.
|
||||
else
|
||||
emergency.request(null, 0.5, signal_origin, html_decode(emergency_reason), 1) // There is a serious threat we gotta move no time to give them five minutes.
|
||||
emergency.request(null, signal_origin, html_decode(emergency_reason), 0)
|
||||
|
||||
log_game("[key_name(user)] has called the shuttle.")
|
||||
message_admins("[key_name_admin(user)] has called the shuttle.")
|
||||
@@ -274,7 +272,7 @@ SUBSYSTEM_DEF(shuttle)
|
||||
|
||||
if(callShuttle)
|
||||
if(EMERGENCY_IDLE_OR_RECALLED)
|
||||
emergency.request(null, 2.5)
|
||||
emergency.request(null, set_coefficient = 2.5)
|
||||
log_game("There is no means of calling the shuttle anymore. Shuttle automatically called.")
|
||||
message_admins("All the communications consoles were destroyed and all AIs are inactive. Shuttle called.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user