From a6b70bc8b4e0e64c476162c5624925d0775ec76c Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Wed, 8 Jan 2014 02:20:14 -0600 Subject: [PATCH] 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. Conflicts: code/game/objects/items/devices/PDA/PDA.dm code/game/objects/items/devices/PDA/cart.dm --- code/game/objects/items/devices/PDA/PDA.dm | 21 ++------- code/game/objects/items/devices/PDA/cart.dm | 51 ++++----------------- nano/templates/pda.tmpl | 14 ++++-- 3 files changed, 22 insertions(+), 64 deletions(-) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 37ab42d4727..8d83a35f3d0 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -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] @@ -402,18 +401,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() @@ -443,16 +436,8 @@ 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 diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index ceeeb977c3e..cbbf4bcda20 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -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,20 @@ /* 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 +315,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 +329,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 +370,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 +410,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 +445,7 @@ /* Janitor Supplies Locator (Mode: 49) */ - if(mode==49 || (!ui && access_janitor)) + if(mode==49) var/JaniData[0] var/turf/cl = get_turf(src) diff --git a/nano/templates/pda.tmpl b/nano/templates/pda.tmpl index 5db42ce35cd..3f7ee3d3146 100644 --- a/nano/templates/pda.tmpl +++ b/nano/templates/pda.tmpl @@ -49,7 +49,11 @@ Used In File(s): \code\game\objects\items\devices\PDA\PDA.dm Cartridge:
- {{:~link(cartridge ? cartridge.name : 'no cartridge', 'eject', {'choice' : "Eject"}, cartridge ? null : 'disabled', cartridge ? null : 'fixedLeft')}} + {{if cart_loaded==1}} + {{:~link(cartridge.name, 'eject', {'choice' : "Eject"},null,null)}} + {{else}} + {{:~link('None', 'eject', {'choice' : "Eject"},'disabled',null)}} + {{/if}}
@@ -469,10 +473,10 @@ Used In File(s): \code\game\objects\items\devices\PDA\PDA.dm ALERT!:
- {{:~link('None', 'alert', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'default' : "alert"}, null, null)}} - {{:~link('Alert', 'alert', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "alert"}, null, null)}} - {{:~link('Lockdown', 'caution', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "alert"}, null, null)}} - {{:~link('Biohazard', 'radiation', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "alert"}, null, null)}} + {{:~link('None', 'alert', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "default"}, null, null)}} + {{:~link('Red Alert', 'alert', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "redalert"}, null, null)}} + {{:~link('Lockdown', 'caution', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "lockdown"}, null, null)}} + {{:~link('Biohazard', 'radiation', {'cartmenu' : "1", 'choice' : "Status",'statdisp' : "alert", 'alert' : "biohazard"}, null, null)}}