Chemistry codex - VueUI edition (#9413)

Mostly contains fuzzy search what should make search experence nice and responsive. Data generation assumes rections do not change.
This commit is contained in:
Karolis
2020-07-25 22:27:01 +03:00
committed by GitHub
parent 4f1b29f629
commit 7cbc3bd952
8 changed files with 196 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
/datum/computer_file/program/chemistry_codex
filename = "chemcodex"
filedesc = "Chemistry codex"
program_icon_state = "generic"
extended_desc = "Useful program to view chemical reactions and how to make them."
size = 14
required_access_run = access_medical
required_access_download = access_medical
available_on_ntnet = TRUE
/datum/computer_file/program/chemistry_codex/ui_interact(mob/user)
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
if (!ui)
ui = new /datum/vueui/modularcomputer(user, src, "mcomputer-chemcodex", 450, 600, filedesc)
ui.open()
/datum/computer_file/program/chemistry_codex/vueui_transfer(oldobj)
SSvueui.transfer_uis(oldobj, src, "mcomputer-chemcodex", 450, 600, filedesc)
return TRUE
// Gathers data for ui. This is not great vueui example, all data sent from server is static.
/datum/computer_file/program/chemistry_codex/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
. = ..()
data = . || data || list()
// Gather data for computer header
var/headerdata = get_header_data(data["_PC"])
if(headerdata)
data["_PC"] = headerdata
. = data
// Here goes listification
if(data["reactions"] == null)
. = data
data["reactions"] = SSchemistry.codex_data