TGUI PDAs Finale (minus newscaster)

This commit is contained in:
ShadowLarkens
2020-09-16 18:20:54 -07:00
parent bec0942513
commit 637576848e
28 changed files with 334 additions and 972 deletions

View File

@@ -204,7 +204,9 @@
else
P = W
itemname = P.name
info = P.notehtml
var/datum/data/pda/app/notekeeper/N = P.find_program(/datum/data/pda/app/notekeeper)
if(N)
info = N.notehtml
to_chat(U, "You hold \a [itemname] up to the camera ...")
for(var/mob/living/silicon/ai/O in living_mob_list)
if(!O.client)

View File

@@ -131,7 +131,10 @@
//Get out list of viable PDAs
var/list/obj/item/device/pda/sendPDAs = list()
for(var/obj/item/device/pda/P in PDAs)
if(!P.owner || P.toff || P.hidden)
if(!P.owner || P.hidden)
continue
var/datum/data/pda/app/messenger/M = P.find_program(/datum/data/pda/app/messenger)
if(!M || M.toff)
continue
sendPDAs["[P.name]"] = "\ref[P]"
data["possibleRecipients"] = sendPDAs
@@ -265,7 +268,11 @@
if("set_recipient")
var/ref = params["val"]
var/obj/item/device/pda/P = locate(ref)
if(!istype(P) || !P.owner || P.toff || P.hidden)
if(!istype(P) || !P.owner || P.hidden)
return FALSE
var/datum/data/pda/app/messenger/M = P.find_program(/datum/data/pda/app/messenger)
if(!M || M.toff)
return FALSE
customrecepient = P
. = TRUE
@@ -286,22 +293,26 @@
var/obj/item/device/pda/PDARec = null
for(var/obj/item/device/pda/P in PDAs)
if(!P.owner || P.toff || P.hidden) continue
if(!P.owner || P.hidden)
continue
var/datum/data/pda/app/messenger/M = P.find_program(/datum/data/pda/app/messenger)
if(!M || M.toff)
continue
if(P.owner == customsender)
PDARec = P
//Sender isn't faking as someone who exists
if(isnull(PDARec))
linkedServer.send_pda_message("[customrecepient.owner]", "[customsender]","[custommessage]")
customrecepient.new_message(customsender, customsender, customjob, custommessage)
var/datum/data/pda/app/messenger/M = customrecepient.find_program(/datum/data/pda/app/messenger)
if(M)
M.receive_message(list("sent" = 0, "owner" = customsender, "job" = customjob, "message" = custommessage), null)
//Sender is faking as someone who exists
else
linkedServer.send_pda_message("[customrecepient.owner]", "[PDARec.owner]","[custommessage]")
customrecepient.tnote.Add(list(list("sent" = 0, "owner" = "[PDARec.owner]", "job" = "[customjob]", "message" = "[custommessage]", "target" ="\ref[PDARec]")))
if(!customrecepient.conversations.Find("\ref[PDARec]"))
customrecepient.conversations.Add("\ref[PDARec]")
customrecepient.new_message(PDARec, custommessage)
var/datum/data/pda/app/messenger/M = customrecepient.find_program(/datum/data/pda/app/messenger)
if(M)
M.receive_message(list("sent" = 0, "owner" = "[PDARec.owner]", "job" = "[customjob]", "message" = "[custommessage]", "target" = "\ref[PDARec]"), "\ref[PDARec]")
//Finally..
ResetMessage()
. = TRUE

View File

@@ -101,22 +101,22 @@
NEWSCASTER.newsAlert(annoncement)
NEWSCASTER.update_icon()
var/list/receiving_pdas = new
for (var/obj/item/device/pda/P in PDAs)
if(!P.owner)
continue
if(P.toff)
continue
receiving_pdas += P
// var/list/receiving_pdas = new
// for (var/obj/item/device/pda/P in PDAs)
// if(!P.owner)
// continue
// if(P.toff)
// continue
// receiving_pdas += P
spawn(0) // get_receptions sleeps further down the line, spawn of elsewhere
var/datum/receptions/receptions = get_receptions(null, receiving_pdas) // datums are not atoms, thus we have to assume the newscast network always has reception
// spawn(0) // get_receptions sleeps further down the line, spawn of elsewhere
// var/datum/receptions/receptions = get_receptions(null, receiving_pdas) // datums are not atoms, thus we have to assume the newscast network always has reception
for(var/obj/item/device/pda/PDA in receiving_pdas)
if(!(receptions.receiver_reception[PDA] & TELECOMMS_RECEPTION_RECEIVER))
continue
// for(var/obj/item/device/pda/PDA in receiving_pdas)
// if(!(receptions.receiver_reception[PDA] & TELECOMMS_RECEPTION_RECEIVER))
// continue
PDA.new_news(annoncement)
// PDA.new_news(annoncement)
var/datum/feed_network/news_network = new /datum/feed_network //The global news-network, which is coincidentally a global list.

View File

@@ -63,7 +63,9 @@
/obj/machinery/pda_multicaster/proc/update_PDAs(var/turn_off)
for(var/obj/item/device/pda/pda in contents)
pda.toff = turn_off
var/datum/data/pda/app/messenger/M = pda.find_program(/datum/data/pda/app/messenger/multicast)
if(M)
M.toff = turn_off
/obj/machinery/pda_multicaster/proc/update_power()
if(toggle)

View File

@@ -33,6 +33,24 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
QDEL_NULL(radio)
return ..()
/obj/item/device/paicard/attack_ghost(mob/observer/dead/user)
if(istype(user) && user.can_admin_interact())
switch(alert(user, "Would you like to become a pAI by force? (Admin)", "pAI Creation", "Yes", "No"))
if("Yes")
// Copied from paiController/Topic
var/mob/living/silicon/pai/pai = new(src)
pai.name = user.name
pai.real_name = pai.name
pai.key = user.key
setPersonality(pai)
looking_for_personality = FALSE
if(pai.mind)
update_antag_icons(pai.mind)
return ..()
/obj/item/device/paicard/attack_self(mob/user)
if (!in_range(src, user))
return

View File

@@ -36,7 +36,11 @@
var/obj/item/device/pda/P
var/list/viables = list()
for(var/obj/item/device/pda/check_pda in sortAtom(PDAs))
if (!check_pda.owner||check_pda.toff||check_pda == src||check_pda.hidden)
if (!check_pda.owner || check_pda == src || check_pda.hidden)
continue
var/datum/data/pda/app/messenger/M = check_pda.find_program(/datum/data/pda/app/messenger)
if(!M || M.toff)
continue
viables.Add(check_pda)

View File

