From 9c41148a08e568e04e9341c3174242462ee63f5e Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Thu, 23 Oct 2014 08:07:43 +0200 Subject: [PATCH] PDA newscaster One can one access and view newsfeeds from the comfort of one's PDA. Possible to change and disable the newsmessage beep. Known issues: Unlike browse() NanoUI does not appear to wait for browse_rsc(), the method which to transfers image to the client's cache, to finish. This often results in newsfeeds not always displaying their images the first time they are viewed. --- .../computer3/computers/crew.dm | 5 +- code/WorkInProgress/periodic_news.dm | 5 +- code/defines/procs/radio.dm | 17 +- code/game/gamemodes/events/ninja_equipment.dm | 6 +- code/game/gamemodes/mutiny/mutiny.dm | 2 +- code/game/machinery/computer/message.dm | 22 +-- code/game/machinery/newscaster.dm | 71 +++++-- code/game/objects/items/devices/PDA/PDA.dm | 176 ++++++++++++++---- code/modules/admin/topic.dm | 8 +- code/modules/economy/Events.dm | 7 +- code/modules/economy/Events_Mundane.dm | 14 +- code/modules/economy/economy_misc.dm | 2 +- code/modules/events/money_lotto.dm | 8 +- code/modules/events/money_spam.dm | 4 +- .../mob/living/silicon/pai/software.dm | 4 +- nano/css/shared.css | 6 + nano/templates/pda.tmpl | 59 +++++- 17 files changed, 286 insertions(+), 130 deletions(-) diff --git a/code/WorkInProgress/computer3/computers/crew.dm b/code/WorkInProgress/computer3/computers/crew.dm index b3ef9398ba..170bd92607 100644 --- a/code/WorkInProgress/computer3/computers/crew.dm +++ b/code/WorkInProgress/computer3/computers/crew.dm @@ -35,10 +35,7 @@ var/life_status = "[H.stat > 1 ? "Deceased" : "Living"]" var/damage_report = "([dam1]/[dam2]/[dam3]/[dam4])" - if(H.wear_id) - log += "[H.wear_id.name]" - else - log += "Unknown" + log += "[H.get_id_name()]" switch(C.sensor_mode) if(1) diff --git a/code/WorkInProgress/periodic_news.dm b/code/WorkInProgress/periodic_news.dm index 22335e4a67..f5219aa435 100644 --- a/code/WorkInProgress/periodic_news.dm +++ b/code/WorkInProgress/periodic_news.dm @@ -149,7 +149,4 @@ proc/announce_newscaster_news(datum/news_announcement/news) newMsg.body = news.message newMsg.message_type = news.message_type - sendto.messages += newMsg - - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert(news.channel_name) + news_network.insert_message_in_channel(sendto, newMsg) diff --git a/code/defines/procs/radio.dm b/code/defines/procs/radio.dm index 45326c1407..0846502ede 100644 --- a/code/defines/procs/radio.dm +++ b/code/defines/procs/radio.dm @@ -58,22 +58,25 @@ //var/telecomms_intact = telecomms_process(P.owner, owner, t) reception.message_server = get_message_server() - var/datum/signal/signal = sender.telecomms_process() + var/datum/signal/signal = sender.telecomms_process() // Be aware that this proc calls sleep, to simulate transmition delays reception.telecomms_reception |= get_sender_reception(sender, signal) reception.telecomms_reception |= get_receiver_reception(receiver, signal) reception.message = signal && signal.data["compression"] > 0 ? Gibberish(message, signal.data["compression"] + 50) : message return reception -/proc/get_receptions(var/atom/sender, var/list/receivers) +/proc/get_receptions(var/atom/sender, var/list/atom/receivers) var/datum/receptions/receptions = new receptions.message_server = get_message_server() - var/datum/signal/signal = sender.telecomms_process() - receptions.sender_reception = get_sender_reception(sender, signal) + var/datum/signal/signal + if(sender) + signal = sender.telecomms_process() + receptions.sender_reception = get_sender_reception(sender, signal) - if(receptions.sender_reception) - for(var/receiver in receivers) - receptions.receiver_reception[receiver] = get_receiver_reception(receiver, signal) + for(var/atom/receiver in receivers) + if(!signal) + signal = receiver.telecomms_process() + receptions.receiver_reception[receiver] = get_receiver_reception(receiver, signal) return receptions diff --git a/code/game/gamemodes/events/ninja_equipment.dm b/code/game/gamemodes/events/ninja_equipment.dm index e2dba90378..48b99580fd 100644 --- a/code/game/gamemodes/events/ninja_equipment.dm +++ b/code/game/gamemodes/events/ninja_equipment.dm @@ -530,12 +530,12 @@ ________________________________________________________________________________ display_spideros() return P.tnote += "← From [!s_control?(A):"an unknown source"]:
[t]
" - if (!P.silent) + if (!P.message_silent) playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) for (var/mob/O in hearers(3, P.loc)) O.show_message(text("\icon[P] *[P.ttone]*")) - P.overlays.Cut() - P.overlays += image('icons/obj/pda.dmi', "pda-r") + P.new_message = 1 + P.update_icon() if("Inject") if( (href_list["tag"]=="radium"? (reagents.get_reagent_amount("radium"))<=(a_boost*a_transfer) : !reagents.get_reagent_amount(href_list["tag"])) )//Special case for radium. If there are only a_boost*a_transfer radium units left. diff --git a/code/game/gamemodes/mutiny/mutiny.dm b/code/game/gamemodes/mutiny/mutiny.dm index 4e4170d02c..78e16e50a4 100644 --- a/code/game/gamemodes/mutiny/mutiny.dm +++ b/code/game/gamemodes/mutiny/mutiny.dm @@ -103,7 +103,7 @@ datum/game_mode/mutiny if (!pda) return 0 - if (!pda.silent) + if (!pda.message_silent) playsound(pda.loc, 'sound/machines/twobeep.ogg', 50, 1) for (var/mob/O in hearers(3, pda.loc)) O.show_message(text("\icon[pda] *[pda.ttone]*")) diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 120e274e63..9a5ad3ed3b 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -458,16 +458,7 @@ //Sender isn't faking as someone who exists if(isnull(PDARec)) src.linkedServer.send_pda_message("[customrecepient.owner]", "[customsender]","[custommessage]") - if (!customrecepient.silent) - playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, customrecepient.loc)) - O.show_message(text("\icon[customrecepient] *[customrecepient.ttone]*")) - if( customrecepient.loc && ishuman(customrecepient.loc) ) - var/mob/living/carbon/human/H = customrecepient.loc - H << "\icon[customrecepient] Message from [customsender] ([customjob]), \"[custommessage]\" (Reply)" - log_pda("[usr] (PDA: [customsender]) sent \"[custommessage]\" to [customrecepient.owner]") - customrecepient.overlays.Cut() - customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r") + customrecepient.new_message(customsender, customsender, customjob, custommessage) //Sender is faking as someone who exists else @@ -477,16 +468,7 @@ if(!customrecepient.conversations.Find("\ref[PDARec]")) customrecepient.conversations.Add("\ref[PDARec]") - if (!customrecepient.silent) - playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, customrecepient.loc)) - O.show_message(text("\icon[customrecepient] *[customrecepient.ttone]*")) - if( customrecepient.loc && ishuman(customrecepient.loc) ) - var/mob/living/carbon/human/H = customrecepient.loc - H << "\icon[customrecepient] Message from [PDARec.owner] ([customjob]), \"[custommessage]\" (Reply)" - log_pda("[usr] (PDA: [PDARec.owner]) sent \"[custommessage]\" to [customrecepient.owner]") - customrecepient.overlays.Cut() - customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r") + customrecepient.new_message(PDARec, custommessage) //Finally.. ResetMessage() diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 968d03a5e0..6d627bacbb 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -6,7 +6,7 @@ var/author ="" var/body ="" var/message_type ="Story" - //var/parent_channel + var/datum/feed_channel/parent_channel var/backup_body ="" var/backup_author ="" var/is_admin_message = 0 @@ -22,8 +22,15 @@ var/backup_author="" var/censored=0 var/is_admin_channel=0 + var/updated = 0 //var/page = null //For newspapers +/datum/feed_channel/proc/announce_news() + return "Breaking news from [channel_name]!" + +/datum/feed_channel/station/announce_news() + return "New Station Announcement Available" + /datum/feed_message/proc/clear() src.author = "" src.body = "" @@ -31,6 +38,10 @@ src.backup_author = "" src.img = null src.backup_img = null + parent_channel.update() + +/datum/feed_channel/proc/update() + updated = world.time /datum/feed_channel/proc/clear() src.channel_name = "" @@ -40,11 +51,47 @@ src.backup_author = "" src.censored = 0 src.is_admin_channel = 0 + update() /datum/feed_network var/list/datum/feed_channel/network_channels = list() var/datum/feed_message/wanted_issue +/datum/feed_network/proc/add_news(var/channel_name, var/datum/feed_message/newMsg) + for(var/datum/feed_channel/FC in news_network.network_channels) + if(FC.channel_name == channel_name) + insert_message_in_channel(FC, newMsg) + break + +/datum/feed_network/proc/insert_message_in_channel(var/datum/feed_channel/FC, var/datum/feed_message/newMsg) + FC.messages += newMsg //Adding message to the network's appropriate feed_channel + newMsg.parent_channel = FC + FC.update() + var/announcement = FC.announce_news() + alert_readers(announcement) + +/datum/feed_network/proc/alert_readers(var/annoncement) + for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) + 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 + + 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 + + PDA.new_news(annoncement) + var/datum/feed_network/news_network = new /datum/feed_network //The global news-network, which is coincidentally a global list. var/list/obj/machinery/newscaster/allCasters = list() //Global list that will contain reference to all newscasters in existence. @@ -506,13 +553,8 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(photo) newMsg.img = photo.img feedback_inc("newscaster_stories",1) - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == src.channel_name) - FC.messages += newMsg //Adding message to the network's appropriate feed_channel - break + news_network.add_news(src.channel_name, newMsg) src.screen=4 - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert(src.channel_name) src.updateUsrDialog() @@ -581,9 +623,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(photo) WANTED.img = photo.img news_network.wanted_issue = WANTED - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert() - NEWSCASTER.update_icon() + news_network.alert_readers() src.screen = 15 else if(news_network.wanted_issue.is_admin_message) @@ -623,6 +663,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co FC.author = "\[REDACTED\]" else FC.author = FC.backup_author + FC.update() src.updateUsrDialog() else if(href_list["censor_channel_story_author"]) @@ -635,6 +676,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co MSG.author = "\[REDACTED\]" else MSG.author = MSG.backup_author + MSG.parent_channel.update() src.updateUsrDialog() else if(href_list["censor_channel_story_body"]) @@ -652,6 +694,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co MSG.body = "\[REDACTED\]" else MSG.body = MSG.backup_body + MSG.parent_channel.update() src.updateUsrDialog() else if(href_list["pick_d_notice"]) @@ -666,6 +709,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co alert("This channel was created by a Nanotrasen Officer. You cannot place a D-Notice upon it.","Ok") return FC.censored = !FC.censored + FC.update() src.updateUsrDialog() else if(href_list["view"]) @@ -698,6 +742,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co src.updateUsrDialog() + /obj/machinery/newscaster/attackby(obj/item/I as obj, mob/user as mob) /* if (istype(I, /obj/item/weapon/card/id) || istype(I, /obj/item/device/pda) ) //Name verification for channels or messages @@ -959,11 +1004,11 @@ obj/item/weapon/newspaper/attackby(obj/item/weapon/W as obj, mob/user as mob) ///obj/machinery/newscaster/process() //Was thinking of doing the icon update through process, but multiple iterations per second does not // return //bode well with a newscaster network of 10+ machines. Let's just return it, as it's added in the machines list. -/obj/machinery/newscaster/proc/newsAlert(channel) //This isn't Agouri's work, for it is ugly and vile. +/obj/machinery/newscaster/proc/newsAlert(var/news_call) //This isn't Agouri's work, for it is ugly and vile. var/turf/T = get_turf(src) //Who the fuck uses spawn(600) anyway, jesus christ - if(channel) + if(news_call) for(var/mob/O in hearers(world.view-1, T)) - O.show_message("[src.name] beeps, \"Breaking news from [channel]!\"",2) + O.show_message("[src.name] beeps, \"[news_call]\"",2) src.alert = 1 src.update_icon() spawn(300) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index c63592cd08..ef22d80f42 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -21,17 +21,20 @@ var/global/list/obj/item/device/pda/PDAs = list() var/lastmode = 0 var/ui_tick = 0 + var/nanoUI[0] //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/silent = 0 //To beep or not to beep, that is the question + var/message_silent = 0 //To beep or not to beep, that is the question + var/news_silent = 0 //To beep or not to beep, that is the question 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/ttone = "beep" //The ringtone! + var/ttone = "beep" //The PDA ringtone! + 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 @@ -42,7 +45,13 @@ var/global/list/obj/item/device/pda/PDAs = list() 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/new_message = 0 //To remove hackish overlay check + var/new_news = 0 + + 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 @@ -101,8 +110,10 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/mime default_cartridge = /obj/item/weapon/cartridge/mime icon_state = "pda-mime" - silent = 1 + message_silent = 1 + news_silent = 1 ttone = "silence" + newstone = "silence" /obj/item/device/pda/heads default_cartridge = /obj/item/weapon/cartridge/head @@ -172,7 +183,8 @@ var/global/list/obj/item/device/pda/PDAs = list() 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!" - silent = 1 //Quiet in the library! + message_silent = 1 //Quiet in the library! + news_silent = 1 /obj/item/device/pda/clear icon_state = "pda-transp" @@ -202,6 +214,7 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/ai icon_state = "NONE" ttone = "data" + newstone = "news" detonate = 0 @@ -246,8 +259,8 @@ var/global/list/obj/item/device/pda/PDAs = list() if(usr.stat == 2) usr << "You can't do that because you are dead!" return - silent=!silent - usr << "PDA ringer toggled [(silent ? "Off" : "On")]!" + message_silent=!message_silent + usr << "PDA ringer toggled [(message_silent ? "Off" : "On")]!" /obj/item/device/pda/ai/verb/cmd_show_message_log() @@ -355,7 +368,8 @@ var/global/list/obj/item/device/pda/PDAs = list() 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["message_silent"] = message_silent // does the pda make noise when it receives a message? + data["news_silent"] = news_silent // does the pda make noise when it receives news? data["toff"] = toff // is the messenger function turned off? data["active_conversation"] = active_conversation // Which conversation are we following right now? @@ -402,7 +416,8 @@ var/global/list/obj/item/device/pda/PDAs = list() data["cartridge"] = cartdata data["stationTime"] = worldtime2text() - data["newMessage"] = newmessage + data["new_Message"] = new_message + data["new_News"] = new_news if(mode==2) var/convopdas[0] @@ -463,7 +478,45 @@ var/global/list/obj/item/device/pda/PDAs = list() ) if(isnull(data["aircontents"])) data["aircontents"] = list("reading" = 0) + if(mode==6) + if(news_network.network_channels.len != feeds.len) + var/datum/reception/reception = get_reception(src) + if(reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER) + feeds.Cut() + for(var/datum/feed_channel/channel in news_network.network_channels) + feeds[++feeds.len] = list("name" = channel.channel_name, "censored" = channel.censored) + data["feedChannels"] = feeds + if(mode==61) + var/list/feed = feed_info[active_feed] + if(!feed) + feed = list() + feed["updated"] = -1 + feed_info[active_feed] = feed + var/datum/feed_channel/FC + for(FC in news_network.network_channels) + if(FC.channel_name == active_feed["name"]) + break + if(FC.updated > feed["updated"]) + var/datum/reception/reception = get_reception(src) + if(reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER) + feed["channel"] = FC.channel_name + feed["author"] = FC.author + feed["updated"] = FC.updated + feed["censored"] = FC.censored + + var/list/messages = list() + if(!FC.censored) + var/index = 0 + for(var/datum/feed_message/FM in FC.messages) + index++ + if(FM.img) + usr << browse_rsc(FM.img, "pda_news_tmp_photo_[feed["channel"]]_[index].png") + messages[++messages.len] = list("author" = FM.author, "body" = FM.body, "message_type" = FM.message_type, "has_image" = (FM.img != null), "index" = index) + feed["messages"] = messages + data["feed"] = feed + + nanoUI = data // update the ui if it exists, returns null if no ui is passed/found ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -622,7 +675,9 @@ var/global/list/obj/item/device/pda/PDAs = list() if("Toggle Messenger") toff = !toff if("Toggle Ringer")//If viewing texts then erase them, if not then toggle silent status - silent = !silent + message_silent = !message_silent + if("Toggle News") + news_silent = !news_silent if("Clear")//Clears messages if(href_list["option"] == "All") tnote.Cut() @@ -652,6 +707,15 @@ var/global/list/obj/item/device/pda/PDAs = list() else ui.close() return 0 + if("Newstone") + var/t = input(U, "Please enter new news tone", name, newstone) as text + if (in_range(src, U) && loc == U) + if (t) + t = copytext(sanitize(t), 1, 20) + newstone = t + else + ui.close() + return 0 if("Message") var/obj/item/device/pda/P = locate(href_list["target"]) @@ -667,6 +731,12 @@ var/global/list/obj/item/device/pda/PDAs = list() if(P == n) active_conversation=P mode=21 + if("Select Feed") + var/n = href_list["name"] + for(var/f in feeds) + if(f["name"] == n) + active_feed = f + mode=61 if("Send Honk")//Honk virus if(cartridge && cartridge.access_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. @@ -687,8 +757,10 @@ var/global/list/obj/item/device/pda/PDAs = list() if (!P.toff && cartridge.charges > 0) cartridge.charges-- U.show_message("\blue Virus sent!", 1) - P.silent = 1 + P.message_silent = 1 + P.news_silent = 1 P.ttone = "silence" + P.newstone = "silence" else U << "PDA not found." else @@ -710,7 +782,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if("Detonate")//Detonate PDA... maybe if(cartridge && cartridge.access_detonate_pda) var/obj/item/device/pda/P = locate(href_list["target"]) - var/datum/reception/reception = get_reception(src, P, "") + var/datum/reception/reception = get_reception(src, P, "") // get_reception calls sleep further down the line if(!(reception.message_server && reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER)) U.show_message("\red An error flashes on your [src]: Connection unavailable", 1) return @@ -776,8 +848,12 @@ var/global/list/obj/item/device/pda/PDAs = list() //EXTRA FUNCTIONS=================================== if (mode == 2||mode == 21)//To clear message overlays. - overlays.Cut() - newmessage = 0 + new_message = 0 + update_icon() + + if (mode == 6||mode == 61)//To clear news overlays. + new_news = 0 + update_icon() if ((honkamt > 0) && (prob(60)))//For clown virus. honkamt-- @@ -785,6 +861,13 @@ var/global/list/obj/item/device/pda/PDAs = list() return 1 // return 1 tells it to refresh the UI in NanoUI +/obj/item/device/pda/update_icon() + ..() + + overlays.Cut() + if(new_message || new_news) + overlays += image('icons/obj/pda.dmi', "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) @@ -883,7 +966,7 @@ var/global/list/obj/item/device/pda/PDAs = list() 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.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? U << "ERROR: Cannot reach recipient." return @@ -915,33 +998,48 @@ var/global/list/obj/item/device/pda/PDAs = list() if(ai.aiPDA != P && ai.aiPDA != src) ai.show_message("Intercepted message from [who]: [t]") - - if (!P.silent) - playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, P.loc)) - if(!P.silent) O.show_message(text("\icon[P] *[P.ttone]*")) - //Search for holder of the PDA. - var/mob/living/L = null - if(P.loc && isliving(P.loc)) - L = P.loc - //Maybe they are a pAI! - else - L = get(P, /mob/living/silicon) - - - if(L) - L << "\icon[P] Message from [src.owner] ([ownjob]), \"[t]\" (Reply)" - nanomanager.update_user_uis(L, P) // Update the receiving user's PDA UI so that they can see the new message - - nanomanager.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message - - 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 + P.new_message_from_pda(src, t) + nanomanager.update_user_uis(U, src) // Update the sending user's PDA UI so that they can see the new message else U << "ERROR: Messaging server is not responding." +/obj/item/device/pda/proc/new_info(var/beep_silent, var/message_tone, var/reception_message) + if (!beep_silent) + playsound(loc, 'sound/machines/twobeep.ogg', 50, 1) + for (var/mob/O in hearers(3, loc)) + O.show_message(text("\icon[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) + L << reception_message + nanomanager.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 ? "" : "\icon[src] [message]") + + new_news = 1 + update_icon() + +/obj/item/device/pda/ai/new_news(var/message) + // Do nothing + +/obj/item/device/pda/proc/new_message_from_pda(var/obj/item/device/pda/sending_device, var/message) + new_message(sending_device.name, 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/reception_message = "\icon[src] Message from [sender] ([sender_job]), \"[message]\" (Reply)" + new_info(news_silent, newstone, reception_message) + + log_pda("[usr] (PDA: [sending_unit]) sent \"[message]\" to [name]") + new_message = 1 + update_icon() /obj/item/device/pda/verb/verb_remove_id() set category = "Object" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index c4dc3a0e56..e2fc6dba68 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2566,15 +2566,9 @@ newMsg.body = src.admincaster_feed_message.body newMsg.is_admin_message = 1 feedback_inc("newscaster_stories",1) - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == src.admincaster_feed_channel.channel_name) - FC.messages += newMsg //Adding message to the network's appropriate feed_channel - break + news_network.add_news(src.admincaster_feed_channel.channel_name, newMsg) src.admincaster_screen=4 - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert(src.admincaster_feed_channel.channel_name) - log_admin("[key_name_admin(usr)] submitted a feed story to channel: [src.admincaster_feed_channel.channel_name]!") src.access_news_network() diff --git a/code/modules/economy/Events.dm b/code/modules/economy/Events.dm index 070ba5449a..5770e95026 100644 --- a/code/modules/economy/Events.dm +++ b/code/modules/economy/Events.dm @@ -91,12 +91,7 @@ if(FESTIVAL) newMsg.body = "A [pick("festival","week long celebration","day of revelry","planet-wide holiday")] has been declared on [affected_dest.name] by [pick("Governor","Commissioner","General","Commandant","Administrator")] [random_name(pick(MALE,FEMALE))] to celebrate [pick("the birth of their [pick("son","daughter")]","coming of age of their [pick("son","daughter")]","the pacification of rogue military cell","the apprehension of a violent criminal who had been terrorising the planet")]. Massive stocks of food and meat have been bought driving up prices across the planet." - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == "Nyx Daily") - FC.messages += newMsg - break - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert("Nyx Daily") + news_network.add_news("Nyx Daily", newMsg) /datum/event/economic_event/end() for(var/good_type in dearer_goods) diff --git a/code/modules/economy/Events_Mundane.dm b/code/modules/economy/Events_Mundane.dm index 0a381a7ce7..df2a92e01c 100644 --- a/code/modules/economy/Events_Mundane.dm +++ b/code/modules/economy/Events_Mundane.dm @@ -124,12 +124,7 @@ "a huge new ARG by a popular entertainment company","a secret tour by popular artiste [random_name(pick(MALE,FEMALE))]")]. \ Nyx Daily is offering discount tickets for two to see [random_name(pick(MALE,FEMALE))] live in return for eyewitness reports and up to the minute coverage." - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == "Nyx Daily") - FC.messages += newMsg - break - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert("Nyx Daily") + news_network.add_news("Nyx Daily", newMsg) /datum/event/trivial_news endWhen = 10 @@ -225,9 +220,4 @@ "Broccoli discovered to be colonies of tiny aliens with murder on their minds"\ ) - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == "The Gibson Gazette") - FC.messages += newMsg - break - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert("The Gibson Gazette") + news_network.add_news("The Gibson Gazette", newMsg) diff --git a/code/modules/economy/economy_misc.dm b/code/modules/economy/economy_misc.dm index 02d3a4e0e2..abc2c0ca91 100644 --- a/code/modules/economy/economy_misc.dm +++ b/code/modules/economy/economy_misc.dm @@ -77,7 +77,7 @@ var/global/economy_init = 0 if(economy_init) return 2 - var/datum/feed_channel/newChannel = new /datum/feed_channel + var/datum/feed_channel/newChannel = new /datum/feed_channel/station newChannel.channel_name = "Public Station Announcements" newChannel.author = "Automated Announcement Listing" newChannel.locked = 1 diff --git a/code/modules/events/money_lotto.dm b/code/modules/events/money_lotto.dm index 0c923d172e..5a518eca32 100644 --- a/code/modules/events/money_lotto.dm +++ b/code/modules/events/money_lotto.dm @@ -31,10 +31,4 @@ if(!deposit_success) newMsg.body += "
Unfortunately, we were unable to verify the account details provided, so we were unable to transfer the money. Send a cheque containing the sum of $500 to ND 'Stellar Slam' office on the Nyx gateway containing updated details, and your winnings'll be re-sent within the month." - for(var/datum/feed_channel/FC in news_network.network_channels) - if(FC.channel_name == "Nyx Daily") - FC.messages += newMsg - break - - for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) - NEWSCASTER.newsAlert("Nyx Daily") + news_network.add_news("Nyx Daily", newMsg) diff --git a/code/modules/events/money_spam.dm b/code/modules/events/money_spam.dm index 584da51fcc..acb6e7f00a 100644 --- a/code/modules/events/money_spam.dm +++ b/code/modules/events/money_spam.dm @@ -104,10 +104,10 @@ //Commented out because we don't send messages like this anymore. Instead it will just popup in their chat window. //P.tnote += "← From [sender] (Unknown / spam?):
[message]
" - if (!P.silent) + if (!P.message_silent) playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) for (var/mob/O in hearers(3, P.loc)) - if(!P.silent) O.show_message(text("\icon[P] *[P.ttone]*")) + if(!P.message_silent) O.show_message(text("\icon[P] *[P.ttone]*")) //Search for holder of the PDA. var/mob/living/L = null if(P.loc && isliving(P.loc)) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index e5b273c060..4366b24fe9 100755 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -223,7 +223,7 @@ if(href_list["toggler"]) pda.toff = !pda.toff else if(href_list["ringer"]) - pda.silent = !pda.silent + pda.message_silent = !pda.message_silent else if(href_list["target"]) if(silence_time) return alert("Communications circuits remain uninitialized.") @@ -668,7 +668,7 @@ dat += {"Signal/Receiver Status: [(pda.toff) ? " \[Off\]" : " \[On\]"]
Ringer Status: - [(pda.silent) ? " \[Off\]" : " \[On\]"]

"} + [(pda.message_silent) ? " \[Off\]" : " \[On\]"]

"} dat += "