mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 13:09:11 +01:00
NANOUI PDA
Creates NanoUI for the PDA and Syndicate Uplink. New features: Crew manifest now sorted with department heads at the top. Can select individual conversations and delete individual conversations among PDA's Powernet Monitor much more simple now and easier to read. Janitorial supplies locator now includes Janicart. Items will actually refresh if you click "Refresh" Some other changes: Captain's PDA cartridge now has all access (added janitor access and quartermaster access) With the conversation change I had to change how tnote (the variable that holds PDA messages works. Setup the message server to use the new methods. Removed procs that will no longer be used (UI generation procs from old UI methods) Commented everything the best I can. Created HORRIBLE, TERRIBLE lists. But it's pretty much required because that's how nanoUI rolls. Created a variable on the uplink called NanoUI items, this list is created upon creation of the uplink. I included the functionality for Mimes and Clowns for our downstream servers that have those.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
//The advanced pea-green monochrome lcd of tomorrow.
|
||||
|
||||
var/global/list/obj/item/device/pda/PDAs = list()
|
||||
@@ -25,7 +26,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
var/f_lum = 2 //Luminosity for the flashlight function
|
||||
var/silent = 0 //To beep or not to beep, that is the question
|
||||
var/toff = 0 //If 1, messenger disabled
|
||||
var/tnote = null //Current Texts
|
||||
var/tnote[0] //Current Texts
|
||||
var/last_text //No text spamming
|
||||
var/last_honk //Also no honk spamming that's bad too
|
||||
var/ttone = "beep" //The ringtone!
|
||||
@@ -37,7 +38,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
var/cart = "" //A place to stick cartridge menu information
|
||||
var/detonate = 1 // Can the PDA be blown up?
|
||||
var/hidden = 0 // Is the PDA hidden from the PDA list?
|
||||
|
||||
var/active_conversation = null // New variable that allows us to only view a single conversation.
|
||||
var/list/conversations = list() // For keeping up with who we have PDA messsages from.
|
||||
var/newmessage = 0 //To remove hackish overlay check
|
||||
|
||||
var/obj/item/weapon/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both.
|
||||
var/ownjob = null //related to above
|
||||
|
||||
@@ -242,7 +246,13 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if(usr.stat == 2)
|
||||
usr << "You can't do that because you are dead!"
|
||||
return
|
||||
var/HTML = "<html><head><title>AI PDA Message Log</title></head><body>[tnote]</body></html>"
|
||||
var/HTML = "<html><head><title>AI PDA Message Log</title></head><body>"
|
||||
for(var/index in tnote)
|
||||
if(index["sent"])
|
||||
HTML += addtext("<i><b>→ To <a href='byond://?src=\ref[src];choice=Message;target=",index["src"],"'>", index["owner"],"</a>:</b></i><br>", index["message"], "<br>")
|
||||
else
|
||||
HTML += addtext("<i><b>← From <a href='byond://?src=\ref[src];choice=Message;target=",index["target"],"'>", index["owner"],"</a>:</b></i><br>", index["message"], "<br>")
|
||||
HTML +="</body></html>"
|
||||
usr << browse(HTML, "window=log;size=400x444;border=1;can_resize=1;can_close=1;can_minimize=0")
|
||||
|
||||
|
||||
@@ -309,6 +319,172 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
return attack_self(M)
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
/* Notes for those wanting to modify this code or even understand it.
|
||||
There are two modes: New UI and a UI already existing.
|
||||
If the UI is new, you define your variables, if the ui already exists if it didn't have variables in data for what you want to add
|
||||
then it won't add it even if you make a data["blahblah"] for it. That's the reason for the = null all over the place, so that.
|
||||
ui.push_data(data) proc has to have the var structure already setup otherwise it can't push the update.
|
||||
|
||||
The exception to the "YOU HAVE TO DEFINE IT" rule is cartridges, we later force
|
||||
the ui to close if a cartridge is inserted so that never will be a problem.
|
||||
So there will never be a time a UI creation causes that to be a problem.
|
||||
*/
|
||||
|
||||
/obj/item/device/pda/ui_interact(mob/user, ui_key = "main")
|
||||
var/title = "Personal Data Assistant"
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
|
||||
var/data[0] // This is the data that will be sent to the PDA
|
||||
|
||||
|
||||
data["owner"] = owner // Who is your daddy...
|
||||
data["ownjob"] = ownjob // ...and what does he do?
|
||||
|
||||
data["mode"] = mode // The current view
|
||||
data["scanmode"] = scanmode // Scanners
|
||||
data["fon"] = fon // Flashlight on?
|
||||
data["pai"] = (isnull(pai) ? 0 : 1) // pAI inserted?
|
||||
data["note"] = note // current pda notes
|
||||
data["silent"] = silent // does the pda make noise when it receives a message?
|
||||
data["toff"] = toff // is the messenger function turned off?
|
||||
data["active_conversation"] = active_conversation // Which conversation are we following right now?
|
||||
|
||||
|
||||
data["idInserted"] = (id ? 1 : 0)
|
||||
data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------")
|
||||
|
||||
|
||||
if(cartridge)
|
||||
var/cartdata[0]
|
||||
|
||||
|
||||
data["records"] = cartridge.create_NanoUI_values()
|
||||
|
||||
|
||||
cartdata["name"] = cartridge.name
|
||||
cartdata["access"] = list(\
|
||||
"access_security" = cartridge.access_security,\
|
||||
"access_engine" = cartridge.access_engine,\
|
||||
"access_atmos" = cartridge.access_atmos,\
|
||||
"access_medical" = cartridge.access_medical,\
|
||||
"access_clown" = cartridge.access_clown,\
|
||||
"access_mime" = cartridge.access_mime,\
|
||||
"access_janitor" = cartridge.access_janitor,\
|
||||
"access_quartermaster" = cartridge.access_quartermaster,\
|
||||
"access_hydroponics" = cartridge.access_hydroponics,\
|
||||
"access_reagent_scanner" = cartridge.access_reagent_scanner,\
|
||||
"access_remote_door" = cartridge.access_remote_door,\
|
||||
"access_status_display" = cartridge.access_status_display\
|
||||
)
|
||||
if(isnull(cartridge.radio))
|
||||
cartdata["radio"] = 0
|
||||
else
|
||||
if(istype(cartridge.radio, /obj/item/radio/integrated/beepsky))
|
||||
cartdata["radio"] = 1
|
||||
if(istype(cartridge.radio, /obj/item/radio/integrated/signal))
|
||||
cartdata["radio"] = 2
|
||||
if(istype(cartridge.radio, /obj/item/radio/integrated/mule))
|
||||
cartdata["radio"] = 3
|
||||
|
||||
cartdata["type"] = cartridge.type
|
||||
cartdata["charges"] = cartridge.charges ? cartridge.charges : 0
|
||||
data["cartridge"] = cartdata
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
data["stationTime"] = worldtime2text()
|
||||
data["newMessage"] = newmessage
|
||||
|
||||
|
||||
|
||||
var/convopdas[0]
|
||||
var/pdas[0]
|
||||
var/count = 0
|
||||
for (var/obj/item/device/pda/P in sortAtom(PDAs))
|
||||
if (!P.owner||P.toff||P == src||P.hidden) continue
|
||||
if(conversations.Find("\ref[P]"))
|
||||
convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1")))
|
||||
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
|
||||
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"]
|
||||
found = 1
|
||||
break
|
||||
if(!found)
|
||||
data["convo_name"] = null
|
||||
data["convo_job"] = null
|
||||
|
||||
if(!ui || mode==41)
|
||||
data["manifest"] = data_core.get_manifest_json()
|
||||
|
||||
|
||||
if(!ui || mode==3)
|
||||
var/turf/T = get_turf_or_move(user.loc)
|
||||
if(!isnull(T))
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
|
||||
if (total_moles)
|
||||
var/o2_level = environment.oxygen/total_moles
|
||||
var/n2_level = environment.nitrogen/total_moles
|
||||
var/co2_level = environment.carbon_dioxide/total_moles
|
||||
var/plasma_level = environment.toxins/total_moles
|
||||
var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
|
||||
data["aircontents"] = list(\
|
||||
"pressure" = "[round(pressure,0.1)]",\
|
||||
"nitrogen" = "[round(n2_level*100,0.1)]",\
|
||||
"oxygen" = "[round(o2_level*100,0.1)]",\
|
||||
"carbon_dioxide" = "[round(co2_level*100,0.1)]",\
|
||||
"plasma" = "[round(plasma_level*100,0.01)]",\
|
||||
"other" = "[round(unknown_level, 0.01)]",\
|
||||
"temp" = "[round(environment.temperature-T0C,0.1)]",\
|
||||
"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\
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new one
|
||||
ui = new(user, src, ui_key, "pda.tmpl", title, 630, 600)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
else
|
||||
// The UI is already open so push the new data to it
|
||||
ui.push_data(data)
|
||||
return
|
||||
|
||||
|
||||
|
||||
//NOTE: graphic resources are loaded on client login
|
||||
/obj/item/device/pda/attack_self(mob/user as mob)
|
||||
|
||||
@@ -317,203 +493,21 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if(active_uplink_check(user))
|
||||
return
|
||||
|
||||
var/dat = "<html><head><title>Personal Data Assistant</title></head><body bgcolor=\"#808000\"><style>a, a:link, a:visited, a:active, a:hover { color: #000000; }img {border-style:none;}</style>"
|
||||
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Close'><img src=pda_exit.png> Close</a>"
|
||||
|
||||
if ((!isnull(cartridge)) && (mode == 0))
|
||||
dat += " | <a href='byond://?src=\ref[src];choice=Eject'><img src=pda_eject.png> Eject [cartridge]</a>"
|
||||
if (mode)
|
||||
dat += " | <a href='byond://?src=\ref[src];choice=Return'><img src=pda_menu.png> Return</a>"
|
||||
dat += " | <a href='byond://?src=\ref[src];choice=Refresh'><img src=pda_refresh.png> Refresh</a>"
|
||||
|
||||
dat += "<br>"
|
||||
|
||||
if (!owner)
|
||||
dat += "Warning: No owner information entered. Please swipe card.<br><br>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Refresh'><img src=pda_refresh.png> Retry</a>"
|
||||
else
|
||||
switch (mode)
|
||||
if (0)
|
||||
dat += "<h2>PERSONAL DATA ASSISTANT v.1.2</h2>"
|
||||
dat += "Owner: [owner], [ownjob]<br>"
|
||||
dat += text("ID: <A href='?src=\ref[src];choice=Authenticate'>[id ? "[id.registered_name], [id.assignment]" : "----------"]")
|
||||
dat += text("<br><A href='?src=\ref[src];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br>")
|
||||
|
||||
dat += "Station Time: [worldtime2text()]"//:[world.time / 100 % 6][world.time / 100 % 10]"
|
||||
|
||||
dat += "<br><br>"
|
||||
|
||||
dat += "<h4>General Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=1'><img src=pda_notes.png> Notekeeper</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=2'><img src=pda_mail.png> Messenger</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=41'><img src=pda_notes.png> View Crew Manifest</a></li>"
|
||||
//dat += "<li><a href='byond://?src=\red[src];choice=chatroom'><img src=pda_chatroom.png> Nanotrasen Relay Chat</a></li>"
|
||||
|
||||
if (cartridge)
|
||||
if (cartridge.access_clown)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Honk'><img src=pda_honk.png> Honk Synthesizer</a></li>"
|
||||
if(cartridge.access_status_display)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=42'><img src=pda_status.png> Set Status Display</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_engine)
|
||||
dat += "<h4>Engineering Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=43'><img src=pda_power.png> Power Monitor</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_medical)
|
||||
dat += "<h4>Medical Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=44'><img src=pda_medical.png> Medical Records</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Medical Scan'><img src=pda_scanner.png> [scanmode == 1 ? "Disable" : "Enable"] Medical Scanner</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_security)
|
||||
dat += "<h4>Security Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=45'><img src=pda_cuffs.png> Security Records</A></li>"
|
||||
if(istype(cartridge.radio, /obj/item/radio/integrated/beepsky))
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=46'><img src=pda_cuffs.png> Security Bot Access</a></li>"
|
||||
dat += "</ul>"
|
||||
else dat += "</ul>"
|
||||
if(cartridge.access_quartermaster)
|
||||
dat += "<h4>Quartermaster Functions:</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=47'><img src=pda_crate.png> Supply Records</A></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=48'><img src=pda_mule.png> Delivery Bot Control</A></li>"
|
||||
dat += "</ul>"
|
||||
dat += "</ul>"
|
||||
|
||||
dat += "<h4>Utilities</h4>"
|
||||
dat += "<ul>"
|
||||
if (cartridge)
|
||||
if (cartridge.access_janitor)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=49'><img src=pda_bucket.png> Custodial Locator</a></li>"
|
||||
if (istype(cartridge.radio, /obj/item/radio/integrated/signal))
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=40'><img src=pda_signaler.png> Signaler System</a></li>"
|
||||
if (cartridge.access_reagent_scanner)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Reagent Scan'><img src=pda_reagent.png> [scanmode == 3 ? "Disable" : "Enable"] Reagent Scanner</a></li>"
|
||||
if (cartridge.access_engine)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Halogen Counter'><img src=pda_reagent.png> [scanmode == 4 ? "Disable" : "Enable"] Halogen Counter</a></li>"
|
||||
if (cartridge.access_atmos)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Gas Scan'><img src=pda_reagent.png> [scanmode == 5 ? "Disable" : "Enable"] Gas Scanner</a></li>"
|
||||
if (cartridge.access_remote_door)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Toggle Door'><img src=pda_rdoor.png> Toggle Remote Door</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=3'><img src=pda_atmos.png> Atmospheric Scan</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Light'><img src=pda_flashlight.png> [fon ? "Disable" : "Enable"] Flashlight</a></li>"
|
||||
if (pai)
|
||||
if(pai.loc != src)
|
||||
pai = null
|
||||
else
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=pai;option=1'>pAI Device Configuration</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=pai;option=2'>Eject pAI Device</a></li>"
|
||||
dat += "</ul>"
|
||||
|
||||
if (1)
|
||||
dat += "<h4><img src=pda_notes.png> Notekeeper V2.1</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Edit'> Edit</a><br>"
|
||||
dat += note
|
||||
|
||||
if (2)
|
||||
dat += "<h4><img src=pda_mail.png> SpaceMessenger V3.9.4</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Toggle Ringer'><img src=pda_bell.png> Ringer: [silent == 1 ? "Off" : "On"]</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Toggle Messenger'><img src=pda_mail.png> Send / Receive: [toff == 1 ? "Off" : "On"]</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Ringtone'><img src=pda_bell.png> Set Ringtone</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=21'><img src=pda_mail.png> Messages</a><br>"
|
||||
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/syndicate))
|
||||
dat += "<b>[cartridge:shock_charges] detonation charges left.</b><HR>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/clown))
|
||||
dat += "<b>[cartridge:honk_charges] viral files left.</b><HR>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
dat += "<b>[cartridge:mime_charges] viral files left.</b><HR>"
|
||||
|
||||
dat += "<h4><img src=pda_menu.png> Detected PDAs</h4>"
|
||||
|
||||
dat += "<ul>"
|
||||
|
||||
var/count = 0
|
||||
|
||||
if (!toff)
|
||||
for (var/obj/item/device/pda/P in sortAtom(PDAs))
|
||||
if (!P.owner||P.toff||P == src||P.hidden) continue
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Message;target=\ref[P]'>[P]</a>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/syndicate) && P.detonate)
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Detonate;target=\ref[P]'><img src=pda_boom.png>*Detonate*</a>)"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/clown))
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Send Honk;target=\ref[P]'><img src=pda_honk.png>*Send Virus*</a>)"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Send Silence;target=\ref[P]'>*Send Virus*</a>)"
|
||||
dat += "</li>"
|
||||
count++
|
||||
dat += "</ul>"
|
||||
if (count == 0)
|
||||
dat += "None detected.<br>"
|
||||
|
||||
if(21)
|
||||
dat += "<h4><img src=pda_mail.png> SpaceMessenger V3.9.4</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Clear'><img src=pda_blank.png> Clear Messages</a>"
|
||||
|
||||
dat += "<h4><img src=pda_mail.png> Messages</h4>"
|
||||
|
||||
dat += tnote
|
||||
dat += "<br>"
|
||||
|
||||
if (3)
|
||||
dat += "<h4><img src=pda_atmos.png> Atmospheric Readings</h4>"
|
||||
|
||||
var/turf/T = get_turf_or_move(user.loc)
|
||||
if (isnull(T))
|
||||
dat += "Unable to obtain a reading.<br>"
|
||||
else
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
if (total_moles)
|
||||
var/o2_level = environment.oxygen/total_moles
|
||||
var/n2_level = environment.nitrogen/total_moles
|
||||
var/co2_level = environment.carbon_dioxide/total_moles
|
||||
var/plasma_level = environment.toxins/total_moles
|
||||
var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
|
||||
dat += "Nitrogen: [round(n2_level*100)]%<br>"
|
||||
dat += "Oxygen: [round(o2_level*100)]%<br>"
|
||||
dat += "Carbon Dioxide: [round(co2_level*100)]%<br>"
|
||||
dat += "Plasma: [round(plasma_level*100)]%<br>"
|
||||
if(unknown_level > 0.01)
|
||||
dat += "OTHER: [round(unknown_level)]%<br>"
|
||||
dat += "Temperature: [round(environment.temperature-T0C)]°C<br>"
|
||||
dat += "<br>"
|
||||
|
||||
if (5)
|
||||
dat += "<h4><img src=pda_chatroom.png> Nanotrasen Relay Chat</h4>"
|
||||
|
||||
dat += "<h4><img src=pda_menu.png> Detected Channels</h4>: <li>"
|
||||
for(var/datum/chatroom/C in chatrooms)
|
||||
dat += "<a href='byond://?src=\ref[src];pdachannel=[C.name]'>#[html_encode(lowertext(C.name))]"
|
||||
if(C.password != "")
|
||||
dat += " <img src=pda_locked.png>"
|
||||
dat += "</li>"
|
||||
|
||||
if (41) //crew manifest
|
||||
dat += "<h4><img src=pda_notes.png> Crew Manifest</h4>"
|
||||
dat += "Entries cannot be modified from this terminal.<br><br>"
|
||||
if(data_core)
|
||||
dat += data_core.get_manifest(1) // make it monochrome
|
||||
dat += "<br>"
|
||||
|
||||
else//Else it links to the cart menu proc. Although, it really uses menu hub 4--menu 4 doesn't really exist as it simply redirects to hub.
|
||||
dat += cart
|
||||
|
||||
dat += "</body></html>"
|
||||
user << browse(dat, "window=pda;size=400x444;border=1;can_resize=1;can_close=0;can_minimize=0")
|
||||
onclose(user, "pda", src)
|
||||
ui_interact(user) //NanoUI requires this proc
|
||||
return
|
||||
|
||||
/obj/item/device/pda/Topic(href, href_list)
|
||||
if(href_list["cartmenu"] && !isnull(cartridge))
|
||||
cartridge.Topic(href, href_list)
|
||||
return 1
|
||||
if(href_list["radiomenu"] && !isnull(cartridge) && !isnull(cartridge.radio))
|
||||
cartridge.radio.Topic(href, href_list)
|
||||
return 1
|
||||
|
||||
|
||||
..()
|
||||
var/mob/user = usr
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, "main")
|
||||
var/mob/living/U = usr
|
||||
//Looking for master was kind of pointless since PDAs don't appear to have one.
|
||||
//if ((src in U.contents) || ( istype(loc, /turf) && in_range(src, U) ) )
|
||||
@@ -530,7 +524,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if("Close")//Self explanatory
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
if("Refresh")//Refresh, goes to the end of the proc.
|
||||
if("Return")//Return
|
||||
@@ -538,11 +532,12 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
mode = 0
|
||||
else
|
||||
mode = round(mode/10)
|
||||
if(mode==2)
|
||||
active_conversation = null
|
||||
if(mode==4)//Fix for cartridges. Redirects to hub.
|
||||
mode = 0
|
||||
else if(mode >= 40 && mode <= 49)//Fix for cartridges. Redirects to refresh the menu.
|
||||
cartridge.mode = mode
|
||||
cartridge.unlock()
|
||||
if ("Authenticate")//Checks for ID
|
||||
id_check(U, 1)
|
||||
if("UpdateInfo")
|
||||
@@ -554,6 +549,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if(ismob(T))
|
||||
T = T.loc
|
||||
cartridge.loc = T
|
||||
ui.close()
|
||||
mode = 0
|
||||
scanmode = 0
|
||||
if (cartridge.radio)
|
||||
cartridge.radio.hostpda = null
|
||||
@@ -625,57 +622,80 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
note = replacetext(n, "\n", "<BR>")
|
||||
notehtml = n
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
ui.close()
|
||||
if("Toggle Messenger")
|
||||
toff = !toff
|
||||
if("Toggle Ringer")//If viewing texts then erase them, if not then toggle silent status
|
||||
silent = !silent
|
||||
if("Clear")//Clears messages
|
||||
tnote = null
|
||||
if(href_list["option"] == "All")
|
||||
tnote.Cut()
|
||||
conversations.Cut()
|
||||
if(href_list["option"] == "Convo")
|
||||
var/new_tnote[0]
|
||||
for(var/i in tnote)
|
||||
if(i["target"] != active_conversation)
|
||||
new_tnote[++new_tnote.len] = i
|
||||
tnote = new_tnote
|
||||
conversations.Remove(active_conversation)
|
||||
|
||||
active_conversation = null
|
||||
if(mode==21)
|
||||
mode=2
|
||||
|
||||
if("Ringtone")
|
||||
var/t = input(U, "Please enter new ringtone", name, ttone) as text
|
||||
if (in_range(src, U) && loc == U)
|
||||
if (t)
|
||||
if(src.hidden_uplink && hidden_uplink.check_trigger(U, lowertext(t), lowertext(lock_code)))
|
||||
U << "The PDA softly beeps."
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
else
|
||||
t = copytext(sanitize(t), 1, 20)
|
||||
ttone = t
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
if("Message")
|
||||
|
||||
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("Select Conversation")
|
||||
var/P = href_list["convo"]
|
||||
for(var/n in conversations)
|
||||
if(P == n)
|
||||
active_conversation=P
|
||||
mode=21
|
||||
if("Send Honk")//Honk virus
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/clown))//Cartridge checks are kind of unnecessary since everything is done through switch.
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])//Leaving it alone in case it may do something useful, I guess.
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:honk_charges > 0)
|
||||
cartridge:honk_charges--
|
||||
if (!P.toff && cartridge.charges > 0)
|
||||
cartridge.charges--
|
||||
U.show_message("\blue Virus sent!", 1)
|
||||
P.honkamt = (rand(15,20))
|
||||
else
|
||||
U << "PDA not found."
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
if("Send Silence")//Silent virus
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:mime_charges > 0)
|
||||
cartridge:mime_charges--
|
||||
if (!P.toff && cartridge.charges > 0)
|
||||
cartridge.charges--
|
||||
U.show_message("\blue Virus sent!", 1)
|
||||
P.silent = 1
|
||||
P.ttone = "silence"
|
||||
else
|
||||
U << "PDA not found."
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
|
||||
|
||||
@@ -694,8 +714,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/syndicate))
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:shock_charges > 0)
|
||||
cartridge:shock_charges--
|
||||
if (!P.toff && cartridge.charges > 0)
|
||||
cartridge.charges--
|
||||
|
||||
var/difficulty = 0
|
||||
|
||||
@@ -712,7 +732,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
U.show_message("\red An error flashes on your [src].", 1)
|
||||
else if (prob(difficulty * 3))
|
||||
U.show_message("\red Energy feeds back into your [src]!", 1)
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
explode()
|
||||
log_admin("[key_name(U)] just attempted to blow up [P] with the Detomatix cartridge but failed, blowing themselves up")
|
||||
message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge but failed, blowing themselves up", 1)
|
||||
@@ -725,7 +745,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
U << "PDA not found."
|
||||
else
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
|
||||
//pAI FUNCTIONS===================================
|
||||
@@ -737,33 +757,31 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
if(T)
|
||||
pai.loc = T
|
||||
pai = null
|
||||
|
||||
//LINK FUNCTIONS===================================
|
||||
|
||||
else//Cartridge menu linking
|
||||
else
|
||||
mode = text2num(href_list["choice"])
|
||||
cartridge.mode = mode
|
||||
cartridge.unlock()
|
||||
if(cartridge)
|
||||
cartridge.mode = mode
|
||||
|
||||
|
||||
else//If not in range or not using the pda.
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
ui.close()
|
||||
return
|
||||
|
||||
//EXTRA FUNCTIONS===================================
|
||||
|
||||
if (mode == 2||mode == 21)//To clear message overlays.
|
||||
overlays.Cut()
|
||||
newmessage = 0
|
||||
|
||||
if ((honkamt > 0) && (prob(60)))//For clown virus.
|
||||
honkamt--
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
|
||||
|
||||
if(U.machine == src && href_list["skiprefresh"]!="1")//Final safety.
|
||||
attack_self(U)//It auto-closes the menu prior if the user is not in range and so on.
|
||||
else
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
src.updateUsrDialog()
|
||||
return 1 // return 1 tells it to refresh the UI in NanoUI
|
||||
|
||||
/obj/item/device/pda/proc/remove_id()
|
||||
if (id)
|
||||
@@ -792,7 +810,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if(!can_use())
|
||||
return
|
||||
|
||||
|
||||
last_text = world.time
|
||||
// check if telecomms I/O route 1459 is stable
|
||||
//var/telecomms_intact = telecomms_process(P.owner, owner, t)
|
||||
@@ -822,23 +840,24 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
U << "ERROR: Cannot reach recepient."
|
||||
return
|
||||
useMS.send_pda_message("[P.owner]","[owner]","[t]")
|
||||
|
||||
tnote += "<i><b>→ To [P.owner]:</b></i><br>[t]<br>"
|
||||
P.tnote += "<i><b>← From <a href='byond://?src=\ref[P];choice=Message;target=\ref[src]'>[owner]</a> ([ownjob]):</b></i><br>[t]<br>"
|
||||
for(var/mob/M in player_list)
|
||||
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS)) // src.client is so that ghosts don't have to listen to mice
|
||||
M.show_message("<span class='game say'>PDA Message - <span class='name'>[owner]</span> -> <span class='name'>[P.owner]</span>: <span class='message'>[t]</span></span>")
|
||||
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]")))
|
||||
P.tnote.Add(list(list("sent" = 0, "owner" = "[owner]", "job" = "[ownjob]", "message" = "[t]", "target" = "\ref[src]")))
|
||||
if(!conversations.Find("\ref[P]"))
|
||||
conversations.Add("\ref[P]")
|
||||
if(!P.conversations.Find("\ref[src]"))
|
||||
P.conversations.Add("\ref[src]")
|
||||
|
||||
|
||||
if (prob(15)) //Give the AI a chance of intercepting the message
|
||||
var/who = src.owner
|
||||
if(prob(50))
|
||||
who = P:owner
|
||||
who = P.owner
|
||||
for(var/mob/living/silicon/ai/ai in mob_list)
|
||||
// Allows other AIs to intercept the message but the AI won't intercept their own message.
|
||||
if(ai.aiPDA != P && ai.aiPDA != src)
|
||||
ai.show_message("<i>Intercepted message from <b>[who]</b>: [t]</i>")
|
||||
|
||||
|
||||
if (!P.silent)
|
||||
playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
for (var/mob/O in hearers(3, P.loc))
|
||||
@@ -851,12 +870,14 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
else
|
||||
L = get(P, /mob/living/silicon)
|
||||
|
||||
|
||||
if(L)
|
||||
L << "\icon[P] <b>Message from [src.owner] ([ownjob]), </b>\"[t]\" (<a href='byond://?src=\ref[P];choice=Message;skiprefresh=1;target=\ref[src]'>Reply</a>)"
|
||||
|
||||
log_pda("[usr] (PDA: [src.name]) sent \"[t]\" to [P.name]")
|
||||
P.overlays.Cut()
|
||||
P.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
P.newmessage = 1
|
||||
else
|
||||
U << "<span class='notice'>ERROR: Messaging server is not responding.</span>"
|
||||
|
||||
@@ -926,12 +947,15 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
/obj/item/device/pda/attackby(obj/item/C as obj, mob/user as mob)
|
||||
..()
|
||||
if(istype(C, /obj/item/weapon/cartridge) && !cartridge)
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, "main")
|
||||
cartridge = C
|
||||
user.drop_item()
|
||||
cartridge.loc = src
|
||||
user << "<span class='notice'>You insert [cartridge] into [src].</span>"
|
||||
if(cartridge.radio)
|
||||
cartridge.radio.hostpda = src
|
||||
if(ui)
|
||||
ui.close()
|
||||
|
||||
else if(istype(C, /obj/item/weapon/card/id))
|
||||
var/obj/item/weapon/card/id/idcard = C
|
||||
@@ -1045,9 +1069,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if(5)
|
||||
if((istype(A, /obj/item/weapon/tank)) || (istype(A, /obj/machinery/portable_atmospherics)))
|
||||
if(istype(A, /obj/item/weapon/tank))
|
||||
var/obj/item/weapon/tank/t = A
|
||||
t.manipulated_by = user.real_name
|
||||
var/obj/icon = A
|
||||
for (var/mob/O in viewers(user, null))
|
||||
O << "\red [user] has used [src] on \icon[icon] [A]"
|
||||
@@ -1138,8 +1159,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
return
|
||||
|
||||
if ((istype(M, /mob/living/carbon/human) && (M.real_name != src.owner) && (istype(src.cartridge, /obj/item/weapon/cartridge/clown))))
|
||||
if (src.cartridge:honk_charges < 5)
|
||||
src.cartridge:honk_charges++
|
||||
if (src.cartridge.charges < 5)
|
||||
src.cartridge.charges++
|
||||
|
||||
M.stop_pulling()
|
||||
M << "\blue You slipped on the PDA!"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,15 +31,6 @@
|
||||
|
||||
frequency.post_signal(src, signal, filter = s_filter)
|
||||
|
||||
proc/print_to_host(var/text)
|
||||
if (isnull(src.hostpda))
|
||||
return
|
||||
src.hostpda.cart = text
|
||||
|
||||
for (var/mob/M in viewers(1, src.hostpda.loc))
|
||||
if (M.client && M.machine == src.hostpda)
|
||||
src.hostpda.cartridge.unlock()
|
||||
|
||||
return
|
||||
|
||||
proc/generate_menu()
|
||||
@@ -107,7 +98,6 @@
|
||||
if("summon")
|
||||
post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(PDA) , s_filter = RADIO_SECBOT)
|
||||
post_signal(control_freq, "command", "bot_status", "active", active, s_filter = RADIO_SECBOT)
|
||||
PDA.cartridge.unlock()
|
||||
|
||||
/obj/item/radio/integrated/mule
|
||||
var/list/botlist = null // list of bots
|
||||
@@ -163,7 +153,6 @@
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
var/obj/item/device/pda/PDA = src.hostpda
|
||||
var/cmd = "command"
|
||||
if(active) cmd = "command [active.suffix]"
|
||||
|
||||
@@ -208,7 +197,6 @@
|
||||
if("stop", "go", "home")
|
||||
post_signal(control_freq, cmd, href_list["op"], s_filter = RADIO_MULEBOT)
|
||||
post_signal(control_freq, cmd, "bot_status", s_filter = RADIO_MULEBOT)
|
||||
PDA.cartridge.unlock()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
var/item_data // raw item text
|
||||
var/list/ItemList // Parsed list of items
|
||||
var/uses // Numbers of crystals
|
||||
var/nanoui_items[0]
|
||||
// List of items not to shove in their hands.
|
||||
var/list/NotInHand = list(/obj/machinery/singularity_beacon/syndicate)
|
||||
|
||||
@@ -23,6 +24,39 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
items = replacetext(item_data)
|
||||
ItemList = text2list(src.items, ";") // Parsing the items text string
|
||||
uses = ticker.mode.uplink_uses
|
||||
nanoui_items = generate_nanoui_items()
|
||||
|
||||
/*
|
||||
Built the Items List for use with NanoUI
|
||||
*/
|
||||
|
||||
/obj/item/device/uplink/proc/generate_nanoui_items()
|
||||
var/items_nano[0]
|
||||
for(var/D in ItemList)
|
||||
var/list/O = stringsplit(D, ":")
|
||||
if(O.len != 3) //If it is not an actual item, make a break in the menu.
|
||||
if(O.len == 1) //If there is one item, it's probably a title
|
||||
items_nano[++items_nano.len] = list("Category" = "[O[1]]", "items" = list())
|
||||
continue
|
||||
|
||||
var/path_text = O[1]
|
||||
var/cost = text2num(O[2])
|
||||
|
||||
var/path_obj = text2path(path_text)
|
||||
|
||||
// Because we're using strings, this comes up if item paths change.
|
||||
// Failure to handle this error borks uplinks entirely. -Sayu
|
||||
if(!path_obj)
|
||||
error("Syndicate item is not a valid path: [path_text]")
|
||||
else
|
||||
var/itemname = O[3]
|
||||
items_nano[items_nano.len]["items"] += list(list("Name" = itemname, "Cost" = cost, "obj_path" = path_text))
|
||||
|
||||
return items_nano
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Let's build a menu!
|
||||
/obj/item/device/uplink/proc/generate_menu()
|
||||
@@ -230,8 +264,8 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
feedback_add_details("traitor_uplink_items_bought","ST")
|
||||
|
||||
/obj/item/device/uplink/Topic(href, href_list)
|
||||
|
||||
if (href_list["buy_item"])
|
||||
|
||||
if(href_list["buy_item"] == "random")
|
||||
var/boughtItem = chooseRandomItem()
|
||||
if(boughtItem)
|
||||
@@ -299,31 +333,48 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
return 1
|
||||
return 0
|
||||
|
||||
// Interaction code. Gathers a list of items purchasable from the paren't uplink and displays it. It also adds a lock button.
|
||||
/obj/item/device/uplink/hidden/interact(mob/user as mob)
|
||||
/*
|
||||
NANO UI FOR UPLINK WOOP WOOP
|
||||
*/
|
||||
/obj/item/device/uplink/hidden/ui_interact(mob/user, ui_key = "main")
|
||||
var/title = "Syndicate Uplink"
|
||||
var/data[0]
|
||||
|
||||
data["crystals"] = uses
|
||||
data["nano_items"] = nanoui_items
|
||||
data["welcome"] = welcome
|
||||
|
||||
var/dat = "<body link='yellow' alink='white' bgcolor='#601414'><font color='white'>"
|
||||
dat += src.generate_menu()
|
||||
dat += "<A href='byond://?src=\ref[src];lock=1'>Lock</a>"
|
||||
dat += "</font></body>"
|
||||
user << browse(dat, "window=hidden")
|
||||
onclose(user, "hidden")
|
||||
return
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new one
|
||||
ui = new(user, src, ui_key, "uplink.tmpl", title, 450, 600)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
else
|
||||
// The UI is already open so push the new data to it
|
||||
ui.push_data(data)
|
||||
return
|
||||
|
||||
// Interaction code. Gathers a list of items purchasable from the paren't uplink and displays it. It also adds a lock button.
|
||||
/obj/item/device/uplink/hidden/interact(mob/user)
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
// The purchasing code.
|
||||
/obj/item/device/uplink/hidden/Topic(href, href_list)
|
||||
|
||||
if (usr.stat || usr.restrained())
|
||||
return
|
||||
|
||||
if (!( istype(usr, /mob/living/carbon/human)))
|
||||
return 0
|
||||
|
||||
var/mob/user = usr
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, "main")
|
||||
if ((usr.contents.Find(src.loc) || (in_range(src.loc, usr) && istype(src.loc.loc, /turf))))
|
||||
usr.set_machine(src)
|
||||
if(href_list["lock"])
|
||||
toggle()
|
||||
usr << browse(null, "window=hidden")
|
||||
ui.close()
|
||||
return 1
|
||||
|
||||
if(..(href, href_list) == 1)
|
||||
@@ -334,7 +385,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid
|
||||
A.put_in_any_hand_if_possible(I)
|
||||
purchase_log += "[usr] ([usr.ckey]) bought [I]."
|
||||
interact(usr)
|
||||
return
|
||||
return 1
|
||||
|
||||
// I placed this here because of how relevant it is.
|
||||
// You place this in your uplinkable item to check if an uplink is active or not.
|
||||
|
||||
Reference in New Issue
Block a user