PDA NanoUI Optimizations.

Since we no longer have to send data on first UI view we can remove those
checks and only look at the data we need to send when we need to send it.

Also fixed a couple of the links on the status display function.
This commit is contained in:
Ccomp5950
2014-01-08 02:20:14 -06:00
parent 3df123db38
commit 02d8093daa
3 changed files with 21 additions and 65 deletions

View File

@@ -341,8 +341,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
data["idInserted"] = (id ? 1 : 0)
data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------")
data["cartridge"] = null
data["records"] = null
data["cart_loaded"] = cartridge ? 1:0
if(cartridge)
var/cartdata[0]
@@ -403,18 +402,12 @@ var/global/list/obj/item/device/pda/PDAs = list()
data["messagescount"] = null
data["messages"] = null
var/found = 0
if(active_conversation)
for(var/c in tnote)
if(c["target"] == active_conversation)
data["convo_name"] = sanitize(c["owner"])
data["convo_job"] = sanitize(c["job"])
found = 1
break
if(!found)
data["convo_name"] = null
data["convo_job"] = null
if(mode==41)
data["manifest"] = data_core.get_manifest_json()
@@ -444,16 +437,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
"reading" = 1\
)
if(isnull(data["aircontents"]))
data["aircontents"] = list(\
"pressure" = null,\
"nitrogen" = null,\
"oxygen" = null,\
"carbon_dioxide" = null,\
"plasma" = null,\
"other" = null,\
"temp" = null,\
"reading" = 0\
)
data["aircontents"] = list("reading" = 0)
// update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)

View File

@@ -241,14 +241,12 @@
/obj/item/weapon/cartridge/proc/create_NanoUI_values(mob/user as mob)
var/obj/item/device/pda/PDA = loc
var/datum/nanoui/ui = nanomanager.get_open_ui(user, PDA, "main")
var/values[0]
/* Signaler (Mode: 40) */
if(istype(radio,/obj/item/radio/integrated/signal) && (mode==40 || !ui ))
if(istype(radio,/obj/item/radio/integrated/signal) && (mode==40))
var/obj/item/radio/integrated/signal/R = radio
values["signal_freq"] = format_frequency(R.frequency)
values["signal_code"] = R.code
@@ -256,14 +254,14 @@
/* Station Display (Mode: 42) */
if(mode==42 || (!ui && access_status_display))
if(mode==42)
values["message1"] = message1 ? message1 : "(none)"
values["message2"] = message2 ? message2 : "(none)"
/* Power Monitor (Mode: 43 / 433) */
if(mode==43 || mode==433 || (!ui && access_engine))
if(mode==43 || mode==433)
var/pMonData[0]
for(var/obj/machinery/power/monitor/pMon in world)
if(!(pMon.stat & (NOPOWER|BROKEN)) )
@@ -294,30 +292,19 @@
/* General Records (Mode: 44 / 441 / 45 / 451) */
if(mode == 44 || mode == 441 || mode == 45 || mode ==451 || (!ui && (access_medical || access_security)))
if(mode == 44 || mode == 441 || mode == 45 || mode ==451)
if(istype(active1, /datum/data/record) && (active1 in data_core.general))
values["general"] = active1.fields
values["general_exists"] = 1
else
values["general"] = list("name" = null,\
"id" = null,\
"sex" = null,\
"species" = null,\
"age" = null,\
"rank" = null,\
"fingerprint" = null,\
"p_stat" = null,\
"m_stat" = null,\
)
values["general_exists"] = 0
/* Medical Records (Mode: 44 / 441) */
if(mode == 44 || mode == 441 || (!ui && access_medical))
if(mode == 44 || mode == 441)
var/medData[0]
for(var/datum/data/record/R in sortRecord(data_core.general))
medData[++medData.len] = list(Name = R.fields["name"],"ref" = "\ref[R]")
@@ -327,23 +314,11 @@
values["medical"] = active2.fields
values["medical_exists"] = 1
else
values["medical"] = list(\
"b_type" = null,\
"mi_dis" = null,\
"mi_dis_d" = null,\
"ma_dis" = null,\
"ma_dis_d" = null,\
"alg" = null,\
"alg_d" = null,\
"cdi" = null,\
"cdi_d" = null,\
"notes" = null,\
)
values["medical_exists"] = 0
/* Security Records (Mode:45 / 451) */
if(mode == 45 || mode == 451 || (!ui && access_security))
if(mode == 45 || mode == 451)
var/secData[0]
for (var/datum/data/record/R in sortRecord(data_core.general))
secData[++secData.len] = list(Name = R.fields["name"], "ref" = "\ref[R]")
@@ -353,18 +328,11 @@
values["security"] = active3.fields
values["security_exists"] = 1
else
values["security"] = list(\
"criminal" = null,\
"mi_crim" = null,\
"ma_crim" = null,\
"ma_crim_d" = null,\
"notes"\
)
values["security_exists"] = 0
/* Security Bot Control (Mode: 46) */
if(mode==46 || !ui)
if(mode==46)
var/botsData[0]
var/beepskyData[0]
if(istype(radio,/obj/item/radio/integrated/beepsky))
@@ -401,7 +369,7 @@
/* MULEBOT Control (Mode: 48) */
if(mode==48 || !ui)
if(mode==48)
var/muleData[0]
var/mulebotsData[0]
if(istype(radio,/obj/item/radio/integrated/mule))
@@ -441,7 +409,7 @@
/* Supply Shuttle Requests Menu (Mode: 47) */
if(mode==47 || (!ui && access_quartermaster))
if(mode==47)
var/supplyData[0]
supplyData["shuttle_moving"] = supply_shuttle.moving
supplyData["shuttle_eta"] = supply_shuttle.eta
@@ -476,7 +444,7 @@
/* Janitor Supplies Locator (Mode: 49) */
if(mode==49 || (!ui && access_janitor))
if(mode==49)
var/JaniData[0]
var/turf/cl = get_turf(src)