@@ -35,7 +35,11 @@
var/list/viables = list()
for(var/obj/item/device/pda/check_pda in sortAtom(PDAs))
if(!check_pda.owner || check_pda.toff || check_pda.hidden || check_pda.spam_proof)
if (!check_pda.owner || check_pda == src || check_pda.hidden)
continue
var/datum/data/pda/app/messenger/M = check_pda.find_program(/datum/data/pda/app/messenger)
if(!M || M.toff)
continue
viables += check_pda
@@ -93,7 +97,7 @@
message = pick("Luxury watches for Blowout sale prices!",\
"Watches, Jewelry & Accessories, Bags & Wallets !",\
"Deposit 100$ and get 300$ totally free!",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
" 100K NT.|WOWGOLD <20>nly $89 <HOT>",\
"We have been filed with a complaint from one of your customers in respect of their business relations with you.",\
"We kindly ask you to open the COMPLAINT REPORT (attached) to reply on this complaint..")
if(4)
@@ -127,7 +131,8 @@
/datum/event2/event/pda_spam/proc/send_spam(obj/item/device/pda/P, sender, message)
last_spam_time = world.time
P.spam_message(sender, message)
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
PM.notify("<b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)", 0)
if(spam_debug)
log_debug("PDA Spam event sent spam to \the [P].")

View File

@@ -122,7 +122,10 @@
pda.ownjob = "Personal Assistant"
pda.owner = text("[]", src)
pda.name = pda.owner + " (" + pda.ownjob + ")"
pda.toff = 1
var/datum/data/pda/app/messenger/M = pda.find_program(/datum/data/pda/app/messenger)
if(M)
M.toff = TRUE
..()
/mob/living/silicon/pai/Login()

View File

@@ -108,6 +108,7 @@ var/global/list/default_pai_software = list()
S.toggle(src)
else
ui_interact(src, ui_key = soft)
S.tgui_interact(src)
return 1
else if(href_list["stopic"])

View File

@@ -21,6 +21,14 @@
proc/is_active(mob/living/silicon/pai/user)
return 0
/datum/pai_software/tgui_state(mob/user)
return GLOB.tgui_always_state
/datum/pai_software/tgui_status(mob/user)
if(!istype(user, /mob/living/silicon/pai))
return STATUS_CLOSE
return ..()
/datum/pai_software/directives
name = "Directives"
ram_cost = 0
@@ -142,75 +150,8 @@
id = "messenger"
toggle = 0
on_ui_interact(mob/living/silicon/pai/user, datum/nanoui/ui=null, force_open=1)
var/data[0]
data["receiver_off"] = user.pda.toff
data["ringer_off"] = user.pda.message_silent
data["current_ref"] = null
data["current_name"] = user.current_pda_messaging
var/pdas[0]
if(!user.pda.toff)
for(var/obj/item/device/pda/P in sortAtom(PDAs))
if(!P.owner || P.toff || P == user.pda || P.hidden) continue
var/pda[0]
pda["name"] = "[P]"
pda["owner"] = "[P.owner]"
pda["ref"] = "\ref[P]"
if(P.owner == user.current_pda_messaging)
data["current_ref"] = "\ref[P]"
pdas[++pdas.len] = pda
data["pdas"] = pdas
var/messages[0]
if(user.current_pda_messaging)
for(var/index in user.pda.tnote)
if(index["owner"] != user.current_pda_messaging)
continue
var/msg[0]
var/sent = index["sent"]
msg["sent"] = sent ? 1 : 0
msg["target"] = index["owner"]
msg["message"] = index["message"]
messages[++messages.len] = msg
data["messages"] = messages
ui = SSnanoui.try_update_ui(user, user, id, ui, data, force_open)
if(!ui)
// Don't copy-paste this unless you're making a pAI software module!
ui = new(user, user, id, "pai_messenger.tmpl", "Digital Messenger", 450, 600)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
Topic(href, href_list)
var/mob/living/silicon/pai/P = usr
if(!istype(P)) return
if(!isnull(P.pda))
if(href_list["toggler"])
P.pda.toff = href_list["toggler"] != "1"
return 1
else if(href_list["ringer"])
P.pda.message_silent = href_list["ringer"] != "1"
return 1
else if(href_list["select"])
var/s = href_list["select"]
if(s == "*NONE*")
P.current_pda_messaging = null
else
P.current_pda_messaging = s
return 1
else if(href_list["target"])
if(P.silence_time)
return alert("Communications circuits remain uninitialized.")
var/target = locate(href_list["target"])
P.pda.create_message(P, target, 1)
return 1
/datum/pai_software/messenger/tgui_interact(mob/living/silicon/pai/user, datum/tgui/ui, datum/tgui/parent_ui)
return user.pda.tgui_interact(user)
/datum/pai_software/med_records
name = "Medical Records"

View File

@@ -3,7 +3,6 @@
/obj/item/device/pda/ai
icon_state = "NONE"
ttone = "data"
newstone = "news"
detonate = 0
@@ -90,6 +89,22 @@
/obj/item/device/pda/ai/pai
ttone = "assist"
var/our_owner = null // Ref to a pAI
touch_silent = TRUE
programs = list(
new/datum/data/pda/app/main_menu,
new/datum/data/pda/app/notekeeper,
new/datum/data/pda/app/messenger)
/obj/item/device/pda/ai/pai/New(mob/living/silicon/pai/P)
if(istype(P))
our_owner = REF(P)
return ..()
/obj/item/device/pda/ai/pai/tgui_status(mob/living/silicon/pai/user, datum/tgui_state/state)
if(!istype(user) || REF(user) != our_owner) // Only allow our pAI to interface with us
return STATUS_CLOSE
return ..()
/obj/item/device/pda/ai/shell
spam_proof = TRUE // Since empty shells get a functional PDA.

View File

