mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 11:38:12 +01:00
Optimizations of PDA NanoUI
We don't have to process every function every time, should shrink the JSON data pushes as well as sanitize some of the data.
This commit is contained in:
@@ -412,17 +412,24 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
else
|
||||
pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0")))
|
||||
count++
|
||||
|
||||
data["convopdas"] = convopdas
|
||||
data["pdas"] = pdas
|
||||
data["pda_count"] = count
|
||||
data["messagescount"] = tnote.len
|
||||
data["messages"] = tnote
|
||||
|
||||
if(mode==21)
|
||||
data["messagescount"] = tnote.len
|
||||
data["messages"] = tnote
|
||||
else
|
||||
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"] = c["owner"]
|
||||
data["convo_job"] = c["job"]
|
||||
data["convo_name"] = sanitize(c["owner"])
|
||||
data["convo_job"] = sanitize(c["job"])
|
||||
found = 1
|
||||
break
|
||||
if(!found)
|
||||
@@ -435,7 +442,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if(!ui || mode==3)
|
||||
var/turf/T = get_turf_or_move(user.loc)
|
||||
if(!isnull(T))
|
||||
if(!isnull(T) || mode!=3)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
@@ -662,8 +669,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
src.create_message(U, P)
|
||||
if(mode == 2)
|
||||
active_conversation = href_list["target"]
|
||||
mode = 21
|
||||
if(href_list["target"] in conversations) // Need to make sure the message went through, if not welp.
|
||||
active_conversation = href_list["target"]
|
||||
mode = 21
|
||||
|
||||
if("Select Conversation")
|
||||
var/P = href_list["convo"]
|
||||
|
||||
@@ -256,14 +256,14 @@
|
||||
|
||||
/* Station Display (Mode: 42) */
|
||||
|
||||
if(mode==42 || !ui)
|
||||
if(mode==42 || (!ui && access_status_display))
|
||||
values["message1"] = message1 ? message1 : "(none)"
|
||||
values["message2"] = message2 ? message2 : "(none)"
|
||||
|
||||
|
||||
|
||||
/* Power Monitor (Mode: 43 / 433) */
|
||||
if(mode==43 || mode==433 || !ui)
|
||||
if(mode==43 || mode==433 || (!ui && access_engine))
|
||||
var/pMonData[0]
|
||||
for(var/obj/machinery/power/monitor/pMon in world)
|
||||
if(!(pMon.stat & (NOPOWER|BROKEN)) )
|
||||
@@ -294,7 +294,7 @@
|
||||
|
||||
|
||||
/* General Records (Mode: 44 / 441 / 45 / 451) */
|
||||
if(mode == 44 || mode == 441 || mode == 45 || mode ==451 || !ui)
|
||||
if(mode == 44 || mode == 441 || mode == 45 || mode ==451 || (!ui && (access_medical || access_security)))
|
||||
if(istype(active1, /datum/data/record) && (active1 in data_core.general))
|
||||
values["general"] = active1.fields
|
||||
values["general_exists"] = 1
|
||||
@@ -317,7 +317,7 @@
|
||||
|
||||
/* Medical Records (Mode: 44 / 441) */
|
||||
|
||||
if(mode == 44 || mode == 441 || !ui)
|
||||
if(mode == 44 || mode == 441 || (!ui && access_medical))
|
||||
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]")
|
||||
@@ -343,7 +343,7 @@
|
||||
|
||||
/* Security Records (Mode:45 / 451) */
|
||||
|
||||
if(mode == 45 || mode == 451 || !ui)
|
||||
if(mode == 45 || mode == 451 || (!ui && access_security))
|
||||
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]")
|
||||
@@ -441,7 +441,7 @@
|
||||
|
||||
/* Supply Shuttle Requests Menu (Mode: 47) */
|
||||
|
||||
if(mode==47 || !ui)
|
||||
if(mode==47 || (!ui && access_quartermaster))
|
||||
var/supplyData[0]
|
||||
supplyData["shuttle_moving"] = supply_shuttle.moving
|
||||
supplyData["shuttle_eta"] = supply_shuttle.eta
|
||||
@@ -476,7 +476,7 @@
|
||||
|
||||
|
||||
/* Janitor Supplies Locator (Mode: 49) */
|
||||
if(mode==49 || !ui)
|
||||
if(mode==49 || (!ui && access_janitor))
|
||||
var/JaniData[0]
|
||||
var/turf/cl = get_turf(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user