Tg port 2 15 (#230)
* defines/helpers * globalvars, onclick, controllers * datums and game * woooooooooorld. Uh. dm * modules sans mobs client admin * modules/admin * pref shit * modules/mob * icon updates * extra things * Cherrypicked fixes from open PRs * metastation.tgm fix * a better meta fix * reverts async breakings
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
var/log_hrefs = 0 // log all links clicked in-game. Could be used for debugging and tracking down exploits
|
||||
var/log_twitter = 0 // log certain expliotable parrots and other such fun things in a JSON file of twitter valid phrases.
|
||||
var/log_world_topic = 0 // log all world.Topic() calls
|
||||
var/log_runtimes = FALSE // log runtimes into a file
|
||||
var/sql_enabled = 0 // for sql switching
|
||||
var/allow_admin_ooccolor = 0 // Allows admins with relevant permissions to have their own ooc colour
|
||||
var/allow_vote_restart = 0 // allow votes to restart
|
||||
@@ -92,14 +93,6 @@
|
||||
var/ipintel_save_bad = 1
|
||||
var/ipintel_domain = "check.getipintel.net"
|
||||
|
||||
var/mentors_mobname_only = 0 // Only display mob name to mentors in mentorhelps
|
||||
var/mentor_legacy_system = 0 // Whether to use the legacy mentor system (flat file) instead of SQL
|
||||
// Discord crap.
|
||||
var/discord_url = "hfdksjhfa.com"
|
||||
var/discord_password
|
||||
var/announce_watchlist = 0
|
||||
var/announce_adminhelps = 0
|
||||
|
||||
var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
|
||||
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
|
||||
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
|
||||
@@ -249,6 +242,20 @@
|
||||
var/minutetopiclimit
|
||||
var/secondtopiclimit
|
||||
|
||||
var/error_cooldown = 600 // The "cooldown" time for each occurrence of a unique error
|
||||
var/error_limit = 50 // How many occurrences before the next will silence them
|
||||
var/error_silence_time = 6000 // How long a unique error will be silenced for
|
||||
var/error_msg_delay = 50 // How long to wait between messaging admins about occurrences of a unique error
|
||||
|
||||
var/mentors_mobname_only = 0 // Only display mob name to mentors in mentorhelps
|
||||
var/mentor_legacy_system = 0 // Whether to use the legacy mentor system (flat file) instead of SQL
|
||||
// Discord crap.
|
||||
var/discord_url = "hfdksjhfa.com"
|
||||
var/discord_password
|
||||
var/announce_watchlist = 0
|
||||
var/announce_adminhelps = 0
|
||||
|
||||
|
||||
/datum/configuration/New()
|
||||
gamemode_cache = typecacheof(/datum/game_mode,TRUE)
|
||||
for(var/T in gamemode_cache)
|
||||
@@ -467,10 +474,11 @@
|
||||
if("aggressive_changelog")
|
||||
config.aggressive_changelog = 1
|
||||
if("log_runtimes")
|
||||
log_runtimes = TRUE
|
||||
var/newlog = file("data/logs/runtimes/runtime-[time2text(world.realtime, "YYYY-MM-DD")].log")
|
||||
if (world.log != newlog)
|
||||
if(runtime_diary != newlog)
|
||||
world.log << "Now logging runtimes to data/logs/runtimes/runtime-[time2text(world.realtime, "YYYY-MM-DD")].log"
|
||||
world.log = newlog
|
||||
runtime_diary = newlog
|
||||
if("autoconvert_notes")
|
||||
config.autoconvert_notes = 1
|
||||
if("allow_webclient")
|
||||
@@ -503,6 +511,14 @@
|
||||
config.minutetopiclimit = text2num(value)
|
||||
if("second_topic_limit")
|
||||
config.secondtopiclimit = text2num(value)
|
||||
if("error_cooldown")
|
||||
error_cooldown = text2num(value)
|
||||
if("error_limit")
|
||||
error_limit = text2num(value)
|
||||
if("error_silence_time")
|
||||
error_silence_time = text2num(value)
|
||||
if("error_msg_delay")
|
||||
error_msg_delay = text2num(value)
|
||||
if("announce_adminhelps")
|
||||
config.announce_adminhelps = 1
|
||||
if("discord_url")
|
||||
|
||||
@@ -104,7 +104,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
msg += "\t [varname] = [D]([D.type])\n"
|
||||
else
|
||||
msg += "\t [varname] = [varval]\n"
|
||||
world.log << msg
|
||||
log_world(msg)
|
||||
if (istype(Master.subsystems))
|
||||
subsystems = Master.subsystems
|
||||
StartProcessing(10)
|
||||
@@ -139,7 +139,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
|
||||
world << "<span class='boldannounce'>Initializations complete!</span>"
|
||||
world.log << "Initializations complete."
|
||||
log_world("Initializations complete.")
|
||||
|
||||
// Sort subsystems by display setting for easy access.
|
||||
sortTim(subsystems, /proc/cmp_subsystem_display)
|
||||
@@ -267,7 +267,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
subsystems_to_check = tickersubsystems
|
||||
if (CheckQueue(subsystems_to_check) <= 0)
|
||||
if (!SoftReset(tickersubsystems, normalsubsystems, lobbysubsystems))
|
||||
world.log << "MC: SoftReset() failed, crashing"
|
||||
log_world("MC: SoftReset() failed, crashing")
|
||||
return
|
||||
if (!error_level)
|
||||
iteration++
|
||||
@@ -279,7 +279,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
if (queue_head)
|
||||
if (RunQueue() <= 0)
|
||||
if (!SoftReset(tickersubsystems, normalsubsystems, lobbysubsystems))
|
||||
world.log << "MC: SoftReset() failed, crashing"
|
||||
log_world("MC: SoftReset() failed, crashing")
|
||||
return
|
||||
if (!error_level)
|
||||
iteration++
|
||||
@@ -451,9 +451,9 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
// called if any mc's queue procs runtime or exit improperly.
|
||||
/datum/controller/master/proc/SoftReset(list/ticker_SS, list/normal_SS, list/lobby_SS)
|
||||
. = 0
|
||||
world.log << "MC: SoftReset called, resetting MC queue state."
|
||||
log_world("MC: SoftReset called, resetting MC queue state.")
|
||||
if (!istype(subsystems) || !istype(ticker_SS) || !istype(normal_SS) || !istype(lobby_SS))
|
||||
world.log << "MC: SoftReset: Bad list contents: '[subsystems]' '[ticker_SS]' '[normal_SS]' '[lobby_SS]' Crashing!"
|
||||
log_world("MC: SoftReset: Bad list contents: '[subsystems]' '[ticker_SS]' '[normal_SS]' '[lobby_SS]' Crashing!")
|
||||
return
|
||||
var/subsystemstocheck = subsystems + ticker_SS + normal_SS + lobby_SS
|
||||
|
||||
@@ -465,26 +465,26 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
ticker_SS -= list(SS)
|
||||
normal_SS -= list(SS)
|
||||
lobby_SS -= list(SS)
|
||||
world.log << "MC: SoftReset: Found bad entry in subsystem list, '[SS]'"
|
||||
log_world("MC: SoftReset: Found bad entry in subsystem list, '[SS]'")
|
||||
continue
|
||||
if (SS.queue_next && !istype(SS.queue_next))
|
||||
world.log << "MC: SoftReset: Found bad data in subsystem queue, queue_next = '[SS.queue_next]'"
|
||||
log_world("MC: SoftReset: Found bad data in subsystem queue, queue_next = '[SS.queue_next]'")
|
||||
SS.queue_next = null
|
||||
if (SS.queue_prev && !istype(SS.queue_prev))
|
||||
world.log << "MC: SoftReset: Found bad data in subsystem queue, queue_prev = '[SS.queue_prev]'"
|
||||
log_world("MC: SoftReset: Found bad data in subsystem queue, queue_prev = '[SS.queue_prev]'")
|
||||
SS.queue_prev = null
|
||||
SS.queued_priority = 0
|
||||
SS.queued_time = 0
|
||||
SS.state = SS_IDLE
|
||||
if (queue_head && !istype(queue_head))
|
||||
world.log << "MC: SoftReset: Found bad data in subsystem queue, queue_head = '[queue_head]'"
|
||||
log_world("MC: SoftReset: Found bad data in subsystem queue, queue_head = '[queue_head]'")
|
||||
queue_head = null
|
||||
if (queue_tail && !istype(queue_tail))
|
||||
world.log << "MC: SoftReset: Found bad data in subsystem queue, queue_tail = '[queue_tail]'"
|
||||
log_world("MC: SoftReset: Found bad data in subsystem queue, queue_tail = '[queue_tail]'")
|
||||
queue_tail = null
|
||||
queue_priority_count = 0
|
||||
queue_priority_count_bg = 0
|
||||
world.log << "MC: SoftReset: Finished."
|
||||
log_world("MC: SoftReset: Finished.")
|
||||
. = 1
|
||||
|
||||
|
||||
@@ -493,6 +493,6 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
|
||||
if(!statclick)
|
||||
statclick = new/obj/effect/statclick/debug("Initializing...", src)
|
||||
|
||||
|
||||
stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (TickDrift:[round(Master.tickdrift)]) (Iteration:[Master.iteration])"))
|
||||
stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))")
|
||||
stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])"))
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
var/time = (world.timeofday - start_timeofday) / 10
|
||||
var/msg = "Initialized [name] subsystem within [time] seconds!"
|
||||
world << "<span class='boldannounce'>[msg]</span>"
|
||||
world.log << msg
|
||||
log_world(msg)
|
||||
return time
|
||||
|
||||
//hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc.
|
||||
|
||||
@@ -224,7 +224,7 @@ var/datum/subsystem/garbage_collector/SSgarbage
|
||||
/datum/var/gc_destroyed //Time when this object was destroyed.
|
||||
|
||||
#ifdef TESTING
|
||||
/datum/var/running_find_references
|
||||
/datum/var/running_find_references
|
||||
/datum/var/last_find_references = 0
|
||||
|
||||
/datum/verb/find_refs()
|
||||
@@ -333,7 +333,7 @@ var/datum/subsystem/garbage_collector/SSgarbage
|
||||
else
|
||||
DoSearchVar(variable, "[Xname]: [varname]")
|
||||
#endif
|
||||
else if(islist(X))
|
||||
else if(islist(X))
|
||||
if(src in X)
|
||||
testing("Found [src.type] \ref[src] in list [Xname].")
|
||||
#ifdef GC_FAILURE_HARD_LOOKUP
|
||||
@@ -347,7 +347,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
|
||||
//update this list using tools/DMTreeToGlobalsList
|
||||
/datum/proc/find_references_in_globals()
|
||||
SearchVar(last_irc_status)
|
||||
SearchVar(inerror)
|
||||
SearchVar(failed_db_connections)
|
||||
SearchVar(nextmap)
|
||||
SearchVar(mapchanging)
|
||||
|
||||
@@ -374,10 +374,10 @@ var/datum/subsystem/job/SSjob
|
||||
S = sloc
|
||||
break
|
||||
if(!S) //if there isn't a spawnpoint send them to latejoin, if there's no latejoin go yell at your mapper
|
||||
world.log << "Couldn't find a round start spawn point for [rank]"
|
||||
log_world("Couldn't find a round start spawn point for [rank]")
|
||||
S = pick(latejoin)
|
||||
if(!S) //final attempt, lets find some area in the arrivals shuttle to spawn them in to.
|
||||
world.log << "Couldn't find a round start latejoin spawn point."
|
||||
log_world("Couldn't find a round start latejoin spawn point.")
|
||||
for(var/turf/T in get_area_turfs(/area/shuttle/arrival))
|
||||
if(!T.density)
|
||||
var/clear = 1
|
||||
|
||||
@@ -116,4 +116,4 @@ var/datum/subsystem/lighting/SSlighting
|
||||
varval1 = "/list([length(varval1)])"
|
||||
varval2 = "/list([length(varval2)])"
|
||||
msg += "\t [varname] = [varval1] -> [varval2]\n"
|
||||
world.log << msg
|
||||
log_world(msg)
|
||||
|
||||
@@ -45,7 +45,7 @@ var/datum/subsystem/minimap/SSminimap
|
||||
for(var/z in z_levels)
|
||||
if(!fexists(file(map_path(z,backup)))) //Let's make sure we have a file for this map
|
||||
if(backup)
|
||||
world.log << "Failed to find backup file for map [MAP_NAME] on zlevel [z]."
|
||||
log_world("Failed to find backup file for map [MAP_NAME] on zlevel [z].")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ var/datum/subsystem/ticker/ticker
|
||||
world << "Please set up your character and select \"Ready\". The game will start in [config.lobby_countdown] seconds."
|
||||
current_state = GAME_STATE_PREGAME
|
||||
for(var/client/C in clients)
|
||||
window_flash(C) //let them know lobby has opened up.
|
||||
window_flash(C, ignorepref = TRUE) //let them know lobby has opened up.
|
||||
|
||||
if(GAME_STATE_PREGAME)
|
||||
//lobby stats for statpanels
|
||||
@@ -106,6 +106,8 @@ var/datum/subsystem/ticker/ticker
|
||||
|
||||
if(timeLeft <= 0)
|
||||
current_state = GAME_STATE_SETTING_UP
|
||||
if(start_immediately)
|
||||
fire()
|
||||
|
||||
if(GAME_STATE_SETTING_UP)
|
||||
if(!setup())
|
||||
@@ -212,11 +214,11 @@ var/datum/subsystem/ticker/ticker
|
||||
//Deleting Startpoints but we need the ai point to AI-ize people later
|
||||
if(S.name != "AI")
|
||||
qdel(S)
|
||||
/*
|
||||
|
||||
var/list/adm = get_admin_counts()
|
||||
if(!adm["present"])
|
||||
send2irc("Server", "Round just started with no active admins online!")
|
||||
*/
|
||||
var/list/allmins = adm["present"]
|
||||
send2irc("Server", "Round of [hide_mode ? "secret":"[mode.name]"] has started[allmins.len ? ".":" with no active admins online!"]")
|
||||
|
||||
/datum/subsystem/ticker/proc/station_explosion_detonation(atom/bomb)
|
||||
if(bomb) //BOOM
|
||||
var/turf/epi = bomb.loc
|
||||
@@ -554,7 +556,7 @@ var/datum/subsystem/ticker/ticker
|
||||
for(var/path in SSgarbage.didntgc)
|
||||
dellog += "Path : [path] \n"
|
||||
dellog += "Failures : [SSgarbage.didntgc[path]] \n"
|
||||
world.log << dellog
|
||||
log_world(dellog)
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
@@ -663,7 +665,6 @@ var/datum/subsystem/ticker/ticker
|
||||
|
||||
modevoted = ticker.modevoted
|
||||
|
||||
|
||||
/datum/subsystem/ticker/proc/send_news_report()
|
||||
var/news_message
|
||||
var/news_source = "Nanotrasen News Network"
|
||||
@@ -714,4 +715,4 @@ var/datum/subsystem/ticker/ticker
|
||||
news_message = "During routine evacuation procedures, the emergency shuttle of [station_name()] had its navigation protocols corrupted and went off course, but was recovered shortly after."
|
||||
|
||||
if(news_message)
|
||||
send2irc(news_source, news_message,"News_Report")
|
||||
send2otherserver(news_source, news_message,"News_Report")
|
||||
|
||||
43
code/controllers/subsystem/time_tracking.dm
Normal file
43
code/controllers/subsystem/time_tracking.dm
Normal file
@@ -0,0 +1,43 @@
|
||||
var/datum/subsystem/time_track/SStime_track
|
||||
|
||||
/datum/subsystem/time_track
|
||||
name = "Time Tracking"
|
||||
wait = 600
|
||||
flags = SS_NO_INIT|SS_FIRE_IN_LOBBY
|
||||
|
||||
var/time_dilation_current = 0
|
||||
|
||||
var/time_dilation_avg_fast = 0
|
||||
var/time_dilation_avg = 0
|
||||
var/time_dilation_avg_slow = 0
|
||||
|
||||
var/first_run = TRUE
|
||||
|
||||
var/last_tick_realtime = 0
|
||||
var/last_tick_byond_time = 0
|
||||
var/last_tick_tickcount = 0
|
||||
|
||||
/datum/subsystem/time_track/New()
|
||||
NEW_SS_GLOBAL(SStime_track)
|
||||
|
||||
/datum/subsystem/time_track/fire()
|
||||
|
||||
var/current_realtime = REALTIMEOFDAY
|
||||
var/current_byondtime = world.time
|
||||
var/current_tickcount = world.time/world.tick_lag
|
||||
|
||||
if (!first_run)
|
||||
var/tick_drift = max(0, (((current_realtime - last_tick_realtime) - (current_byondtime - last_tick_byond_time)) / world.tick_lag))
|
||||
|
||||
time_dilation_current = tick_drift / (current_tickcount - last_tick_tickcount) * 100
|
||||
|
||||
time_dilation_avg_fast = MC_AVERAGE_FAST(time_dilation_avg_fast, time_dilation_current)
|
||||
time_dilation_avg = MC_AVERAGE(time_dilation_avg, time_dilation_avg_fast)
|
||||
time_dilation_avg_slow = MC_AVERAGE_SLOW(time_dilation_avg_slow, time_dilation_avg)
|
||||
else
|
||||
first_run = FALSE
|
||||
last_tick_realtime = current_realtime
|
||||
last_tick_byond_time = current_byondtime
|
||||
last_tick_tickcount = current_tickcount
|
||||
|
||||
|
||||
@@ -299,7 +299,11 @@ proc/addtimer(datum/callback/callback, wait, flags)
|
||||
var/hash
|
||||
|
||||
if (flags & TIMER_UNIQUE)
|
||||
var/list/hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, wait, flags & TIMER_CLIENT_TIME)
|
||||
var/list/hashlist
|
||||
if(flags & TIMER_NO_HASH_WAIT)
|
||||
hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, flags & TIMER_CLIENT_TIME)
|
||||
else
|
||||
hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, wait, flags & TIMER_CLIENT_TIME)
|
||||
hashlist += callback.arguments
|
||||
hash = hashlist.Join("|||||||")
|
||||
|
||||
@@ -341,4 +345,4 @@ proc/addtimer(datum/callback/callback, wait, flags)
|
||||
|
||||
|
||||
#undef BUCKET_LEN
|
||||
#undef BUCKET_POS
|
||||
#undef BUCKET_POS
|
||||
Reference in New Issue
Block a user