@@ -107,12 +107,7 @@ var/list/civilian_cartridges = list(
name = "\improper R.O.B.U.S.T. cartridge"
icon_state = "cart-s"
programs = list(
new/datum/data/pda/app/crew_records/security,
new/datum/data/pda/app/secbot_control)
/obj/item/weapon/cartridge/security/Initialize()
radio = new /obj/item/radio/integrated/beepsky(src)
. = ..()
new/datum/data/pda/app/crew_records/security)
/obj/item/weapon/cartridge/detective
name = "\improper D.E.T.E.C.T. cartridge"
@@ -177,12 +172,7 @@ var/list/civilian_cartridges = list(
desc = "Perfect for the Quartermaster on the go!"
icon_state = "cart-q"
programs = list(
new/datum/data/pda/app/supply,
new/datum/data/pda/app/mule_control)
/obj/item/weapon/cartridge/quartermaster/Initialize()
radio = new /obj/item/radio/integrated/mule(src)
..()
new/datum/data/pda/app/supply)
/obj/item/weapon/cartridge/miner
name = "\improper Drill-Jockey 4.5 cartridge"
@@ -203,27 +193,17 @@ var/list/civilian_cartridges = list(
new/datum/data/pda/app/janitor,
new/datum/data/pda/app/supply,
new/datum/data/pda/app/mule_control,
new/datum/data/pda/app/status_display)
/obj/item/weapon/cartridge/hop/Initialize()
radio = new /obj/item/radio/integrated/mule(src)
..()
/obj/item/weapon/cartridge/hos
name = "\improper R.O.B.U.S.T. DELUXE cartridge"
icon_state = "cart-hos"
programs = list(
new/datum/data/pda/app/crew_records/security,
new/datum/data/pda/app/secbot_control,
new/datum/data/pda/app/status_display)
/obj/item/weapon/cartridge/hos/Initialize()
radio = new /obj/item/radio/integrated/beepsky(src)
. = ..()
/obj/item/weapon/cartridge/ce
name = "\improper Power-On DELUXE cartridge"
icon_state = "cart-ce"
@@ -278,7 +258,6 @@ var/list/civilian_cartridges = list(
new/datum/data/pda/utility/scanmode/reagent,
new/datum/data/pda/app/crew_records/security,
new/datum/data/pda/app/secbot_control,
new/datum/data/pda/app/janitor,

View File

@@ -66,8 +66,10 @@
/datum/data/pda/app/signaller/update_ui(mob/user as mob, list/data)
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/radio/integrated/signal))
var/obj/item/radio/integrated/signal/R = pda.cartridge.radio
data["signal_freq"] = format_frequency(R.frequency)
data["signal_code"] = R.code
data["frequency"] = R.frequency
data["minFrequency"] = RADIO_LOW_FREQ
data["maxFrequency"] = RADIO_HIGH_FREQ
data["code"] = R.code
/datum/data/pda/app/signaller/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
@@ -76,19 +78,23 @@
var/obj/item/radio/integrated/signal/R = pda.cartridge.radio
switch(action)
if("Send Signal")
if("signal")
spawn(0)
R.send_signal("ACTIVATE")
if("Signal Frequency")
var/new_frequency = sanitize_frequency(R.frequency + text2num(params["sfreq"]))
R.set_frequency(new_frequency)
if("Signal Code")
R.code += text2num(params["scode"])
R.code = round(R.code)
R.code = min(100, R.code)
R.code = max(1, R.code)
if("freq")
var/frequency = unformat_frequency(params["freq"])
frequency = sanitize_frequency(frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
R.set_frequency(frequency)
. = TRUE
if("code")
R.code = clamp(round(text2num(params["code"])), 1, 100)
. = TRUE
if("reset")
if(params["reset"] == "freq")
R.set_frequency(initial(R.frequency))
else
R.code = initial(R.code)
. = TRUE
/datum/data/pda/app/power
name = "Power Monitor"
@@ -208,110 +214,6 @@
security_records = E
break
/datum/data/pda/app/secbot_control
name = "Security Bot Access"
icon = "rss"
template = "pda_secbot"
category = "Security"
/datum/data/pda/app/secbot_control/update_ui(mob/user as mob, list/data)
var/botsData[0]
var/beepskyData[0]
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/radio/integrated/beepsky))
var/obj/item/radio/integrated/beepsky/SC = pda.cartridge.radio
beepskyData["active"] = SC.active ? sanitize(SC.active.name) : null
has_back = SC.active ? 1 : 0
if(SC.active && !isnull(SC.botstatus))
var/area/loca = SC.botstatus["loca"]
var/loca_name = sanitize(loca.name)
beepskyData["botstatus"] = list("loca" = loca_name, "mode" = SC.botstatus["mode"])
else
beepskyData["botstatus"] = list("loca" = null, "mode" = -1)
var/botsCount=0
if(SC.botlist && SC.botlist.len)
for(var/mob/living/bot/B in SC.botlist)
botsCount++
if(B.loc)
botsData[++botsData.len] = list("Name" = sanitize(B.name), "Location" = sanitize(B.loc.loc.name), "ref" = "\ref[B]")
if(!botsData.len)
botsData[++botsData.len] = list("Name" = "No bots found", "Location" = "Invalid", "ref"= null)
beepskyData["bots"] = botsData
beepskyData["count"] = botsCount
else
beepskyData["active"] = 0
botsData[++botsData.len] = list("Name" = "No bots found", "Location" = "Invalid", "ref"= null)
beepskyData["botstatus"] = list("loca" = null, "mode" = null)
beepskyData["bots"] = botsData
beepskyData["count"] = 0
has_back = 0
data["beepsky"] = beepskyData
/datum/data/pda/app/secbot_control/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
switch(action)
if("Back")
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/radio/integrated/beepsky))
pda.cartridge.radio.Topic(null, list(radiomenu = "1", op = "botlist"))
return TRUE
/datum/data/pda/app/mule_control
name = "Delivery Bot Control"
icon = "truck"
template = "pda_mule"
category = "Quartermaster"
/datum/data/pda/app/mule_control/update_ui(mob/user as mob, list/data)
var/muleData[0]
var/mulebotsData[0]
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/radio/integrated/mule))
var/obj/item/radio/integrated/mule/QC = pda.cartridge.radio
muleData["active"] = QC.active ? sanitize(QC.active.name) : null
has_back = QC.active ? 1 : 0
if(QC.active && !isnull(QC.botstatus))
var/area/loca = QC.botstatus["loca"]
var/loca_name = sanitize(loca.name)
muleData["botstatus"] = list("loca" = loca_name, "mode" = QC.botstatus["mode"],"home"=QC.botstatus["home"],"powr" = QC.botstatus["powr"],"retn" =QC.botstatus["retn"], "pick"=QC.botstatus["pick"], "load" = QC.botstatus["load"], "dest" = sanitize(QC.botstatus["dest"]))
else
muleData["botstatus"] = list("loca" = null, "mode" = -1,"home"=null,"powr" = null,"retn" =null, "pick"=null, "load" = null, "dest" = null)
var/mulebotsCount=0
for(var/mob/living/bot/B in QC.botlist)
mulebotsCount++
if(B.loc)
mulebotsData[++mulebotsData.len] = list("Name" = sanitize(B.name), "Location" = sanitize(B.loc.loc.name), "ref" = "\ref[B]")
if(!mulebotsData.len)
mulebotsData[++mulebotsData.len] = list("Name" = "No bots found", "Location" = "Invalid", "ref"= null)
muleData["bots"] = mulebotsData
muleData["count"] = mulebotsCount
else
muleData["botstatus"] = list("loca" = null, "mode" = -1,"home"=null,"powr" = null,"retn" =null, "pick"=null, "load" = null, "dest" = null)
muleData["active"] = 0
mulebotsData[++mulebotsData.len] = list("Name" = "No bots found", "Location" = "Invalid", "ref"= null)
muleData["bots"] = mulebotsData
muleData["count"] = 0
has_back = 0
data["mulebot"] = muleData
/datum/data/pda/app/mule_control/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
switch(action)
if("Back")
if(pda.cartridge && istype(pda.cartridge.radio, /obj/item/radio/integrated/mule))
pda.cartridge.radio.Topic(null, list(radiomenu = "1", op = "botlist"))
return TRUE
/datum/data/pda/app/supply
name = "Supply Records"
icon = "file-word-o"

View File

@@ -1,16 +0,0 @@
var/list/chatrooms = list()
/datum/chatroom
var/name = "Generic Chatroom"
var/list/logged_in = list()
var/list/logs = list() // chat logs
var/list/banned = list() // banned users
var/list/whitelist = list() // whitelisted users
var/list/muted = list()
var/topic = "" // topic message for the chatroom
var/password = "" // blank for no password.
var/operator = "" // name of the operator
/datum/chatroom/proc/attempt_connect(var/obj/item/device/pda/device, var/obj/password)
if(!device)
return

View File

@@ -31,10 +31,10 @@
if(pda.pai.loc != pda)
pda.pai = null
else
switch(params["option"])
if("1") // Configure pAI device
switch(text2num(params["option"]))
if(1) // Configure pAI device
pda.pai.attack_self(usr)
if("2") // Eject pAI device
if(2) // Eject pAI device
var/turf/T = get_turf_or_move(pda.loc)
if(T)
pda.pai.loc = T

