From aeefeb6c53a32ef8053a15d420b92bd707c0fa4e Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 12 May 2021 03:33:41 -0700 Subject: [PATCH] woo --- code/datums/world_topic.dm | 95 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/code/datums/world_topic.dm b/code/datums/world_topic.dm index 946090c571..f5ea4257aa 100644 --- a/code/datums/world_topic.dm +++ b/code/datums/world_topic.dm @@ -207,3 +207,98 @@ if(!key_valid) GLOB.topic_status_cache = . + + +/datum/world_topic/jsonstatus + keyword = "jsonstatus" + +/datum/world_topic/jsonstatus/Run(list/input, addr) + . = list() + .["Gamemode"] = GLOB.master_mode + .["Round ID"] = GLOB.round_id + .["Players"] = GLOB.clients.len + var/list/adm = get_admin_counts() + var/list/presentmins = adm["present"] + var/list/afkmins = adm["afk"] + .["Admins"] = presentmins.len + afkmins.len //equivalent to the info gotten from adminwho + .["Security Level"] = "[NUM2SECLEVEL(GLOB.security_level)]" + .["Round Duration"] = WORLDTIME2TEXT + .["Time Dilation (Avg)"] = SStime_track.time_dilation_avg + return json_encode(.) + +/datum/world_topic/jsonplayers + keyword = "jsonplayers" + +/datum/world_topic/jsonplayers/Run(list/input, addr) + . = list() + for(var/client/C in GLOB.clients) + . += C.key + return json_encode(.) + +/datum/world_topic/jsonmanifest + keyword = "jsonmanifest" + +/datum/world_topic/jsonmanifest/Run(list/input, addr) + var/list/command = list() + var/list/security = list() + var/list/engineering = list() + var/list/medical = list() + var/list/science = list() + var/list/cargo = list() + var/list/civilian = list() + var/list/silicons = list() + var/list/misc = list() + for(var/datum/data/record/R in data_core.general) + var/name = R.fields["name"] + var/rank = R.fields["rank"] + var/real_rank = rank // make_list_rank(R.fields["real_rank"]) + if(real_rank in GLOB.command_positions) + command[name] = rank + else if(real_rank in GLOB.security_positions) + security[name] = rank + else if(real_rank in GLOB.engineering_positions) + engineering[name] = rank + else if(real_rank in GLOB.medical_positions) + medical[name] = rank + else if(real_rank in GLOB.science_positions) + science[name] = rank + else if(real_rank in GLOB.cargo_positions) + cargo[name] = rank + else if(real_rank in GLOB.civilian_positions) + civilian[name] = rank + else + misc[name] = rank + + // Synthetics don't have actual records, so we will pull them from here. + for(var/mob/living/silicon/ai/ai in GLOB.mob_list) + silicons[ai.name] = "Artificial Intelligence" + + for(var/mob/living/silicon/robot/robot in GLOB.mob_list) + // No combat/syndicate cyborgs, no drones, and no AI shells. + if(!robot.scrambledcodes && !robot.shell && !(robot.module && robot.module.hide_on_manifest)) + silicons[robot.name] = "[robot.modtype] [robot.braintype]" + . = list() + .["Command"] = command + .["Security"] = security + .["Engineering"] = engineering + .["Medical"] = medical + .["Science"] = science + .["Cargo"] = cargo + .["Civilian"] = civilian + .["Silicons"] = silicons + .["Misc"] = misc + return json_encode(.) + +/datum/world_topic/jsonrevision + keyword = "jsonrevision" + +/datum/world_topic/jsonrevision/Run(list/input, addr) + . = list() + var/datum/getrev/revdata = GLOB.revdata + .["branch"] = "master" + .["data"] = revdata.date + .["dd_version"] = world.byond_build + .["dm_version"] = DM_BUILD + .["gameid"] = GLOB.round_id + .["revision"] = revdata.commit + return json_encode(.)