Merge remote-tracking branch 'upstream/master' into fix-bundle-4

This commit is contained in:
SabreML
2021-09-02 17:47:36 +01:00
343 changed files with 9551 additions and 10411 deletions
+5
View File
@@ -11,6 +11,11 @@ SUBSYSTEM_DEF(acid)
/datum/controller/subsystem/acid/stat_entry()
..("P:[processing.len]")
/datum/controller/subsystem/acid/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/acid/fire(resumed = 0)
if(!resumed)
+6
View File
@@ -66,6 +66,12 @@ SUBSYSTEM_DEF(air)
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
..(msg)
/datum/controller/subsystem/air/get_metrics()
. = ..()
var/list/cust = list()
cust["active_turfs"] = length(active_turfs)
cust["hotspots"] = length(hotspots)
.["custom"] = cust
/datum/controller/subsystem/air/Initialize(timeofday)
setup_overlays() // Assign icons and such for gas-turf-overlays
+6
View File
@@ -12,6 +12,12 @@ SUBSYSTEM_DEF(fires)
..("P:[processing.len]")
/datum/controller/subsystem/fires/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/fires/fire(resumed = 0)
if(!resumed)
src.currentrun = processing.Copy()
+16
View File
@@ -61,6 +61,22 @@ SUBSYSTEM_DEF(garbage)
msg += " | Fail:[fail_counts.Join(",")]"
..(msg)
/datum/controller/subsystem/garbage/get_metrics()
. = ..()
var/list/cust = list()
if((delslasttick + gcedlasttick) == 0) // Account for DIV0
cust["gcr"] = 0
else
cust["gcr"] = (gcedlasttick / (delslasttick + gcedlasttick))
cust["total_harddels"] = totaldels
cust["total_softdels"] = totalgcs
var/i = 0
for(var/list/L in queues)
i++
cust["queue_[i]"] = length(L)
.["custom"] = cust
/datum/controller/subsystem/garbage/Shutdown()
//Adds the del() log to the qdel log file
var/list/dellog = list()
+8
View File
@@ -11,6 +11,14 @@ SUBSYSTEM_DEF(lighting)
/datum/controller/subsystem/lighting/stat_entry()
..("L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]")
/datum/controller/subsystem/lighting/get_metrics()
. = ..()
var/list/cust = list()
cust["sources_queue"] = length(sources_queue)
cust["corners_queue"] = length(corners_queue)
cust["objects_queue"] = length(objects_queue)
.["custom"] = cust
/datum/controller/subsystem/lighting/Initialize(timeofday)
if(!initialized)
if(GLOB.configuration.general.starlight)
+6
View File
@@ -20,6 +20,12 @@ SUBSYSTEM_DEF(machines)
fire()
return ..()
/datum/controller/subsystem/machines/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/machines/proc/makepowernets()
for(var/datum/powernet/PN in powernets)
qdel(PN)
+1 -1
View File
@@ -62,7 +62,7 @@ SUBSYSTEM_DEF(mapping)
log_startup_progress("Populating lavaland...")
var/lavaland_setup_timer = start_watch()
seedRuins(list(level_name_to_num(MINING)), GLOB.configuration.ruins.lavaland_ruin_budget, /area/lavaland/surface/outdoors/unexplored, GLOB.lava_ruins_templates)
spawn_rivers(list(level_name_to_num(MINING)))
spawn_rivers(level_name_to_num(MINING))
log_startup_progress("Successfully populated lavaland in [stop_watch(lavaland_setup_timer)]s.")
// Now we make a list of areas for teleport locs
+47
View File
@@ -0,0 +1,47 @@
SUBSYSTEM_DEF(metrics)
name = "Metrics"
wait = 30 SECONDS
offline_implications = "Server metrics will no longer be ingested into monitoring systems. No immediate action is needed."
runlevels = RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME // ALL THE LEVELS
flags = SS_KEEP_TIMING // This needs to ingest every 30 IRL seconds, not ingame seconds.
/// The real time of day the server started. Used to calculate time drift
var/world_init_time = 0 // Not set in here. Set in world/New()
/datum/controller/subsystem/metrics/Initialize(start_timeofday)
if(!GLOB.configuration.metrics.enable_metrics)
flags |= SS_NO_FIRE // Disable firing to save CPU
return ..()
/datum/controller/subsystem/metrics/fire(resumed)
SShttp.create_async_request(RUSTG_HTTP_METHOD_POST, GLOB.configuration.metrics.metrics_endpoint, get_metrics_json(), list(
"Authorization" = "ApiKey [GLOB.configuration.metrics.metrics_api_token]",
"Content-Type" = "application/json"
))
/datum/controller/subsystem/metrics/proc/get_metrics_json()
var/list/out = list()
out["@timestamp"] = time_stamp() // This is required by ElasticSearch, complete with this name. DO NOT REMOVE THIS.
out["cpu"] = world.cpu
// out["maptick"] = world.map_cpu // TODO: 514
out["elapsed_processed"] = world.time
out["elapsed_real"] = (REALTIMEOFDAY - world_init_time)
out["client_count"] = length(GLOB.clients)
out["round_id"] = text2num(GLOB.round_id) // This is so we can filter the metrics by a single round ID
// Funnel in all SS metrics
var/list/ss_data = list()
for(var/datum/controller/subsystem/SS in Master.subsystems)
ss_data[SS.ss_id] = SS.get_metrics()
out["subsystems"] = ss_data
// And send it all
return json_encode(out)
/*
// Uncomment this if you add new metrics to verify how the JSON formats
/client/verb/debugmetricts()
usr << browse(SSmetrics.get_metrics_json(), "window=aadebug")
*/
+6
View File
@@ -12,6 +12,12 @@ SUBSYSTEM_DEF(mobs)
/// The amount of giant spiders that exist in the world. Used for mob capping.
var/giant_spiders = 0
/datum/controller/subsystem/mobs/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(GLOB.mob_living_list)
.["custom"] = cust
/datum/controller/subsystem/mobs/stat_entry()
..("P:[GLOB.mob_living_list.len]")
@@ -14,6 +14,12 @@ SUBSYSTEM_DEF(processing)
/datum/controller/subsystem/processing/stat_entry()
..("[stat_tag]:[processing.len]")
/datum/controller/subsystem/processing/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/processing/fire(resumed = 0)
if(!resumed)
currentrun = processing.Copy()
+31 -1
View File
@@ -1,9 +1,16 @@
PROCESSING_SUBSYSTEM_DEF(radiation)
name = "Radiation"
flags = SS_NO_INIT | SS_BACKGROUND
flags = SS_BACKGROUND | SS_NO_INIT
wait = 1 SECONDS
offline_implications = "Radiation will no longer function; power generation may not happen. A restart may or may not be required, depending on the situation."
var/list/warned_atoms = list()
// Cache radiation levels for each turf so it doesn't need to be done iteratively
// turf_rad_cache is the state in the current loop, and may not be 100% representative
// until processing is complete.
// prev_rad_cache is the fully evaluated radiation state cache from the previous tick.
var/list/turf_rad_cache = list()
var/list/prev_rad_cache = list()
/datum/controller/subsystem/processing/radiation/proc/warn(datum/component/radioactive/contamination)
if(!contamination || QDELETED(contamination))
@@ -16,3 +23,26 @@ PROCESSING_SUBSYSTEM_DEF(radiation)
SSblackbox.record_feedback("tally", "contaminated", 1, master.type)
var/msg = "has become contaminated with enough radiation to contaminate other objects. || Source: [contamination.source] || Strength: [contamination.strength]"
master.investigate_log(msg, "radiation")
/datum/controller/subsystem/processing/radiation/fire(resumed)
refresh_rad_cache()
. = ..()
/datum/controller/subsystem/processing/radiation/proc/get_turf_radiation(turf/place)
if (prev_rad_cache[place])
return prev_rad_cache[place]
else
return 0
/datum/controller/subsystem/processing/radiation/proc/update_rad_cache(datum/component/radioactive/thing)
var/atom/owner = thing.parent
var/turf/place = get_turf(owner)
if (turf_rad_cache[place])
turf_rad_cache[place] += thing.strength
else
turf_rad_cache[place] = thing.strength
/datum/controller/subsystem/processing/radiation/proc/refresh_rad_cache()
prev_rad_cache = turf_rad_cache.Copy()
turf_rad_cache = list()
@@ -0,0 +1,45 @@
#define QUEUE_DATA_FILE "data/queue_data.json"
// These are defines for the sake of making sure we get the right keys
#define QUEUE_DATA_FILE_THRESHOLD_KEY "threshold"
#define QUEUE_DATA_FILE_ENABLED_KEY "enabled"
#define QUEUE_DATA_FILE_PERSISTENT_KEY "persistent"
SUBSYSTEM_DEF(queue)
name = "Server Queue"
init_order = INIT_ORDER_QUEUE // 100
flags = SS_NO_FIRE
/// Threshold of players to queue new people
var/queue_threshold = 0
/// Whether the queue is enabled or not
var/queue_enabled = FALSE
/// Whether to persist these settings over multiple rounds
var/persist_queue = FALSE
/// List of ckeys allowed to bypass queue this round
var/list/queue_bypass_list = list()
/// Last world.time we let a ckey in. 3 second delay between each letin to avoid a mass bubble
var/last_letin_time = 0
/datum/controller/subsystem/queue/Initialize(start_timeofday)
if(fexists(QUEUE_DATA_FILE))
try
var/F = file2text(QUEUE_DATA_FILE)
var/list/data = json_decode(F)
queue_threshold = data[QUEUE_DATA_FILE_THRESHOLD_KEY]
queue_enabled = data[QUEUE_DATA_FILE_ENABLED_KEY]
persist_queue = data[QUEUE_DATA_FILE_PERSISTENT_KEY]
catch
stack_trace("Failed to load [QUEUE_DATA_FILE] from disk due to malformed JSON. You may need to setup the queue again.")
return ..()
/datum/controller/subsystem/queue/Shutdown()
// Save if persistent
if(persist_queue)
if(fexists(QUEUE_DATA_FILE))
fdel(QUEUE_DATA_FILE)
var/data = list()
data[QUEUE_DATA_FILE_THRESHOLD_KEY] = queue_threshold
data[QUEUE_DATA_FILE_ENABLED_KEY] = queue_enabled
data[QUEUE_DATA_FILE_PERSISTENT_KEY] = persist_queue
var/json_data = json_encode(data)
text2file(json_data, QUEUE_DATA_FILE)
-1
View File
@@ -37,7 +37,6 @@ SUBSYSTEM_DEF(shuttle)
var/list/shoppinglist = list()
var/list/requestlist = list()
var/list/supply_packs = list()
var/datum/round_event/shuttle_loan/shuttle_loan
var/sold_atoms = ""
var/list/hidden_shuttle_turfs = list() //all turfs hidden from navigation computers associated with a list containing the image hiding them and the type of the turf they are pretending to be
var/list/hidden_shuttle_turf_images = list() //only the images from the above list
+5
View File
@@ -12,6 +12,11 @@ SUBSYSTEM_DEF(spacedrift)
/datum/controller/subsystem/spacedrift/stat_entry()
..("P:[processing.len]")
/datum/controller/subsystem/spacedrift/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/spacedrift/fire(resumed = 0)
if(!resumed)
+8 -1
View File
@@ -27,6 +27,13 @@ SUBSYSTEM_DEF(tgui)
/datum/controller/subsystem/tgui/stat_entry()
..("P:[processing_uis.len]")
/datum/controller/subsystem/tgui/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing_uis)
.["custom"] = cust
/datum/controller/subsystem/tgui/fire(resumed = 0)
if (!resumed)
src.currentrun = processing_uis.Copy()
@@ -119,7 +126,7 @@ SUBSYSTEM_DEF(tgui)
* Close all UIs attached to src_object.
* Returns the number of UIs closed.
*
* * datum/src_objectThe object/datum which owns the UIs.
* * datum/src_object - The object/datum which owns the UIs.
*/
/datum/controller/subsystem/tgui/proc/close_uis(datum/src_object)
if(!src_object.unique_datum_id) // First check if the datum has an UID set
+6
View File
@@ -15,6 +15,12 @@ SUBSYSTEM_DEF(throwing)
/datum/controller/subsystem/throwing/stat_entry()
..("P:[processing.len]")
/datum/controller/subsystem/throwing/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/throwing/fire(resumed = 0)
if(!resumed)
src.currentrun = processing.Copy()
@@ -3,6 +3,7 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets
/datum/controller/subsystem/tickets/mentor_tickets/New()
NEW_SS_GLOBAL(SSmentor_tickets)
PreInit()
ss_id = "mentor_tickets"
/datum/controller/subsystem/tickets/mentor_tickets
name = "Mentor Tickets"
@@ -41,6 +41,12 @@ SUBSYSTEM_DEF(tickets)
var/ticketCounter = 1
/datum/controller/subsystem/tickets/get_metrics()
. = ..()
var/list/cust = list()
cust["tickets"] = length(allTickets) // Not a perf metric but I want to see a graph where SSair usage spikes and 20 tickets come in
.["custom"] = cust
/datum/controller/subsystem/tickets/Initialize()
if(!close_messages)
close_messages = list("<font color='red' size='4'><b>- [ticket_name] Rejected! -</b></font>",
+6
View File
@@ -37,6 +37,12 @@ SUBSYSTEM_DEF(timer)
/datum/controller/subsystem/timer/stat_entry(msg)
..("B:[bucket_count] P:[length(second_queue)] H:[length(hashes)] C:[length(clienttime_timers)] S:[length(timer_id_dict)]")
/datum/controller/subsystem/timer/get_metrics()
. = ..()
var/list/cust = list()
cust["bucket_count"] = bucket_count
.["custom"] = cust
/datum/controller/subsystem/timer/fire(resumed = FALSE)
var/lit = last_invoke_tick
var/last_check = world.time - TICKS2DS(BUCKET_LEN*1.5)
+29 -23
View File
@@ -41,7 +41,7 @@ SUBSYSTEM_DEF(vote)
CHECK_TICK
/datum/controller/subsystem/vote/proc/autotransfer()
initiate_vote("crew_transfer","the server")
initiate_vote("crew transfer", "the server")
/datum/controller/subsystem/vote/proc/reset()
initiator = null
@@ -95,7 +95,7 @@ SUBSYSTEM_DEF(vote)
choices[GLOB.master_mode] += non_voters
if(choices[GLOB.master_mode] >= greatest_votes)
greatest_votes = choices[GLOB.master_mode]
else if(mode == "crew_transfer")
else if(mode == "crew transfer")
var/factor = 0.5
switch(world.time / (10 * 60)) // minutes
if(0 to 60)
@@ -174,9 +174,9 @@ SUBSYSTEM_DEF(vote)
if(!SSticker.ticker_going)
SSticker.ticker_going = TRUE
to_chat(world, "<font color='red'><b>The round will start soon.</b></font>")
if("crew_transfer")
if("crew transfer")
if(. == "Initiate Crew Transfer")
init_shift_change(null, 1)
init_shift_change(null, TRUE)
if("map")
// Find target map.
var/datum/map/top_voted_map
@@ -222,7 +222,7 @@ SUBSYSTEM_DEF(vote)
if(SSticker.current_state >= 2)
return 0
choices.Add(GLOB.configuration.gamemode.votable_modes)
if("crew_transfer")
if("crew transfer")
if(check_rights(R_ADMIN|R_MOD))
if(SSticker.current_state <= 2)
return 0
@@ -266,16 +266,16 @@ SUBSYSTEM_DEF(vote)
<a href='?src=[UID()];vote=open'>Click here or type vote to place your vote.</a>
You have [GLOB.configuration.vote.vote_time / 10] seconds to vote.</font>"})
switch(vote_type)
if("crew_transfer", "gamemode", "custom", "map")
if("crew transfer", "gamemode", "custom", "map")
SEND_SOUND(world, sound('sound/ambience/alarm4.ogg'))
if(mode == "gamemode" && SSticker.ticker_going)
SSticker.ticker_going = FALSE
to_chat(world, "<font color='red'><b>Round start has been delayed.</b></font>")
if(mode == "crew_transfer" && GLOB.ooc_enabled)
if(mode == "crew transfer" && GLOB.ooc_enabled)
auto_muted = TRUE
GLOB.ooc_enabled = FALSE
to_chat(world, "<b>The OOC channel has been automatically disabled due to a crew transfer vote.</b>")
log_admin("OOC was toggled automatically due to crew_transfer vote.")
log_admin("OOC was toggled automatically due to crew transfer vote.")
message_admins("OOC has been toggled off automatically.")
if(mode == "gamemode" && GLOB.ooc_enabled)
auto_muted = TRUE
@@ -314,37 +314,41 @@ SUBSYSTEM_DEF(vote)
dat += "(<a href='?src=[UID()];vote=cancel'>Cancel Vote</a>) "
else
dat += "<div id='vote_div'><h2>Start a vote:</h2><hr><ul><li>"
//restart
if(admin || GLOB.configuration.vote.allow_restart_votes)
dat += "<a href='?src=[UID()];vote=restart'>Restart</a>"
else
dat += "<font color='grey'>Restart (Disallowed)</font>"
dat += "</li><li>"
// Crew transfer
if(admin || GLOB.configuration.vote.allow_restart_votes)
dat += "<a href='?src=[UID()];vote=crew_transfer'>Crew Transfer</a>"
else
dat += "<font color='grey'>Crew Transfer (Disallowed)</font>"
dat += "</li><li>"
// Restart
if(admin || GLOB.configuration.vote.allow_restart_votes)
dat += "<a href='?src=[UID()];vote=restart'>Restart</a>"
else
dat += "<font color='grey'>Restart (Disallowed)</font>"
if(admin)
dat += "\t(<a href='?src=[UID()];vote=toggle_restart'>[GLOB.configuration.vote.allow_restart_votes ? "Allowed" : "Disallowed"]</a>)"
dat += "</li><li>"
//gamemode
// Gamemode
if(admin || GLOB.configuration.vote.allow_mode_votes)
dat += "<a href='?src=[UID()];vote=gamemode'>GameMode</a>"
dat += "<a href='?src=[UID()];vote=gamemode'>Gamemode</a>"
else
dat += "<font color='grey'>GameMode (Disallowed)</font>"
dat += "<font color='grey'>Gamemode (Disallowed)</font>"
if(admin)
dat += "\t(<a href='?src=[UID()];vote=toggle_gamemode'>[GLOB.configuration.vote.allow_mode_votes ? "Allowed" : "Disallowed"]</a>)"
dat += "</li><li>"
// Map
if(admin)
dat += "<a href='?src=[UID()];vote=map'>Map</a>"
else
dat += "<font color='grey'>Map (Disallowed)</font>"
dat += "</li><li>"
dat += "</li>"
//custom
// Custom
if(admin)
dat += "<li><a href='?src=[UID()];vote=custom'>Custom</a></li>"
dat += "<a href='?src=[UID()];vote=custom'>Custom</a></li>"
dat += "</ul></div><hr>"
var/datum/browser/popup = new(C.mob, "vote", "Voting Panel", nref=src)
popup.set_content(dat)
@@ -387,14 +391,16 @@ SUBSYSTEM_DEF(vote)
var/votedesc = capitalize(mode)
if(mode == "custom")
votedesc += " ([question])"
log_and_message_admins("cancelled the running [votedesc] vote.")
log_and_message_admins("cancelled the running '[votedesc]' vote.")
reset()
if("toggle_restart")
if(admin)
GLOB.configuration.vote.allow_restart_votes = !GLOB.configuration.vote.allow_restart_votes
log_and_message_admins("has [GLOB.configuration.vote.allow_restart_votes ? "enabled" : "disabled"] public restart voting.")
if("toggle_gamemode")
if(admin)
GLOB.configuration.vote.allow_mode_votes = !GLOB.configuration.vote.allow_mode_votes
log_and_message_admins("has [GLOB.configuration.vote.allow_mode_votes ? "enabled" : "disabled"] public gamemode voting.")
if("restart")
if(GLOB.configuration.vote.allow_restart_votes || admin)
initiate_vote("restart",usr.key)
@@ -406,7 +412,7 @@ SUBSYSTEM_DEF(vote)
initiate_vote("map", usr.key)
if("crew_transfer")
if(GLOB.configuration.vote.allow_restart_votes || admin)
initiate_vote("crew_transfer",usr.key)
initiate_vote("crew transfer", usr.key)
if("custom")
if(admin)
initiate_vote("custom",usr.key)
+7 -1
View File
@@ -9,11 +9,17 @@ SUBSYSTEM_DEF(weather)
flags = SS_BACKGROUND
wait = 10
runlevels = RUNLEVEL_GAME
offline_implications = "Ash storms will no longer trigger. No immediate action is needed."
offline_implications = "Ash storms will no longer trigger. No immediate action is needed."
var/list/processing = list()
var/list/eligible_zlevels = list()
var/list/next_hit_by_zlevel = list() //Used by barometers to know when the next storm is coming
/datum/controller/subsystem/weather/get_metrics()
. = ..()
var/list/cust = list()
cust["processing"] = length(processing)
.["custom"] = cust
/datum/controller/subsystem/weather/fire()
// process active weather
for(var/V in processing)