View File

@@ -107,6 +107,20 @@
if("Back")
active_conversation = null
// Specifically here for the chat message.
/datum/data/pda/app/messenger/Topic(href, href_list)
if(!pda.can_use())
return
unnotify()
switch(href_list["choice"])
if("Message")
var/obj/item/device/pda/P = locate(href_list["target"])
create_message(usr, P)
if(href_list["target"] in conversations) // Need to make sure the message went through, if not welp.
active_conversation = href_list["target"]
/datum/data/pda/app/messenger/proc/create_message(var/mob/living/U, var/obj/item/device/pda/P)
var/t = input(U, "Please enter message", name, null) as text|null
if(!t)
@@ -160,16 +174,12 @@
to_chat(U, "ERROR: Cannot reach recipient.")
return
useMS.send_pda_message("[P.owner]","[pda.owner]","[t]")
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]")))
PM.tnote.Add(list(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[t]", "target" = "\ref[pda]")))
pda.investigate_log("<span class='game say'>PDA Message - <span class='name'>[U.key] - [pda.owner]</span> -> <span class='name'>[P.owner]</span>: <span class='message'>[t]</span></span>", "pda")
if(!conversations.Find("\ref[P]"))
conversations.Add("\ref[P]")
if(!PM.conversations.Find("\ref[pda]"))
PM.conversations.Add("\ref[pda]")
receive_message(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]"), "\ref[P]")
PM.receive_message(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[t]", "target" = "\ref[pda]"), "\ref[pda]")
SStgui.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message
PM.notify("<b>Message from [pda.owner] ([pda.ownjob]), </b>\"[t]\" (<a href='?src=[REF(PM)];choice=Message;target=\ref[pda]'>Reply</a>)")
log_pda("(PDA: [src.name]) sent \"[t]\" to [P.name]", usr)
else
to_chat(U, "<span class='notice'>ERROR: Messaging server is not responding.</span>")
@@ -203,3 +213,35 @@
/datum/data/pda/app/messenger/proc/can_receive()
return pda.owner && !toff && !hidden
/datum/data/pda/app/messenger/proc/receive_message(list/data, ref)
tnote.Add(list(data))
if(!conversations.Find(ref))
conversations.Add(ref)
if(!data["sent"])
var/owner = data["owner"]
var/job = data["job"]
var/message = data["message"]
notify("<b>Message from [owner] ([job]), </b>\"[message]\" (<a href='?src=\ref[src];choice=Message;target=[ref]'>Reply</a>)")
/datum/data/pda/app/messenger/multicast
/datum/data/pda/app/messenger/multicast/receive_message(list/data, ref)
. = ..()
var/obj/item/device/pda/multicaster/M = pda
if(!istype(M))
return
var/list/modified_message = data.Copy()
modified_message["owner"] = modified_message["owner"] + " \[Relayed]"
modified_message["target"] = "\ref[M]"
var/list/targets = list()
for(var/obj/item/device/pda/pda in PDAs)
if(pda.cartridge && pda.owner && is_type_in_list(pda.cartridge, M.cartridges_to_send_to))
targets |= pda
if(targets.len)
for(var/obj/item/device/pda/target in targets)
var/datum/data/pda/app/messenger/P = target.find_program(/datum/data/pda/app/messenger)
if(P)
P.receive_message(modified_message, "\ref[M]")

View File

@@ -20,15 +20,13 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/obj/item/weapon/cartridge/cartridge = null //current cartridge
//Secondary variables
// var/scanmode = 0 //1 is medical scanner, 2 is forensics, 3 is reagent scanner.
var/fon = 0 //Is the flashlight function on?
var/f_lum = 2 //Luminosity for the flashlight function
var/message_silent = 0 //To beep or not to beep, that is the question
var/news_silent = 1 //To beep or not to beep, that is the question. The answer is No.
var/toff = 0 //If 1, messenger disabled
var/tnote[0] //Current Texts
var/last_text //No text spamming
var/last_honk //Also no honk spamming that's bad too
var/model_name = "Thinktronic 5230 Personal Data Assistant"
var/datum/data/pda/utility/scanmode/scanmode = null
var/lock_code = "" // Lockcode to unlock uplink
var/honkamt = 0 //How many honks left when infected with honk.exe
var/mimeamt = 0 //How many silence left when infected with mime.exe
var/detonate = 1 // Can the PDA be blown up?
var/ttone = "beep" //The ringtone!
var/list/ttone_sound = list("beep" = 'sound/machines/twobeep.ogg',
"boom" = 'sound/effects/explosionfar.ogg',
@@ -37,30 +35,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
"SKREE" = 'sound/voice/shriek1.ogg',
// "holy" = 'sound/items/PDA/ambicha4-short.ogg',
"xeno" = 'sound/voice/hiss1.ogg')
var/newstone = "beep, beep" //The news ringtone!
var/lock_code = "" // Lockcode to unlock uplink
var/honkamt = 0 //How many honks left when infected with honk.exe
var/mimeamt = 0 //How many silence left when infected with mime.exe
var/note = "Congratulations, your station has chosen the Thinktronic 5230 Personal Data Assistant!" //Current note in the notepad function
var/notehtml = ""
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/new_message = 0 //To remove hackish overlay check
var/new_news = 0
var/touch_silent = 0 //If 1, no beeps on interacting.
var/active_feed // The selected feed
var/list/warrant // The warrant as we last knew it
var/list/feeds = list() // The list of feeds as we last knew them
var/list/feed_info = list() // The data and contents of each feed as we last knew them
var/list/cartmodes = list(40, 42, 43, 433, 44, 441, 45, 451, 46, 48, 47, 49) // If you add more cartridge modes add them to this list as well.
var/list/no_auto_update = list(1, 40, 43, 44, 441, 45, 451) // These modes we turn off autoupdate
var/list/update_every_five = list(3, 41, 433, 46, 47, 48, 49) // These we update every 5 ticks
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 - this is assignment (potentially alt title)
var/ownrank = null // this one is rank, never alt title
@@ -69,9 +46,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/spam_proof = FALSE // If true, it can't be spammed by random events.
// App-based PDAs
var/model_name = "Thinktronic 5230 Personal Data Assistant"
var/datum/data/pda/utility/scanmode/scanmode = null
var/datum/data/pda/app/current_app = null
var/datum/data/pda/app/lastapp = null
var/list/programs = list(
@@ -111,12 +85,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
else
to_chat(usr, "<span class='notice'>This PDA does not have an ID in it.</span>")
//Bloop when using:
/obj/item/device/pda/CouldUseTopic(var/mob/user)
..()
if(iscarbon(user) && !touch_silent)
playsound(src, 'sound/machines/pda_click.ogg', 20)
/obj/item/device/pda/proc/play_ringtone()
var/S
@@ -240,13 +208,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/datum/data/pda/P = A
P.pda = src
/obj/item/device/pda/update_icon()
..()
overlays.Cut()
if(new_message || new_news)
overlays += image(icon, "pda-r")
/obj/item/device/pda/proc/detonate_act(var/obj/item/device/pda/P)
//TODO: sometimes these attacks show up on the message server
var/i = rand(1,100)
@@ -335,120 +296,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
else
to_chat(usr, "<span class='notice'>This PDA does not have a pen in it.</span>")
/obj/item/device/pda/proc/create_message(var/mob/living/U = usr, var/obj/item/device/pda/P, var/tap = 1)
if(tap)
U.visible_message("<span class='notice'>\The [U] taps on their PDA's screen.</span>")
var/t = input(U, "Please enter message", P.name, null) as text
t = sanitize(t)
//t = readd_quotes(t)
t = replace_characters(t, list("&#34;" = "\""))
if (!t || !istype(P))
return
if (!in_range(src, U) && loc != U)
return
if (isnull(P)||P.toff || toff)
return
if (last_text && world.time < last_text + 5)
return
if (!can_use())
return
if (is_jammed(src))
return
last_text = world.time
var/datum/reception/reception = get_reception(src, P, t)
t = reception.message
if(reception.message_server && (reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER)) // only send the message if it's stable
if(reception.telecomms_reception & TELECOMMS_RECEPTION_RECEIVER == 0) // Does our recipient have a broadcaster on their level?
to_chat(U, "ERROR: Cannot reach recipient.")
return
var/send_result = reception.message_server.send_pda_message("[P.owner]","[owner]","[t]")
if (send_result)
to_chat(U, "ERROR: Messaging server rejected your message. Reason: contains '[send_result]'.")
return
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]")))
for(var/mob/M in player_list)
if(M.stat == DEAD && M.client && (M.is_preference_enabled(/datum/client_preference/ghost_ears))) // src.client is so that ghosts don't have to listen to mice
if(istype(M, /mob/new_player))
continue
if(M.forbid_seeing_deadchat)
continue
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>")
if(!conversations.Find("\ref[P]"))
conversations.Add("\ref[P]")
if(!P.conversations.Find("\ref[src]"))
P.conversations.Add("\ref[src]")
to_chat(U, "[bicon(src)] <b>Sent message to [P.owner] ([P.ownjob]), </b>\"[t]\"")
if (prob(5) && security_level >= SEC_LEVEL_BLUE) //Give the AI a chance of intercepting the message //VOREStation Edit: no spam interception on lower codes + lower interception chance
var/who = src.owner
if(prob(50))
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>")
P.new_message_from_pda(src, t)
SStgui.update_user_uis(U, src) // Update the sending user's PDA UI so that they can see the new message
else
to_chat(U, "<span class='notice'>ERROR: Messaging server is not responding.</span>")
/obj/item/device/pda/proc/new_info(var/beep_silent, var/message_tone, var/reception_message)
if (!beep_silent)
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(2, loc))
O.show_message(text("[bicon(src)] *[message_tone]*"))
//Search for holder of the PDA.
var/mob/living/L = null
if(loc && isliving(loc))
L = loc
//Maybe they are a pAI!
else
L = get(src, /mob/living/silicon)
if(L)
if(reception_message)
to_chat(L,reception_message)
SStgui.update_user_uis(L, src) // Update the receiving user's PDA UI so that they can see the new message
/obj/item/device/pda/proc/new_news(var/message)
new_info(news_silent, newstone, news_silent ? "" : "[bicon(src)] <b>[message]</b>")
if(!news_silent)
new_news = 1
update_icon()
/obj/item/device/pda/proc/new_message_from_pda(var/obj/item/device/pda/sending_device, var/message)
if (is_jammed(src))
return
new_message(sending_device, sending_device.owner, sending_device.ownjob, message)
/obj/item/device/pda/proc/new_message(var/sending_unit, var/sender, var/sender_job, var/message, var/reply = 1)
var/reception_message = "[bicon(src)] <b>Message from [sender] ([sender_job]), </b>\"[message]\" ([reply ? "<a href='byond://?src=\ref[src];choice=Message;notap=[istype(loc, /mob/living/silicon)];skiprefresh=1;target=\ref[sending_unit]'>Reply</a>" : "Unable to Reply"])"
new_info(message_silent, ttone, reception_message)
log_pda("(PDA: [sending_unit]) sent \"[message]\" to [name]", usr)
new_message = 1
update_icon()
/obj/item/device/pda/proc/spam_message(sender, message)
var/reception_message = "\icon[src] <b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)"
new_info(message_silent, ttone, reception_message)
if(prob(50)) // Give the AI an increased chance to intercept the message
for(var/mob/living/silicon/ai/ai in mob_list)
if(ai.aiPDA != src)
ai.show_message("<i>Intercepted message from <b>[sender]</b></i> (Unknown / spam?) <i>to <b>[owner]</b>: [message]</i>")
/obj/item/device/pda/verb/verb_reset_pda()
set category = "Object"
set name = "Reset PDA"
@@ -522,6 +369,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
to_chat(usr, "<span class='notice'>You remove \the [cartridge] from the [name].</span>")
playsound(src, 'sound/machines/id_swipe.ogg', 100, 1)
cartridge = null
update_programs()
update_shortcuts()
start_program(find_program(/datum/data/pda/app/main_menu))
/obj/item/device/pda/proc/id_check(mob/user as mob, choice as num)//To check for IDs; 1 for in-pda use, 2 for out of pda use.
if(choice == 1)
@@ -596,130 +447,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (istype(C, /mob/living/carbon) && scanmode)
scanmode.scan_mob(C, user)
// switch(scanmode)
// if(1)
// for (var/mob/O in viewers(C, null))
// O.show_message("<span class='warning'>\The [user] has analyzed [C]'s vitals!</span>", 1)
// user.show_message("<span class='notice'>Analyzing Results for [C]:</span>")
// user.show_message("<span class='notice'> Overall Status: [C.stat > 1 ? "dead" : "[C.health - C.halloss]% healthy"]</span>", 1)
// user.show_message(text("<span class='notice'> Damage Specifics:</span> <span class='[]'>[]</span>-<span class='[]'>[]</span>-<span class='[]'>[]</span>-<span class='[]'>[]</span>",
// (C.getOxyLoss() > 50) ? "warning" : "", C.getOxyLoss(),
// (C.getToxLoss() > 50) ? "warning" : "", C.getToxLoss(),
// (C.getFireLoss() > 50) ? "warning" : "", C.getFireLoss(),
// (C.getBruteLoss() > 50) ? "warning" : "", C.getBruteLoss()
// ), 1)
// user.show_message("<span class='notice'> Key: Suffocation/Toxin/Burns/Brute</span>", 1)
// user.show_message("<span class='notice'> Body Temperature: [C.bodytemperature-T0C]&deg;C ([C.bodytemperature*1.8-459.67]&deg;F)</span>", 1)
// if(C.tod && (C.stat == DEAD || (C.status_flags & FAKEDEATH)))
// user.show_message("<span class='notice'> Time of Death: [C.tod]</span>")
// if(istype(C, /mob/living/carbon/human))
// var/mob/living/carbon/human/H = C
// var/list/damaged = H.get_damaged_organs(1,1)
// user.show_message("<span class='notice'>Localized Damage, Brute/Burn:</span>",1)
// if(length(damaged)>0)
// for(var/obj/item/organ/external/org in damaged)
// user.show_message(text("<span class='notice'> []: <span class='[]'>[]</span>-<span class='[]'>[]</span></span>",
// capitalize(org.name), (org.brute_dam > 0) ? "warning" : "notice", org.brute_dam, (org.burn_dam > 0) ? "warning" : "notice", org.burn_dam),1)
// else
// user.show_message("<span class='notice'> Limbs are OK.</span>",1)
// if(2)
// if (!istype(C:dna, /datum/dna))
// to_chat(user, "<span class='notice'>No fingerprints found on [C]</span>")
// else
// to_chat(user, text("<span class='notice'>\The [C]'s Fingerprints: [md5(C:dna.uni_identity)]</span>"))
// if ( !(C:blood_DNA) )
// to_chat(user, "<span class='notice'>No blood found on [C]</span>")
// if(C:blood_DNA)
// qdel(C:blood_DNA)
// else
// to_chat(user, "<span class='notice'>Blood found on [C]. Analysing...</span>")
// spawn(15)
// for(var/blood in C:blood_DNA)
// to_chat(user, "<span class='notice'>Blood type: [C:blood_DNA[blood]]\nDNA: [blood]</span>")
// if(4)
// user.visible_message("<span class='warning'>\The [user] has analyzed [C]'s radiation levels!</span>", "<span class='notice'>You have analyzed [C]'s radiation levels!</span>")
// to_chat(user, "<span class='notice'>Analyzing Results for [C]:</span>")
// if(C.radiation)
// to_chat(user, "<span class='notice'>Radiation Level: [C.radiation]</span>")
// else
// to_chat(user, "<span class='notice'>No radiation detected.</span>")
/obj/item/device/pda/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity)
if(proximity && scanmode)
scanmode.scan_atom(A, user)
// if(!proximity) return
// switch(scanmode)
// if(3)
// if(!isobj(A))
// return
// if(!isnull(A.reagents))
// if(A.reagents.reagent_list.len > 0)
// var/reagents_length = A.reagents.reagent_list.len
// to_chat(user, "<span class='notice'>[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.</span>")
// for (var/re in A.reagents.reagent_list)
// to_chat(user, "<span class='notice'> [re]</span>")
// else
// to_chat(user, "<span class='notice'>No active chemical agents found in [A].</span>")
// else
// to_chat(user, "<span class='notice'>No significantchemical agents found in [A].</span>")
// if(5)
// analyze_gases(A, user)
// if (!scanmode && istype(A, /obj/item/weapon/paper) && owner)
// // JMO 20140705: Makes scanned document show up properly in the notes. Not pretty for formatted documents,
// // as this will clobber the HTML, but at least it lets you scan a document. You can restore the original
// // notes by editing the note again. (Was going to allow you to edit, but scanned documents are too long.)
// var/raw_scan = (A:info)
// var/formatted_scan = ""
// // Scrub out the tags (replacing a few formatting ones along the way)
// // Find the beginning and end of the first tag.
// var/tag_start = findtext(raw_scan,"<")
// var/tag_stop = findtext(raw_scan,">")
// // Until we run out of complete tags...
// while(tag_start&&tag_stop)
// var/pre = copytext(raw_scan,1,tag_start) // Get the stuff that comes before the tag
// var/tag = lowertext(copytext(raw_scan,tag_start+1,tag_stop)) // Get the tag so we can do intellegent replacement
// var/tagend = findtext(tag," ") // Find the first space in the tag if there is one.
// // Anything that's before the tag can just be added as is.
// formatted_scan = formatted_scan+pre
// // If we have a space after the tag (and presumably attributes) just crop that off.
// if (tagend)
// tag=copytext(tag,1,tagend)
// if (tag=="p"||tag=="/p"||tag=="br") // Check if it's I vertical space tag.
// formatted_scan=formatted_scan+"<br>" // If so, add some padding in.
// raw_scan = copytext(raw_scan,tag_stop+1) // continue on with the stuff after the tag
// // Look for the next tag in what's left
// tag_start = findtext(raw_scan,"<")
// tag_stop = findtext(raw_scan,">")
// // Anything that is left in the page. just tack it on to the end as is
// formatted_scan=formatted_scan+raw_scan
// // If there is something in there already, pad it out.
// if (length(note)>0)
// note = note + "<br><br>"
// // Store the scanned document to the notes
// note = "Scanned Document. Edit to restore previous notes/delete scan.<br>----------<br>" + formatted_scan + "<br>"
// // notehtml ISN'T set to allow user to get their old notes back. A better implementation would add a "scanned documents"
// // feature to the PDA, which would better convey the availability of the feature, but this will work for now.
// // Inform the user
// to_chat(user, "<span class='notice'>Paper scanned and OCRed to notekeeper.</span>") //concept of scanning paper copyright brainoblivion 2009
/obj/item/device/pda/proc/explode() //This needs tuning. //Sure did.
if(!src.detonate) return
@@ -743,37 +473,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
QDEL_NULL(cartridge)
return ..()
/obj/item/device/pda/proc/available_pdas()
var/list/names = list()
var/list/plist = list()
var/list/namecounts = list()
if (toff)
to_chat(usr, "Turn on your receiver in order to send messages.")
return
for (var/obj/item/device/pda/P in PDAs)
if (!P.owner)
continue
else if(P.hidden)
continue
else if (P == src)
continue
else if (P.toff)
continue
var/name = P.owner
if (name in names)
namecounts[name]++
name = text("[name] ([namecounts[name]])")
else
names.Add(name)
namecounts[name] = 1
plist[text("[name]")] = P
return plist
//Some spare PDAs in a box
/obj/item/weapon/storage/box/PDAs
name = "box of spare PDAs"
@@ -800,37 +499,3 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/emp_act(severity)
for(var/atom/A in src)
A.emp_act(severity)
/obj/item/device/pda/proc/analyze_air()
var/list/results = list()
var/turf/T = get_turf(src.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.gas["oxygen"]/total_moles
var/n2_level = environment.gas["nitrogen"]/total_moles
var/co2_level = environment.gas["carbon_dioxide"]/total_moles
var/phoron_level = environment.gas["phoron"]/total_moles
var/unknown_level = 1-(o2_level+n2_level+co2_level+phoron_level)
// entry is what the element is describing
// Type identifies which unit or other special characters to use
// Val is the information reported
// Bad_high/_low are the values outside of which the entry reports as dangerous
// Poor_high/_low are the values outside of which the entry reports as unideal
// Values were extracted from the template itself
results = list(
list("entry" = "Pressure", "units" = "kPa", "val" = "[round(pressure,0.1)]", "bad_high" = 120, "poor_high" = 110, "poor_low" = 95, "bad_low" = 80),
list("entry" = "Temperature", "units" = "&degC", "val" = "[round(environment.temperature-T0C,0.1)]", "bad_high" = 35, "poor_high" = 25, "poor_low" = 15, "bad_low" = 5),
list("entry" = "Oxygen", "units" = "kPa", "val" = "[round(o2_level*100,0.1)]", "bad_high" = 140, "poor_high" = 135, "poor_low" = 19, "bad_low" = 17),
list("entry" = "Nitrogen", "units" = "kPa", "val" = "[round(n2_level*100,0.1)]", "bad_high" = 105, "poor_high" = 85, "poor_low" = 50, "bad_low" = 40),
list("entry" = "Carbon Dioxide", "units" = "kPa", "val" = "[round(co2_level*100,0.1)]", "bad_high" = 10, "poor_high" = 5, "poor_low" = 0, "bad_low" = 0),
list("entry" = "Phoron", "units" = "kPa", "val" = "[round(phoron_level*100,0.01)]", "bad_high" = 0.5, "poor_high" = 0, "poor_low" = 0, "bad_low" = 0),
list("entry" = "Other", "units" = "kPa", "val" = "[round(unknown_level, 0.01)]", "bad_high" = 1, "poor_high" = 0.5, "poor_low" = 0, "bad_low" = 0)
)
if(isnull(results))
results = list(list("entry" = "pressure", "units" = "kPa", "val" = "0", "bad_high" = 120, "poor_high" = 110, "poor_low" = 95, "bad_low" = 80))
return results

View File

@@ -42,15 +42,16 @@
/obj/item/device/pda/mime
default_cartridge = /obj/item/weapon/cartridge/mime
icon_state = "pda-mime"
message_silent = 1
news_silent = 1
ttone = "silence"
newstone = "silence"
/obj/item/device/pda/mime/New()
. = ..()
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
if(M)
M.notify_silent = TRUE
/obj/item/device/pda/heads
default_cartridge = /obj/item/weapon/cartridge/head
icon_state = "pda-h"
news_silent = 1
/obj/item/device/pda/heads/hop
default_cartridge = /obj/item/weapon/cartridge/hop
@@ -125,14 +126,18 @@
default_cartridge = /obj/item/weapon/cartridge/service
icon_state = "pda-libb"
desc = "A portable microcomputer by Thinktronic Systems, LTD. This is model is a WGW-11 series e-reader."
note = "Congratulations, your station has chosen the Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant!"
message_silent = 1 //Quiet in the library!
news_silent = 0 // Librarian is above the law! (That and alt job title is reporter)
model_name = "Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant"
/obj/item/device/pda/librarian/New()
. = ..()
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
if(M)
M.notify_silent = TRUE //Quiet in the library!
/obj/item/device/pda/clear
icon_state = "pda-transp"
desc = "A portable microcomputer by Thinktronic Systems, LTD. This is model is a special edition with a transparent case."
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Max Turbo Limited Edition!"
model_name = "Thinktronic 5230 Personal Data Assistant Deluxe Special Max Turbo Limited Edition"
/obj/item/device/pda/chef
default_cartridge = /obj/item/weapon/cartridge/service
@@ -159,54 +164,13 @@
/obj/item/device/pda/multicaster
ownjob = "Relay"
icon_state = "NONE"
ttone = "data"
detonate = 0
news_silent = 1
spam_proof = TRUE // Spam messages don't actually work and its difficult to disable these.
programs = list(
new/datum/data/pda/app/messenger/multicast
)
var/list/cartridges_to_send_to = list()
// This is what actually mirrors the message,
/obj/item/device/pda/multicaster/new_message(var/sending_unit, var/sender, var/sender_job, var/message)
if(sender)
var/list/targets = list()
for(var/obj/item/device/pda/pda in PDAs)
if(pda.cartridge && pda.owner && is_type_in_list(pda.cartridge, cartridges_to_send_to))
targets |= pda
if(targets.len)
for(var/obj/item/device/pda/target in targets)
create_message(target, sender, sender_job, message)
// This has so much copypasta,
/obj/item/device/pda/multicaster/create_message(var/obj/item/device/pda/P, var/original_sender, var/original_job, var/t)
t = sanitize(t, MAX_MESSAGE_LEN, 0)
t = replace_characters(t, list("&#34;" = "\""))
if (!t || !istype(P))
return
if (isnull(P)||P.toff || toff)
return
last_text = world.time
var/datum/reception/reception = get_reception(src, P, t)
t = reception.message
if(reception.message_server && (reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER)) // only send the message if it's stable,
if(reception.telecomms_reception & TELECOMMS_RECEPTION_RECEIVER == 0) // Does our recipient have a broadcaster on their level?,
return
var/send_result = reception.message_server.send_pda_message("[P.owner]","[owner]","[t]")
if (send_result)
return
P.tnote.Add(list(list("sent" = 0, "owner" = "[owner]", "job" = "[ownjob]", "message" = "[t]", "target" = "\ref[src]")))
if(!P.conversations.Find("\ref[src]"))
P.conversations.Add("\ref[src]")
P.new_message(src, "[original_sender] \[Relayed\]", original_job, t, 0)
else
return
/obj/item/device/pda/multicaster/command/New()
..()
owner = "Command Department"

View File

@@ -77,6 +77,9 @@
add_fingerprint(usr)
usr.set_machine(src)
if(!touch_silent)
playsound(src, 'sound/machines/pda_click.ogg', 20)
. = TRUE
switch(action)
if("Home") //Go home, largely replaces the old Return
@@ -119,75 +122,3 @@
if((honkamt > 0) && (prob(60)))//For clown virus.
honkamt--
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
// Reference only, TODO: Remove
/obj/item/device/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/weapon/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

View File

@@ -91,64 +91,6 @@
if(radio_controller)
radio_controller.add_object(src, control_freq, radio_filter = bot_filter)
/obj/item/radio/integrated/beepsky
bot_filter = RADIO_SECBOT
bot_type = "secbot"
/obj/item/radio/integrated/mule
bot_filter = RADIO_MULEBOT
bot_type = "mulebot"
/obj/item/radio/integrated/mule/proc/GetBeaconList()
var/list/beaconlist = list()
for(var/obj/machinery/navbeacon/N in navbeacons)
if(!N.codes["delivery"])
continue
beaconlist.Add(N.location)
beaconlist[N.location] = N
return beaconlist
/obj/item/radio/integrated/mule/Topic(href, href_list)
..()
switch(href_list["op"])
if("start")
spawn(0)
post_signal(control_freq, "command", "start", "active", active, s_filter = RADIO_MULEBOT)
if("unload")
spawn(0)
post_signal(control_freq, "command", "unload", "active", active, s_filter = RADIO_MULEBOT)
if("setdest")
var/dest
var/list/beaconlist = GetBeaconList()
if(LAZYLEN(beaconlist))
dest = input("Select Bot Destination", "Mulebot [active.suffix] Interlink", active.target) as null|anything in beaconlist
else
alert("No destination beacons available.")
if(dest)
spawn(0)
post_signal(control_freq, "command", "target", "active", active, "destination", dest, s_filter = RADIO_MULEBOT)
if("retoff")
spawn(0)
post_signal(control_freq, "command", "autoret", "active", active, "value", 0, s_filter = RADIO_MULEBOT)
if("reton")
spawn(0)
post_signal(control_freq, "command", "autoret", "active", active, "value", 1, s_filter = RADIO_MULEBOT)
if("pickoff")
spawn(0)
post_signal(control_freq, "command", "autopick", "active", active, "value", 0, s_filter = RADIO_MULEBOT)
if("pickon")
spawn(0)
post_signal(control_freq, "command", "autopick", "active", active, "value", 1, s_filter = RADIO_MULEBOT)
spawn(10)
post_signal(control_freq, "command", "bot_status", "active", active, s_filter = RADIO_MULEBOT)
/*
* Radio Cartridge, essentially a signaler.
*/

View File

@@ -112,7 +112,10 @@ var/list/infomorph_emotions = list(
pda.ownjob = "Sleevecard"
pda.owner = text("[]", src)
pda.name = pda.owner + " (" + pda.ownjob + ")"
pda.toff = 1
var/datum/data/pda/app/messenger/M = pda.find_program(/datum/data/pda/app/messenger)
if(M)
M.toff = TRUE
..()

View File

@@ -1,80 +0,0 @@
<!-- pAI messenger
code/modules/mob/living/silicon/pai/software_modules.dm
-->
<div class="item">
<div class="itemLabel">
Receiver:
</div>
<div class="itemContent">
{{if data.receiver_off}}
{{:helper.link("On", '', {"stopic":"messenger", "toggler":1})}}
{{:helper.link("Off", '', {"stopic":"messenger", "toggler":2}, 'selected')}}
{{else}}
{{:helper.link("On", '', {"stopic":"messenger", "toggler":1}, 'selected')}}
{{:helper.link("Off", '', {"stopic":"messenger", "toggler":2})}}
{{/if}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Ringer:
</div>
<div class="itemContent">
{{if data.ringer_off}}
{{:helper.link("On", '', {"stopic":"messenger", "ringer":1})}}
{{:helper.link("Off", '', {"stopic":"messenger", "ringer":2}, 'selected')}}
{{else}}
{{:helper.link("On", '', {"stopic":"messenger", "ringer":1}, 'selected')}}
{{:helper.link("Off", '', {"stopic":"messenger", "ringer":2})}}
{{/if}}
</div>
</div>
{{for data.pdas}}
<div class="item">
{{:helper.link(value.name, '', {"stopic":"messenger", "select":value.owner})}}
{{:helper.link("Quick Message", '', {"stopic":"messenger", "target":value.ref})}}
</div>
{{/for}}
<hr/>
{{if data.current_ref}}
<div class="item">
<div class="itemLabel">
Selected PDA:
</div>
<div class="itemContent">
<div style="float: left; width: 80px; text-align: center;">{{:data.current_name}}</div>
{{:helper.link("Send Message", '', {"stopic":"messenger", "target":data.current_ref})}}
</div>
</div>
{{else data.current_name}}
<div class="item">
<div class="itemLabel">
Selected PDA:
</div>
<div class="itemContent">
{{:data.current_name}} (Cannot send!)
</div>
</div>
{{/if}}
{{for data.messages}}
<div class="item">
<div class="itemLabel">
{{if value.sent}}
To {{:value.target}}:
{{else}}
From {{:value.target}}:
{{/if}}
</div>
<div class="itemContent">
{{:value.message}}
</div>
</div>
{{/for}}
{{if data.current_name}}
{{:helper.link("Clear Screen", '', {"stopic":"messenger", "select":"*NONE*"})}}
{{/if}}

View File

@@ -88,7 +88,7 @@ const PDAHeader = (props, context) => {
<Button
color="transparent"
icon="eject"
onClick={() => act("authenticate")}
onClick={() => act("Authenticate")}
content={idLink} />
</Flex.Item>
)}
@@ -97,7 +97,7 @@ const PDAHeader = (props, context) => {
<Button
color="transparent"
icon="eject"
onClick={() => act("eject")}
onClick={() => act("Eject")}
content={cartridge_name} />
</Flex.Item>
)}
@@ -105,7 +105,7 @@ const PDAHeader = (props, context) => {
<Button
icon="cog"
color="transparent"
content="Toggle R.E.T.R.O. Mode"
content={"Retro Theme"}
onClick={() => act("Retro")} />
</Flex.Item>
<Flex.Item>
@@ -123,10 +123,11 @@ const PDAFooter = (props, context) => {
const {
app,
useRetro,
} = data;
return (
<Box position="fixed" bottom="0%" left="0%" right="0%">
<Box position="fixed" bottom="0%" left="0%" right="0%" backgroundColor={useRetro ? "#6f7961" : "#1b1b1b"}>
<Flex>
<Flex.Item basis="33%">
<Button

View File

@@ -4,6 +4,18 @@ import { Button, Grid, NumberInput, Section } from '../components';
import { Window } from '../layouts';
export const Signaler = (props, context) => {
return (
<Window
width={280}
height={132}>
<Window.Content>
<SignalerContent />
</Window.Content>
</Window>
);
};
export const SignalerContent = (props, context) => {
const { act, data } = useBackend(context);
const {
code,
@@ -12,10 +24,6 @@ export const Signaler = (props, context) => {
maxFrequency,
} = data;
return (
<Window
width={280}
height={132}>
<Window.Content>
<Section>
<Grid>
<Grid.Column size={1.4} color="label">
@@ -85,7 +93,5 @@ export const Signaler = (props, context) => {
</Grid.Column>
</Grid>
</Section>
</Window.Content>
</Window>
);
};

View File

@@ -33,9 +33,15 @@ export const pda_main_menu = (props, context) => {
</Box>
<Section level={2} title="Functions">
<LabeledList>
{categories.map(name => (
{categories.map(name => {
let apps = data.apps[name];
if (!apps || !apps.length) {
return null;
} else {
return (
<LabeledList.Item label={name} key={name}>
{data.apps[name].map(app => (
{apps.map(app => (
<Button
key={app.ref}
icon={(app.ref in notifying) ? app.notify_icon : app.icon}
@@ -45,14 +51,16 @@ export const pda_main_menu = (props, context) => {
onClick={() => act("StartProgram", { program: app.ref })} />
))}
</LabeledList.Item>
))}
);
}
})}
</LabeledList>
</Section>
{!!pai && (
<Section level={2} title="pAI">
<Button
fluid
icon="gear"
icon="cog"
content="Configuration"
onClick={() => act("pai", { option: 1 })} />
<Button

View File

@@ -173,7 +173,7 @@ const MessengerList = (props, context) => {
Ringer: {silent ? "Off" : "On"}
</Button>
<Button
selected={!toff}
color={toff ? "bad" : "green"}
icon="power-off"
onClick={() => act("Toggle Messenger")}>
Messenger: {toff ? "Off" : "On"}
@@ -209,6 +209,10 @@ const MessengerList = (props, context) => {
</Box>
)}
</Box>
) || (
<Box color="bad" mt={2}>
Messenger Offline.
</Box>
)}
</Box>
);

View File

@@ -0,0 +1,10 @@
import { filter } from 'common/collections';
import { decodeHtmlEntities, toTitleCase } from 'common/string';
import { Fragment } from 'inferno';
import { useBackend, useLocalState } from "../../backend";
import { Box, Button, Flex, Icon, LabeledList, ProgressBar, Section } from "../../components";
import { SignalerContent } from '../Signaler';
export const pda_signaller = (props, context) => {
return <SignalerContent />;
};

View File

@@ -3071,7 +3071,6 @@
#include "code\modules\pda\cart.dm"
#include "code\modules\pda\cart_apps.dm"
#include "code\modules\pda\cart_vr.dm"
#include "code\modules\pda\chatroom.dm"
#include "code\modules\pda\core_apps.dm"
#include "code\modules\pda\messenger.dm"
#include "code\modules\pda\messenger_plugins.dm"