Add filter/search to protolathe and circuit designs

This commit is contained in:
Aronai Sieyes
2020-05-05 10:41:12 -04:00
parent 3179b741c0
commit b83e893637

View File

@@ -48,6 +48,9 @@ won't update every console in existence) but it's more of a hassle to do. Also,
req_access = list(access_research) //Data and setting manipulation requires scientist access. req_access = list(access_research) //Data and setting manipulation requires scientist access.
var/protofilter //String to filter protolathe designs by
var/circuitfilter //String to filter circuit designs by
/obj/machinery/computer/rdconsole/proc/CallMaterialName(var/ID) /obj/machinery/computer/rdconsole/proc/CallMaterialName(var/ID)
var/return_name = ID var/return_name = ID
switch(return_name) switch(return_name)
@@ -169,7 +172,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
else if(href_list["updt_tech"]) //Update the research holder with information from the technology disk. else if(href_list["updt_tech"]) //Update the research holder with information from the technology disk.
screen = 0.0 screen = 0.0
spawn(50) spawn(5 SECONDS)
screen = 1.2 screen = 1.2
files.AddTech2Known(t_disk.stored) files.AddTech2Known(t_disk.stored)
updateUsrDialog() updateUsrDialog()
@@ -192,7 +195,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
else if(href_list["updt_design"]) //Updates the research holder with design data from the design disk. else if(href_list["updt_design"]) //Updates the research holder with design data from the design disk.
screen = 0.0 screen = 0.0
spawn(50) spawn(5 SECONDS)
screen = 1.4 screen = 1.4
files.AddDesign2Known(d_disk.blueprint) files.AddDesign2Known(d_disk.blueprint)
updateUsrDialog() updateUsrDialog()
@@ -235,7 +238,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
screen = 0.1 screen = 0.1
updateUsrDialog() updateUsrDialog()
flick("d_analyzer_process", linked_destroy) flick("d_analyzer_process", linked_destroy)
spawn(24) spawn(2.4 SECONDS)
if(linked_destroy) if(linked_destroy)
linked_destroy.busy = 0 linked_destroy.busy = 0
if(!linked_destroy.loaded_item) if(!linked_destroy.loaded_item)
@@ -283,7 +286,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
to_chat(usr, "<span class='notice'>You must connect to the network first.</span>") to_chat(usr, "<span class='notice'>You must connect to the network first.</span>")
else else
griefProtection() //Putting this here because I dont trust the sync process griefProtection() //Putting this here because I dont trust the sync process
spawn(30) spawn(3 SECONDS)
if(src) if(src)
for(var/obj/machinery/r_n_d/server/S in machines) for(var/obj/machinery/r_n_d/server/S in machines)
var/server_processed = 0 var/server_processed = 0
@@ -331,7 +334,26 @@ won't update every console in existence) but it's more of a hassle to do. Also,
linked_lathe.addToQueue(being_built) linked_lathe.addToQueue(being_built)
screen = 3.1 screen = 3.1
updateUsrDialog()
else if(href_list["protofilter"])
var/filterstring = input(usr, "Input a filter string, or blank to not filter:", "Design Filter", protofilter) as null|text
if(!Adjacent(usr))
return
if(isnull(filterstring)) //Clicked Cancel
return
if(filterstring == "") //Cleared value
protofilter = null
protofilter = sanitize(filterstring, 25)
else if(href_list["circuitfilter"])
var/filterstring = input(usr, "Input a filter string, or blank to not filter:", "Design Filter", circuitfilter) as null|text
if(!Adjacent(usr))
return
if(isnull(filterstring)) //Clicked Cancel
return
if(filterstring == "") //Cleared value
circuitfilter = null
circuitfilter = sanitize(filterstring, 25)
else if(href_list["imprint"]) //Causes the Circuit Imprinter to build something. else if(href_list["imprint"]) //Causes the Circuit Imprinter to build something.
if(linked_imprinter) if(linked_imprinter)
@@ -343,7 +365,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(being_built) if(being_built)
linked_imprinter.addToQueue(being_built) linked_imprinter.addToQueue(being_built)
screen = 4.1 screen = 4.1
updateUsrDialog()
else if(href_list["disposeI"] && linked_imprinter) //Causes the circuit imprinter to dispose of a single reagent (all of it) else if(href_list["disposeI"] && linked_imprinter) //Causes the circuit imprinter to dispose of a single reagent (all of it)
linked_imprinter.reagents.del_reagent(href_list["dispose"]) linked_imprinter.reagents.del_reagent(href_list["dispose"])
@@ -649,9 +670,12 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<B>Material Amount:</B> [linked_lathe.TotalMaterials()] cm<sup>3</sup> (MAX: [linked_lathe.max_material_storage])<BR>" dat += "<B>Material Amount:</B> [linked_lathe.TotalMaterials()] cm<sup>3</sup> (MAX: [linked_lathe.max_material_storage])<BR>"
dat += "<B>Chemical Volume:</B> [linked_lathe.reagents.total_volume] (MAX: [linked_lathe.reagents.maximum_volume])<HR>" dat += "<B>Chemical Volume:</B> [linked_lathe.reagents.total_volume] (MAX: [linked_lathe.reagents.maximum_volume])<HR>"
dat += "<UL>" dat += "<UL>"
dat += "<B>Filter:</B> <A href='?src=\ref[src];protofilter=1'>[protofilter ? protofilter : "None Set"]</A>"
for(var/datum/design/D in files.known_designs) for(var/datum/design/D in files.known_designs)
if(!D.build_path || !(D.build_type & PROTOLATHE)) if(!D.build_path || !(D.build_type & PROTOLATHE))
continue continue
if(protofilter && findtext(D.name, protofilter) == 0)
continue
var/temp_dat var/temp_dat
for(var/M in D.materials) for(var/M in D.materials)
temp_dat += ", [D.materials[M]*linked_lathe.mat_efficiency] [CallMaterialName(M)]" temp_dat += ", [D.materials[M]*linked_lathe.mat_efficiency] [CallMaterialName(M)]"
@@ -732,9 +756,12 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "Material Amount: [linked_imprinter.TotalMaterials()] cm<sup>3</sup><BR>" dat += "Material Amount: [linked_imprinter.TotalMaterials()] cm<sup>3</sup><BR>"
dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]<HR>" dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]<HR>"
dat += "<UL>" dat += "<UL>"
dat += "<B>Filter:</B> <A href='?src=\ref[src];circuitfilter=1'>[circuitfilter ? circuitfilter : "None Set"]</A>"
for(var/datum/design/D in files.known_designs) for(var/datum/design/D in files.known_designs)
if(!D.build_path || !(D.build_type & IMPRINTER)) if(!D.build_path || !(D.build_type & IMPRINTER))
continue continue
if(circuitfilter && findtext(D.name, circuitfilter) == 0)
continue
var/temp_dat var/temp_dat
for(var/M in D.materials) for(var/M in D.materials)
temp_dat += ", [D.materials[M]*linked_imprinter.mat_efficiency] [CallMaterialName(M)]" temp_dat += ", [D.materials[M]*linked_imprinter.mat_efficiency] [CallMaterialName(M)]"