Template progress

This commit is contained in:
atermonera
2018-04-01 15:02:52 -07:00
committed by Atermonera
parent 5cdeab7208
commit 32bca3d9b6
8 changed files with 170 additions and 75 deletions
@@ -117,17 +117,21 @@
if(cartridge) // If there's a cartridge, we need to grab the information from it
data["cart_devices"] = cartridge.get_device_status()
data["cart_templates"] = cartridge.ui_templates
data["cart_info"] = cartridge.get_data()
// update the ui if it exists, returns null if no ui is passed/found
ui = GLOB.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "communicator.tmpl", "Communicator", 475, 700, state = key_state)
data["currentTab"] = 1 // Reset the current tab, because we're going to home page
ui = new(user, src, ui_key, "communicator_header.tmpl", "Communicator", 475, 700, state = key_state)
// add templates for screens in common with communicator.
ui.add_template("atmosphericScan", "atmospheric_scan.tmpl")
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// Append main body
ui.append_template("Body", "communicator.tmpl")
// open the new ui window
ui.open()
// auto update every five Master Controller tick
@@ -254,11 +258,8 @@
if(href_list["switch_template"])
var/datum/nanoui/ui = nanomanager.get_open_ui(usr, src, "main")
if(ui)
switch(href_list["switch_template"])
if("1")
ui.reinitialise("communicator.tmpl")
if("2")
ui.reinitialise("comm2.tmpl")
usr << "Switching to template [href_list["switch_template"]]"
ui.append_template("Body", href_list["switch_template"])
if(href_list["Light"])
fon = !fon
@@ -22,6 +22,9 @@
L[++L.len] = list("name" = I.name, "active" = 0, "index" = i++)
return L
/obj/item/weapon/commcard/proc/get_data()
return list()
/obj/item/weapon/commcard/engineering
name = "\improper Power-ON cartridge"
icon_state = "cart-e"
@@ -45,6 +48,7 @@
/obj/item/weapon/commcard/medical
name = "\improper Med-U cartridge"
icon_state = "cart-m"
ui_templates = list(list("name" = "Medical Records", "template" = "med_records.tmpl"), list("name" = "test", "template" = "comm2.tmpl")) // List of list for when multiple templates
//Med records template
//Med scanner
//Halogen counter
@@ -55,6 +59,27 @@
internal_devices |= new /obj/item/device/halogen_counter(src)
// Add med records template
/obj/item/weapon/commcard/medical/get_data()
var/data[0]
var/records[0]
for(var/datum/data/record/M in sortRecord(data_core.medical))
var/record[0]
record[++record.len] = list("tab" = "Name", "val" = M.fields["name"])
record[++record.len] = list("tab" = "ID", "val" = M.fields["id"])
record[++record.len] = list("tab" = "Blood Type", "val" = M.fields["b_type"])
record[++record.len] = list("tab" = "DNA #", "val" = M.fields["b_dna"])
record[++record.len] = list("tab" = "Gender", "val" = M.fields["id_gender"])
record[++record.len] = list("tab" = "Entity Classification", "val" = M.fields["brain_type"])
record[++record.len] = list("tab" = "Minor Disorders", "val" = M.fields["mi_dis"])
record[++record.len] = list("tab" = "Major Disorders", "val" = M.fields["ma_dis"])
record[++record.len] = list("tab" = "Allergies", "val" = M.fields["alg"])
record[++record.len] = list("tab" = "Condition", "val" = M.fields["cdi"])
record[++record.len] = list("tab" = "Notes", "val" = M.fields["notes"])
records[++records.len] = list("name" = M.fields["name"], "record" = record)
data["records"] = records
return data
/obj/item/weapon/commcard/medical/chemistry
name = "\improper ChemWhiz cartridge"
icon_state = "cart-chem"