mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
[READY] [TGUI] Uplinks, PDAs and Power Consoles (Dont question it) (#14403)
* Uplinks * Main menu + Status display control * Signaler + Homescreen Fixes * TGUI Power Monitors * PDA Power Monitor * PDA Medical Records * PDA Security Records * PDA Secbot Control (Pain) * PDA Mule Control (I hate this system) * PDA Supply Records * PDA Janitor Locator * PDA Notekeeper * PDA Manifest * PDA Atmos Scanner * Steel pass 1 * PDA Messenger * Removes browserPDA-era icons * PDA Nanomob (Why do we still support this thing) * Fixes random power monitor quirk * More steel tweaks * Even more steel tweaks * TM Tweaks Round 1 * \ref --> UID() * Styling
This commit is contained in:
+11
-156
@@ -1,6 +1,9 @@
|
||||
|
||||
//The advanced pea-green monochrome lcd of tomorrow.
|
||||
// EDIT 2020-09-21: We have had NanoUI PDAs for years, and I am now finally TGUI-ing them
|
||||
// They arent pea green trash. I DEFY YOU COMMENTS!!! -aa
|
||||
|
||||
/// Global list of all PDAs in the world
|
||||
GLOBAL_LIST_EMPTY(PDAs)
|
||||
|
||||
|
||||
@@ -22,7 +25,6 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
var/obj/item/cartridge/cartridge = null //current cartridge
|
||||
var/datum/data/pda/app/current_app = null
|
||||
var/datum/data/pda/app/lastapp = null
|
||||
var/ui_tick = 0
|
||||
|
||||
//Secondary variables
|
||||
var/model_name = "Thinktronic 5230 Personal Data Assistant"
|
||||
@@ -47,7 +49,6 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
new/datum/data/pda/app/messenger,
|
||||
new/datum/data/pda/app/manifest,
|
||||
new/datum/data/pda/app/atmos_scanner,
|
||||
new/datum/data/pda/utility/scanmode/notes,
|
||||
new/datum/data/pda/utility/flashlight)
|
||||
var/list/shortcut_cache = list()
|
||||
var/list/shortcut_cat_order = list()
|
||||
@@ -101,92 +102,11 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
if((!istype(over_object, /obj/screen)) && can_use())
|
||||
return attack_self(M)
|
||||
|
||||
/obj/item/pda/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = GLOB.inventory_state)
|
||||
ui_tick++
|
||||
var/datum/nanoui/old_ui = SSnanoui.get_open_ui(user, src, "main")
|
||||
var/auto_update = 1
|
||||
if(!current_app)
|
||||
return
|
||||
|
||||
if(current_app.update == PDA_APP_NOUPDATE && current_app == lastapp)
|
||||
auto_update = 0
|
||||
if(old_ui && (current_app == lastapp && ui_tick % 5 && current_app.update == PDA_APP_UPDATE_SLOW))
|
||||
return
|
||||
|
||||
lastapp = current_app
|
||||
|
||||
var/title = "Personal Data Assistant"
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, 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, "pda.tmpl", title, 630, 600, state = state)
|
||||
ui.set_state_key("pda")
|
||||
|
||||
// open the new ui window
|
||||
ui.open()
|
||||
|
||||
// auto update every Master Controller tick
|
||||
ui.set_auto_update(auto_update)
|
||||
|
||||
/obj/item/pda/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.inventory_state)
|
||||
var/data[0]
|
||||
|
||||
data["owner"] = owner // Who is your daddy...
|
||||
data["ownjob"] = ownjob // ...and what does he do?
|
||||
|
||||
// update list of shortcuts, only if they changed
|
||||
if(!shortcut_cache.len)
|
||||
shortcut_cache = list()
|
||||
shortcut_cat_order = list()
|
||||
var/prog_list = programs.Copy()
|
||||
if(cartridge)
|
||||
prog_list |= cartridge.programs
|
||||
|
||||
for(var/A in prog_list)
|
||||
var/datum/data/pda/P = A
|
||||
|
||||
if(P.hidden)
|
||||
continue
|
||||
var/list/cat
|
||||
if(P.category in shortcut_cache)
|
||||
cat = shortcut_cache[P.category]
|
||||
else
|
||||
cat = list()
|
||||
shortcut_cache[P.category] = cat
|
||||
shortcut_cat_order += P.category
|
||||
cat |= list(list(name = P.name, icon = P.icon, notify_icon = P.notify_icon, ref = "\ref[P]"))
|
||||
|
||||
// force the order of a few core categories
|
||||
shortcut_cat_order = list("General") \
|
||||
+ sortList(shortcut_cat_order - list("General", "Scanners", "Utilities")) \
|
||||
+ list("Scanners", "Utilities")
|
||||
|
||||
data["idInserted"] = (id ? 1 : 0)
|
||||
data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------")
|
||||
|
||||
data["useRetro"] = retro_mode
|
||||
|
||||
data["cartridge_name"] = cartridge ? cartridge.name : ""
|
||||
data["stationTime"] = station_time_timestamp()
|
||||
|
||||
data["app"] = list()
|
||||
current_app.update_ui(user, data)
|
||||
data["app"] |= list(
|
||||
"name" = current_app.title,
|
||||
"icon" = current_app.icon,
|
||||
"template" = current_app.template,
|
||||
"has_back" = current_app.has_back)
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/pda/attack_self(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
if(active_uplink_check(user))
|
||||
return
|
||||
ui_interact(user) //NanoUI requires this proc
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/item/pda/proc/start_program(datum/data/pda/P)
|
||||
if(P && ((P in programs) || (cartridge && (P in cartridge.programs))))
|
||||
@@ -212,79 +132,8 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
var/datum/data/pda/P = A
|
||||
P.pda = src
|
||||
|
||||
/obj/item/pda/Topic(href, href_list)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/user = usr
|
||||
var/datum/nanoui/ui = SSnanoui.get_open_ui(user, src, "main")
|
||||
var/mob/living/U = usr
|
||||
if(usr.stat == DEAD)
|
||||
return 0
|
||||
if(!can_use()) //Why reinvent the wheel? There's a proc that does exactly that.
|
||||
U.unset_machine()
|
||||
if(ui)
|
||||
ui.close()
|
||||
return 0
|
||||
|
||||
add_fingerprint(U)
|
||||
U.set_machine(src)
|
||||
|
||||
if(href_list["radiomenu"] && !isnull(cartridge) && !isnull(cartridge.radio))
|
||||
cartridge.radio.Topic(href, href_list)
|
||||
return 1
|
||||
|
||||
. = 1
|
||||
|
||||
switch(href_list["choice"])
|
||||
if("Home")//Go home, largely replaces the old Return
|
||||
var/datum/data/pda/app/main_menu/A = find_program(/datum/data/pda/app/main_menu)
|
||||
if(A)
|
||||
start_program(A)
|
||||
if("StartProgram")
|
||||
if(href_list["program"])
|
||||
var/datum/data/pda/app/A = locate(href_list["program"])
|
||||
if(A)
|
||||
start_program(A)
|
||||
if("Eject")//Ejects the cart, only done from hub.
|
||||
if(!isnull(cartridge))
|
||||
var/turf/T = loc
|
||||
if(ismob(T))
|
||||
T = T.loc
|
||||
var/obj/item/cartridge/C = cartridge
|
||||
C.forceMove(T)
|
||||
if(scanmode in C.programs)
|
||||
scanmode = null
|
||||
if(current_app in C.programs)
|
||||
start_program(find_program(/datum/data/pda/app/main_menu))
|
||||
if(C.radio)
|
||||
C.radio.hostpda = null
|
||||
for(var/datum/data/pda/P in notifying_programs)
|
||||
if(P in C.programs)
|
||||
P.unnotify()
|
||||
cartridge = null
|
||||
update_shortcuts()
|
||||
if("Authenticate")//Checks for ID
|
||||
id_check(usr, 1)
|
||||
if("Retro")
|
||||
retro_mode = !retro_mode
|
||||
if("Ringtone")
|
||||
return set_ringtone()
|
||||
else
|
||||
if(current_app)
|
||||
. = current_app.Topic(href, href_list)
|
||||
|
||||
//EXTRA FUNCTIONS===================================
|
||||
if((honkamt > 0) && (prob(60)))//For clown virus.
|
||||
honkamt--
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
|
||||
|
||||
return // return 1 tells it to refresh the UI in NanoUI
|
||||
|
||||
/obj/item/pda/proc/close(mob/user)
|
||||
var/datum/nanoui/ui = SSnanoui.get_open_ui(user, src, "main")
|
||||
ui.close()
|
||||
SStgui.close_uis(src)
|
||||
|
||||
/obj/item/pda/verb/verb_reset_pda()
|
||||
set category = "Object"
|
||||
@@ -299,6 +148,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
notifying_programs.Cut()
|
||||
overlays -= image('icons/obj/pda.dmi', "pda-r")
|
||||
to_chat(usr, "<span class='notice'>You press the reset button on \the [src].</span>")
|
||||
SStgui.update_uis(src)
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You cannot do this while restrained.</span>")
|
||||
|
||||
@@ -327,6 +177,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
var/mob/M = loc
|
||||
M.put_in_hands(id)
|
||||
to_chat(user, "<span class='notice'>You remove the ID from the [name].</span>")
|
||||
SStgui.update_uis(src)
|
||||
else
|
||||
id.forceMove(get_turf(src))
|
||||
overlays -= image('icons/goonstation/objects/pda_overlay.dmi', id.icon_state)
|
||||
@@ -403,6 +254,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
cartridge.update_programs(src)
|
||||
update_shortcuts()
|
||||
to_chat(user, "<span class='notice'>You insert [cartridge] into [src].</span>")
|
||||
SStgui.update_uis(src)
|
||||
if(cartridge.radio)
|
||||
cartridge.radio.hostpda = src
|
||||
|
||||
@@ -417,6 +269,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
ownrank = idcard.rank
|
||||
name = "PDA-[owner] ([ownjob])"
|
||||
to_chat(user, "<span class='notice'>Card scanned.</span>")
|
||||
SStgui.update_uis(src)
|
||||
else
|
||||
//Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand.
|
||||
if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
|
||||
@@ -424,12 +277,14 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
id_check(user, 2)
|
||||
to_chat(user, "<span class='notice'>You put the ID into \the [src]'s slot.<br>You can remove it with ALT click.</span>")
|
||||
overlays += image('icons/goonstation/objects/pda_overlay.dmi', C.icon_state)
|
||||
SStgui.update_uis(src)
|
||||
|
||||
else if(istype(C, /obj/item/paicard) && !src.pai)
|
||||
user.drop_item()
|
||||
C.forceMove(src)
|
||||
pai = C
|
||||
to_chat(user, "<span class='notice'>You slot \the [C] into [src].</span>")
|
||||
SStgui.update_uis(src)
|
||||
else if(istype(C, /obj/item/pen))
|
||||
var/obj/item/pen/O = locate() in src
|
||||
if(O)
|
||||
|
||||
Reference in New Issue
Block a user