diff --git a/code/controllers/subsystem/statpanel.dm b/code/controllers/subsystem/statpanel.dm index 821a55619..ce257a473 100644 --- a/code/controllers/subsystem/statpanel.dm +++ b/code/controllers/subsystem/statpanel.dm @@ -27,97 +27,137 @@ SUBSYSTEM_DEF(statpanels) var/ETA = SSshuttle.emergency.getModeStr() if(ETA) global_data += "[ETA] [SSshuttle.emergency.getTimerStr()]" +/* Please fix + if(SSvote.mode) + var/static/list/supported = list(PLURALITY_VOTING, APPROVAL_VOTING) + global_data += "Vote active!, There is currently a vote running. Question: [SSvote.question]" + if(!(SSvote.vote_system in supported)) + global_data += ", The current vote system is not supported by statpanel rendering. Please vote manually by opening the vote popup using the action button or chat link." + return + global_data += "Time Left:, [round(SSvote.end_time - world.time)] seconds" + + global_data += "Choices:" + for(var/i in 1 to SSvote.choice_statclicks.len) + var/choice = SSvote.choice_statclicks[i] + var/ivotedforthis = FALSE + if(usr.ckey) + switch(SSvote.vote_system) + if(APPROVAL_VOTING) + ivotedforthis = SSvote.voted[usr.ckey] && (i in SSvote.voted[usr.ckey]) + if(PLURALITY_VOTING) + ivotedforthis = SSvote.voted[usr.ckey] == i + + global_data += (ivotedforthis? "\[X\]" : "\[ \]", SSvote.choice_statclicks[choice]) +*/ + encoded_global_data = url_encode(json_encode(global_data)) - - var/list/mc_data = list( - list("CPU:", world.cpu), - list("Instances:", "[num2text(world.contents.len, 10)]"), - list("World Time:", "[world.time]"), - list("Globals:", GLOB.stat_entry(), "\ref[GLOB]"), - list("[config]:", config.stat_entry(), "\ref[config]"), - list("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)]%))"), - list("Master Controller:", Master.stat_entry(), "\ref[Master]"), - list("Failsafe Controller:", Failsafe.stat_entry(), "\ref[Failsafe]"), - list("","") - ) - for(var/ss in Master.subsystems) - var/datum/controller/subsystem/sub_system = ss - mc_data[++mc_data.len] = list("\[[sub_system.state_letter()]][sub_system.name]", sub_system.stat_entry(), "\ref[sub_system]") - mc_data[++mc_data.len] = list("Camera Net", "Cameras: [GLOB.cameranet.cameras.len] | Chunks: [GLOB.cameranet.chunks.len]", "\ref[GLOB.cameranet]") - mc_data_encoded = url_encode(json_encode(mc_data)) src.currentrun = GLOB.clients.Copy() - + mc_data_encoded = null var/list/currentrun = src.currentrun while(length(currentrun)) var/client/target = currentrun[length(currentrun)] currentrun.len-- - var/ping_str = url_encode("Ping: [round(target.lastping, 1)]ms (Average: [round(target.avgping, 1)]ms)") - var/other_str = url_encode(json_encode(target.mob.get_status_tab_items())) - target << output("[encoded_global_data];[ping_str];[other_str]", "statbrowser:update") + if(!target.statbrowser_ready) + continue + if(target.stat_tab == "Status") + var/ping_str = url_encode("Ping: [round(target.lastping, 1)]ms (Average: [round(target.avgping, 1)]ms)") + var/other_str = url_encode(json_encode(target.mob.get_status_tab_items())) + target << output("[encoded_global_data];[ping_str];[other_str]", "statbrowser:update") if(!target.holder) target << output("", "statbrowser:remove_admin_tabs") else - var/turf/eye_turf = get_turf(target.eye) - var/coord_entry = url_encode(COORD(eye_turf)) - target << output("[mc_data_encoded];[coord_entry];[url_encode(target.holder.href_token)]", "statbrowser:update_mc") - var/list/ahelp_tickets = GLOB.ahelp_tickets.stat_entry() - target << output("[url_encode(json_encode(ahelp_tickets))];", "statbrowser:update_tickets") - if(!length(GLOB.sdql2_queries)) + if(!("MC" in target.panel_tabs) || !("Tickets" in target.panel_tabs)) + target << output("[url_encode(target.holder.href_token)]", "statbrowser:add_admin_tabs") + if(target.stat_tab == "MC") + var/turf/eye_turf = get_turf(target.eye) + var/coord_entry = url_encode(COORD(eye_turf)) + if(!mc_data_encoded) + generate_mc_data() + target << output("[mc_data_encoded];[coord_entry]", "statbrowser:update_mc") + if(target.stat_tab == "Tickets") + var/list/ahelp_tickets = GLOB.ahelp_tickets.stat_entry() + target << output("[url_encode(json_encode(ahelp_tickets))];", "statbrowser:update_tickets") + if(!length(GLOB.sdql2_queries) && ("SDQL2" in target.panel_tabs)) target << output("", "statbrowser:remove_sdql2") - else + else if(length(GLOB.sdql2_queries) && (target.stat_tab == "SDQL2" || !("SDQL2" in target.panel_tabs))) var/list/sdql2A = list() sdql2A[++sdql2A.len] = list("", "Access Global SDQL2 List", REF(GLOB.sdql2_vv_statobj)) var/list/sdql2B = list() + for(var/i in GLOB.sdql2_queries) + var/datum/SDQL2_query/Q = i + sdql2B = Q.generate_stat() sdql2A += sdql2B target << output(url_encode(json_encode(sdql2A)), "statbrowser:update_sdql2") - var/list/proc_holders = target.mob.get_proc_holders() - target.spell_tabs.Cut() - for(var/phl in proc_holders) - var/list/proc_holder_list = phl - target.spell_tabs |= proc_holder_list[1] - var/proc_holders_encoded = "" - if(length(proc_holders)) - proc_holders_encoded = url_encode(json_encode(proc_holders)) - target << output("[url_encode(json_encode(target.spell_tabs))];[proc_holders_encoded]", "statbrowser:update_spells") - if(target.mob?.listed_turf) - var/mob/target_mob = target.mob - if(!target_mob.TurfAdjacent(target_mob.listed_turf)) - target << output("", "statbrowser:remove_listedturf") - target_mob.listed_turf = null - else - var/list/overrides = list() - var/list/turfitems = list() - for(var/img in target.images) - var/image/target_image = img - if(!target_image.loc || target_image.loc.loc != target_mob.listed_turf || !target_image.override) - continue - overrides += target_image.loc - if(!(REF(target_mob.listed_turf) in cached_images)) - target << browse_rsc(getFlatIcon(target_mob.listed_turf, no_anim = TRUE), "[REF(target_mob.listed_turf)].png") - cached_images += REF(target_mob.listed_turf) - turfitems[++turfitems.len] = list("[target_mob.listed_turf]", REF(target_mob.listed_turf), "[REF(target_mob.listed_turf)].png") - for(var/tc in target_mob.listed_turf) - var/atom/movable/turf_content = tc - if(turf_content.mouse_opacity == MOUSE_OPACITY_TRANSPARENT) - continue - if(turf_content.invisibility > target_mob.see_invisible) - continue - if(turf_content in overrides) - continue - if(turf_content.IsObscured()) - continue - if(length(turfitems) < 30) // only create images for the first 30 items on the turf, for performance reasons - if(!(REF(turf_content) in cached_images)) - target << browse_rsc(getFlatIcon(turf_content, no_anim = TRUE), "[REF(turf_content)].png") - cached_images += REF(turf_content) - turfitems[++turfitems.len] = list("[turf_content.name]", REF(turf_content), "[REF(turf_content)].png") - else - turfitems[++turfitems.len] = list("[turf_content.name]", REF(turf_content)) - turfitems = url_encode(json_encode(turfitems)) - target << output("[turfitems];", "statbrowser:update_listedturf") + if(target.mob) + var/mob/M = target.mob + if((target.stat_tab in target.spell_tabs) || !length(target.spell_tabs) && (length(M.mob_spell_list) || length(M.mind?.spell_list))) + var/list/proc_holders = M.get_proc_holders() + target.spell_tabs.Cut() + for(var/phl in proc_holders) + var/list/proc_holder_list = phl + target.spell_tabs |= proc_holder_list[1] + var/proc_holders_encoded = "" + if(length(proc_holders)) + proc_holders_encoded = url_encode(json_encode(proc_holders)) + target << output("[url_encode(json_encode(target.spell_tabs))];[proc_holders_encoded]", "statbrowser:update_spells") + if(M?.listed_turf) + var/mob/target_mob = M + if(!target_mob.TurfAdjacent(target_mob.listed_turf)) + target << output("", "statbrowser:remove_listedturf") + target_mob.listed_turf = null + else if(target.stat_tab == M?.listed_turf.name || !(M?.listed_turf.name in target.panel_tabs)) + var/list/overrides = list() + var/list/turfitems = list() + for(var/img in target.images) + var/image/target_image = img + if(!target_image.loc || target_image.loc.loc != target_mob.listed_turf || !target_image.override) + continue + overrides += target_image.loc + turfitems[++turfitems.len] = list("[target_mob.listed_turf]", REF(target_mob.listed_turf), "[REF(target_mob.listed_turf)].png") + for(var/tc in target_mob.listed_turf) + var/atom/movable/turf_content = tc + if(turf_content.mouse_opacity == MOUSE_OPACITY_TRANSPARENT) + continue + if(turf_content.invisibility > target_mob.see_invisible) + continue + if(turf_content in overrides) + continue + if(turf_content.IsObscured()) + continue + if(length(turfitems) < 30) // only create images for the first 30 items on the turf, for performance reasons + if(!(REF(turf_content) in cached_images)) + target << browse_rsc(getFlatIcon(turf_content, no_anim = TRUE), "[REF(turf_content)].png") + cached_images += REF(turf_content) + turfitems[++turfitems.len] = list("[turf_content.name]", REF(turf_content), "[REF(turf_content)].png") + else + turfitems[++turfitems.len] = list("[turf_content.name]", REF(turf_content)) + turfitems = url_encode(json_encode(turfitems)) + target << output("[turfitems];", "statbrowser:update_listedturf") if(MC_TICK_CHECK) return + +/datum/controller/subsystem/statpanels/proc/generate_mc_data() + var/list/mc_data = list( + list("CPU:", world.cpu), + list("Instances:", "[num2text(world.contents.len, 10)]"), + list("World Time:", "[world.time]"), + list("Globals:", GLOB.stat_entry(), "\ref[GLOB]"), + list("[config]:", config.stat_entry(), "\ref[config]"), + list("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)]%))"), + list("Master Controller:", Master.stat_entry(), "\ref[Master]"), + list("Failsafe Controller:", Failsafe.stat_entry(), "\ref[Failsafe]"), + list("","") + ) + for(var/ss in Master.subsystems) + var/datum/controller/subsystem/sub_system = ss + mc_data[++mc_data.len] = list("\[[sub_system.state_letter()]][sub_system.name]", sub_system.stat_entry(), "\ref[sub_system]") + mc_data[++mc_data.len] = list("Camera Net", "Cameras: [GLOB.cameranet.cameras.len] | Chunks: [GLOB.cameranet.chunks.len]", "\ref[GLOB.cameranet]") + mc_data_encoded = url_encode(json_encode(mc_data)) + +/atom/proc/remove_from_cache() + SSstatpanels.cached_images -= REF(src) + /// verbs that send information from the browser UI /client/verb/set_tab(tab as text|null) set name = "Set Tab" diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2_parser.dm b/code/modules/admin/verbs/SDQL2/SDQL_2_parser.dm index 64d0c0001..a3cbb1870 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2_parser.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2_parser.dm @@ -59,7 +59,7 @@ /datum/SDQL_parser/proc/parse_error(error_message) error = 1 - to_chat(usr, "SQDL2 Parsing Error: [error_message]") + to_chat(usr, "SDQL2 Parsing Error: [error_message]") return query.len + 1 /datum/SDQL_parser/proc/parse() diff --git a/html/statbrowser.html b/html/statbrowser.html index 8a58d32c4..010424323 100644 --- a/html/statbrowser.html +++ b/html/statbrowser.html @@ -87,7 +87,7 @@ li a:hover:not(.active) { font-size: 12px; margin: 2px 2px; cursor: pointer; - border-radius: 0%; + border-radius: 5%; transition-duration: 0.25s; order: 3; } @@ -146,12 +146,10 @@ li a:hover:not(.active) { .link:hover { text-decoration: underline; } - img { -ms-interpolation-mode: nearest-neighbor; image-rendering: pixelated; } - @@ -250,7 +248,6 @@ if (window.location) { if(e.which) { anti_spam[e.which] = false; var key = String.fromCharCode(e.which); - var x = event.x || event.clientX; var y = event.y || event.clientY; if( x || y ) // if either of these exist this is happening after a click @@ -408,15 +405,6 @@ function findVerbindex(name, verblist) { return i; } } - -function findVerbindex(name, verblist) { - for(var i = 0; i < verblist.length; i++) { - var part = verblist[i]; - if(part[1] == name) - return i; - } -} - function wipe_verbs() { verbs = [["", ""]]; verb_tabs = []; @@ -477,7 +465,7 @@ function init_verbs(c, v) { draw_verbs(current_tab); } } - SendTabToByond(); + SendTabsToByond(); } function SendTabsToByond(){ @@ -605,7 +593,7 @@ function tab_change(tab) { }else if(tab == turfname) { draw_listedturf(); } else { - statcontentdiv[textContentKey] = "loading..."; + statcontentdiv[textContentKey] = "loading..."; } window.location.href = "byond://winset?statbrowser.is-visible=true"; } @@ -717,7 +705,6 @@ function draw_mc() { document.getElementById("statcontent").appendChild(table); } - function update_examine(html,flavour,ooc) { examine_tab_parts = html } @@ -797,7 +784,6 @@ function remove_mobexamine() { tab_change("Status"); } - //turf function create_listedturf(TN) { @@ -994,14 +980,10 @@ function draw_verbs(cat){ function set_theme(which) { if (which == "light") { - document.body.style.backgroundColor = "white"; - document.body.style.color = "black"; document.body.className = ""; set_style_sheet("browserOutput_white"); setCookie("theme", "white", 365); - } else if (which == "dark") { - document.body.style.backgroundColor = "#171717"; - document.body.style.color = "#a4bad6"; + } else if (which == "dark" || which == "default") { document.body.className = "dark"; set_style_sheet("browserOutput"); setCookie("theme", "dark", 365); @@ -1041,6 +1023,7 @@ if(!current_tab) { } window.onload = function() { + checkCookie(); NotifyByondOnload(); }; @@ -1085,6 +1068,5 @@ function getCookie(cname) { return ''; } -