[MIRROR] Check for 516 byond:// hrefs (#9624)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2024-12-12 16:55:48 -07:00
committed by GitHub
parent 65b20a4d5c
commit a967fb3861
210 changed files with 1230 additions and 1399 deletions

View File

@@ -27,8 +27,6 @@
var/new_ident = sanitize_text(tgui_input_text(usr, "Enter a new ident tag.", "Core Control", monitor.core_tag))
if(new_ident && user.Adjacent(src))
monitor.core_tag = new_ident
// id_tag = new_ident
// cur_viewed_device = null
return
/obj/machinery/computer/fusion_core_control/attack_ai(mob/user)
@@ -41,179 +39,6 @@
monitor.tgui_interact(user)
/*
/obj/machinery/computer/fusion_core_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/fusion_core_control/interact(mob/user)
if(stat & (BROKEN|NOPOWER))
user.unset_machine()
user << browse(null, "window=fusion_control")
return
if(!cur_viewed_device || !check_core_status(cur_viewed_device))
cur_viewed_device = null
if(!id_tag)
to_chat(user, span_warning("This console has not been assigned an ident tag. Please contact your system administrator or conduct a manual update with a standard multitool."))
return
if(cur_viewed_device && (cur_viewed_device.id_tag != id_tag || get_dist(src, cur_viewed_device) > scan_range))
cur_viewed_device = null
var/dat = span_bold("Core Control #[id_tag]") + "<BR>"
if(cur_viewed_device)
dat += {"
<a href='?src=\ref[src];goto_scanlist=1'>Back to overview</a><hr>
Device ident '[cur_viewed_device.id_tag]' [cur_viewed_device.owned_field ? span_green("Active") : span_red("Inactive")].<br>
<b>Power status:</b> [cur_viewed_device.avail()]/[cur_viewed_device.active_power_usage] W<br>
<hr>
<b>Field Status:</b> <a href='?src=\ref[src];toggle_active=1'>[cur_viewed_device.owned_field ? span_green("Online") : span_red("Offline")].</a><br>
<b>Reactant Dump:</b> <a href='?src=\ref[src];syphon=1'>[cur_viewed_device.reactant_dump ? span_gren("Active") : span_red("Inactive")].</a><br>
<hr>
<b>Field power density (W.m<sup>-3</sup>):</b><br>
<a href='?src=\ref[src];str=-1000'>----</a>
<a href='?src=\ref[src];str=-100'>--- </a>
<a href='?src=\ref[src];str=-10'>-- </a>
<a href='?src=\ref[src];str=-1'>- </a>
<a href='?src=\ref[src];str=0'>[cur_viewed_device.field_strength]</a>
<a href='?src=\ref[src];str=1'>+ </a>
<a href='?src=\ref[src];str=10'>++ </a>
<a href='?src=\ref[src];str=100'>+++ </a>
<a href='?src=\ref[src];str=1000'>++++</a><hr>
"}
if(cur_viewed_device.owned_field)
dat += {"
<b>Approximate field diameter (m):</b> [cur_viewed_device.owned_field.size]<br>
<b>Field instability:</b> [cur_viewed_device.owned_field.percent_unstable * 100]%<br>
<b>Plasma temperature:</b> [cur_viewed_device.owned_field.plasma_temperature + 295]K<hr>
<b>Fuel:</b><br>
<table><tr><th><b>Name</b></th><th><b>Amount</b></th></tr>
"}
for(var/reagent in cur_viewed_device.owned_field.dormant_reactant_quantities)
dat += "<tr><td>[reagent]</td><td>[cur_viewed_device.owned_field.dormant_reactant_quantities[reagent]]</td></tr>"
dat += "</table><hr>"
else
connected_devices.Cut()
for(var/obj/machinery/power/fusion_core/C in fusion_cores)
if(C.id_tag == id_tag && get_dist(src, C) <= scan_range)
connected_devices += C
for(var/obj/machinery/power/fusion_core/C in gyrotrons)
if(C.id_tag == id_tag && get_dist(src, C) <= scan_range)
connected_devices += C
if(connected_devices.len)
dat += {"
<b>Connected EM field generators:</b><hr>
<table>
<tr>
<th><b>Device tag</b></th>
<th><b>Status</b></th>
<th><b>Controls</b></th>
</tr>
"}
for(var/obj/machinery/power/fusion_core/C in connected_devices)
var/status
var/can_access = 1
if(!check_core_status(C))
status = span_red("Unresponsive")
can_access = 0
else if(C.avail() < C.active_power_usage)
status = span_orange("Underpowered")
else
status = span_green("Good")
dat += {"
<tr>
<td>[C.id_tag]</td>
<td>[status]</td>
"}
if(!can_access)
dat += {"
<td>" + span_red("ERROR") + "</td>
"}
else
dat += {"
<td><a href=?src=\ref[src];access_device=[connected_devices.Find(C)]'>ACCESS</a></td>
"}
dat += {"
</tr>
"}
else
dat += span_red("No electromagnetic field generators connected.")
var/datum/browser/popup = new(user, "fusion_control", name, 500, 400, src)
popup.set_content(dat)
popup.open()
user.set_machine(src)
/obj/machinery/computer/fusion_core_control/Topic(href, href_list)
. = ..()
if(.)
return
if(href_list["access_device"])
var/idx = CLAMP(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
//All HREFs from this point on require a device anyways.
if(!cur_viewed_device || !check_core_status(cur_viewed_device) || cur_viewed_device.id_tag != id_tag || get_dist(src, cur_viewed_device) > scan_range)
return
if(href_list["goto_scanlist"])
cur_viewed_device = null
updateUsrDialog()
return 1
if(href_list["toggle_active"])
if(!cur_viewed_device.Startup()) //Startup() whilst the device is active will return null.
cur_viewed_device.Shutdown()
updateUsrDialog()
return 1
if(href_list["str"])
var/val = text2num(href_list["str"])
if(!val) //Value is 0, which is manual entering.
cur_viewed_device.set_strength(input(usr, "Enter the new field power density (W.m^-3)", "Fusion Control", cur_viewed_device.field_strength) as num)
else
cur_viewed_device.set_strength(cur_viewed_device.field_strength + val)
updateUsrDialog()
return 1
if(href_list["syphon"])
cur_viewed_device.reactant_dump = !cur_viewed_device.reactant_dump
updateUsrDialog()
*/
//Returns 1 if the machine can be interacted with via this console.
/obj/machinery/computer/fusion_core_control/proc/check_core_status(var/obj/machinery/power/fusion_core/C)
return istype(C) ? C.check_core_status() : FALSE
/*
/obj/machinery/computer/fusion_core_control/update_icon()
if(stat & (BROKEN))
icon = 'icons/obj/computer.dmi'
icon_state = "broken"
set_light(0)
if(stat & (NOPOWER))
icon = 'icons/obj/computer.dmi'
icon_state = "computer"
set_light(0)
if(!stat & (BROKEN|NOPOWER))
icon = initial(icon)
icon_state = initial(icon_state)
set_light(light_range_on, light_power_on)
*/

View File

@@ -73,7 +73,7 @@
else
dat += "<td>[I.cur_assembly ? I.cur_assembly.fuel_type : "NONE"]</td>"
if(I.cur_assembly)
dat += "<td><a href='?src=\ref[src];toggle_injecting=\ref[I]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
dat += "<td><a href='byond://?src=\ref[src];toggle_injecting=\ref[I]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
else
dat += "<td>None</td>"
if(I.cur_assembly)
@@ -84,8 +84,8 @@
dat += "</tr>"
dat += {"</table><hr>
<A href='?src=\ref[src];refresh=1'>Refresh</A>
<A href='?src=\ref[src];close=1'>Close</A><BR>"}
<A href='byond://?src=\ref[src];refresh=1'>Refresh</A>
<A href='byond://?src=\ref[src];close=1'>Close</A><BR>"}
var/datum/browser/popup = new(user, "fuel_control", "Fusion Fuel Control Console", 800, 400, src)
popup.set_content(dat)

View File

@@ -65,9 +65,9 @@
dat += "<td>" + span_red("ERROR") + "</td>"
dat += "<td>" + span_red("ERROR") + "</td>"
else
dat += "<td><a href='?src=\ref[src];machine=\ref[G];toggle=1'>[G.active ? "Emitting" : "Standing By"]</a></td>"
dat += "<td><a href='?src=\ref[src];machine=\ref[G];modifyrate=1'>[G.rate]</a></td>"
dat += "<td><a href='?src=\ref[src];machine=\ref[G];modifypower=1'>[G.mega_energy]</a></td>"
dat += "<td><a href='byond://?src=\ref[src];machine=\ref[G];toggle=1'>[G.active ? "Emitting" : "Standing By"]</a></td>"
dat += "<td><a href='byond://?src=\ref[src];machine=\ref[G];modifyrate=1'>[G.rate]</a></td>"
dat += "<td><a href='byond://?src=\ref[src];machine=\ref[G];modifypower=1'>[G.mega_energy]</a></td>"
dat += "</tr></table>"