Fixed issue #4439 (Detomax ignores status of messaging server)

This commit is contained in:
Joey Haas
2014-02-17 00:18:28 +01:00
parent cf1a35d8e3
commit 296e839f03

View File

@@ -41,7 +41,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/active_conversation = null // New variable that allows us to only view a single conversation. 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/list/conversations = list() // For keeping up with who we have PDA messsages from.
var/newmessage = 0 //To remove hackish overlay check 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/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 var/ownjob = null //related to above
@@ -321,7 +321,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) /obj/item/device/pda/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
var/title = "Personal Data Assistant" var/title = "Personal Data Assistant"
var/data[0] // This is the data that will be sent to the PDA var/data[0] // This is the data that will be sent to the PDA
@@ -336,7 +336,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
data["silent"] = silent // does the pda make noise when it receives a message? data["silent"] = silent // does the pda make noise when it receives a message?
data["toff"] = toff // is the messenger function turned off? data["toff"] = toff // is the messenger function turned off?
data["active_conversation"] = active_conversation // Which conversation are we following right now? data["active_conversation"] = active_conversation // Which conversation are we following right now?
data["idInserted"] = (id ? 1 : 0) data["idInserted"] = (id ? 1 : 0)
data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------") data["idLink"] = (id ? text("[id.registered_name], [id.assignment]") : "--------")
@@ -375,10 +375,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
cartdata["type"] = cartridge.type cartdata["type"] = cartridge.type
cartdata["charges"] = cartridge.charges ? cartridge.charges : 0 cartdata["charges"] = cartridge.charges ? cartridge.charges : 0
data["cartridge"] = cartdata data["cartridge"] = cartdata
data["stationTime"] = worldtime2text() data["stationTime"] = worldtime2text()
data["newMessage"] = newmessage data["newMessage"] = newmessage
if(mode==2) if(mode==2)
var/convopdas[0] var/convopdas[0]
var/pdas[0] var/pdas[0]
@@ -388,7 +388,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(conversations.Find("\ref[P]")) if(conversations.Find("\ref[P]"))
convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1"))) convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1")))
else else
pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0"))) pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0")))
count++ count++
data["convopdas"] = convopdas data["convopdas"] = convopdas
@@ -411,7 +411,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(mode==41) if(mode==41)
data["manifest"] = data_core.get_manifest_json() data["manifest"] = data_core.get_manifest_json()
if(mode==3) if(mode==3)
var/turf/T = get_turf_or_move(user.loc) var/turf/T = get_turf_or_move(user.loc)
if(!isnull(T) || mode!=3) if(!isnull(T) || mode!=3)
@@ -438,15 +438,15 @@ var/global/list/obj/item/device/pda/PDAs = list()
) )
if(isnull(data["aircontents"])) if(isnull(data["aircontents"]))
data["aircontents"] = list("reading" = 0) data["aircontents"] = list("reading" = 0)
// update the ui if it exists, returns null if no ui is passed/found // 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) ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
if (!ui) if (!ui)
// the ui does not exist, so we'll create a new() one // the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "pda.tmpl", title, 520, 400) ui = new(user, src, ui_key, "pda.tmpl", title, 520, 400)
// when the ui is first opened this is the data it will use // when the ui is first opened this is the data it will use
ui.set_initial_data(data) ui.set_initial_data(data)
// open the new ui window // open the new ui window
ui.open() ui.open()
// auto update every Master Controller tick // auto update every Master Controller tick
@@ -484,17 +484,17 @@ var/global/list/obj/item/device/pda/PDAs = list()
U.unset_machine() U.unset_machine()
ui.close() ui.close()
return 0 return 0
add_fingerprint(U) add_fingerprint(U)
U.set_machine(src) U.set_machine(src)
switch(href_list["choice"]) switch(href_list["choice"])
//BASIC FUNCTIONS=================================== //BASIC FUNCTIONS===================================
if("Close")//Self explanatory if("Close")//Self explanatory
U.unset_machine() U.unset_machine()
ui.close() ui.close()
return 0 return 0
if("Refresh")//Refresh, goes to the end of the proc. if("Refresh")//Refresh, goes to the end of the proc.
if("Return")//Return if("Return")//Return
@@ -518,7 +518,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/turf/T = loc var/turf/T = loc
if(ismob(T)) if(ismob(T))
T = T.loc T = T.loc
cartridge.loc = T cartridge.loc = T
mode = 0 mode = 0
scanmode = 0 scanmode = 0
if (cartridge.radio) if (cartridge.radio)
@@ -682,7 +682,33 @@ var/global/list/obj/item/device/pda/PDAs = list()
M.close() M.close()
if("Detonate")//Detonate PDA if("Detonate")//Detonate PDA
// check if telecomms I/O route 1459 is stable
//var/telecomms_intact = telecomms_process(P.owner, owner, t)
var/obj/machinery/message_server/useMS = null
if(message_servers)
for (var/obj/machinery/message_server/MS in message_servers)
//PDAs are now dependant on the Message Server.
if(MS.active)
useMS = MS
break
var/datum/signal/signal = src.telecomms_process()
var/useTC = 0
if(signal)
if(signal.data["done"])
useTC = 1
var/turf/pos = get_turf(src)
if(pos.z in signal.data["level"])
useTC = 2
if(istype(cartridge, /obj/item/weapon/cartridge/syndicate)) if(istype(cartridge, /obj/item/weapon/cartridge/syndicate))
if(!(useMS && useTC))
U.show_message("\red An error flashes on your [src]: Connection unavailable", 1)
return
if(useTC != 2) // Does our recepient have a broadcaster on their level?
U.show_message("\red An error flashes on your [src]: Recipient unavailable", 1)
return
var/obj/item/device/pda/P = locate(href_list["target"]) var/obj/item/device/pda/P = locate(href_list["target"])
if(!isnull(P)) if(!isnull(P))
if (!P.toff && cartridge.charges > 0) if (!P.toff && cartridge.charges > 0)
@@ -774,7 +800,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(!can_use()) if(!can_use())
return return
last_text = world.time last_text = world.time
// check if telecomms I/O route 1459 is stable // check if telecomms I/O route 1459 is stable
//var/telecomms_intact = telecomms_process(P.owner, owner, t) //var/telecomms_intact = telecomms_process(P.owner, owner, t)
@@ -801,7 +827,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(useMS && useTC) // only send the message if it's stable if(useMS && useTC) // only send the message if it's stable
if(useTC != 2) // Does our recepient have a broadcaster on their level? if(useTC != 2) // Does our recepient have a broadcaster on their level?
U << "ERROR: Cannot reach recepient." U << "ERROR: Cannot reach recipient."
return return
useMS.send_pda_message("[P.owner]","[owner]","[t]") useMS.send_pda_message("[P.owner]","[owner]","[t]")
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]"))) tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]")))
@@ -827,7 +853,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(ai.aiPDA != P && ai.aiPDA != src) if(ai.aiPDA != P && ai.aiPDA != src)
ai.show_message("<i>Intercepted message from <b>[who]</b>: [t]</i>") ai.show_message("<i>Intercepted message from <b>[who]</b>: [t]</i>")
if (!P.silent) if (!P.silent)
playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(3, P.loc)) for (var/mob/O in hearers(3, P.loc))
@@ -844,7 +870,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(L) 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>)" 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>)"
nanomanager.update_user_uis(L, P) // Update the recieving user's PDA UI so that they can see the new message nanomanager.update_user_uis(L, P) // Update the recieving 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 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]") log_pda("[usr] (PDA: [src.name]) sent \"[t]\" to [P.name]")
@@ -926,7 +952,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
user << "<span class='notice'>You insert [cartridge] into [src].</span>" user << "<span class='notice'>You insert [cartridge] into [src].</span>"
nanomanager.update_uis(src) // update all UIs attached to src nanomanager.update_uis(src) // update all UIs attached to src
if(cartridge.radio) if(cartridge.radio)
cartridge.radio.hostpda = src cartridge.radio.hostpda = src
else if(istype(C, /obj/item/weapon/card/id)) else if(istype(C, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/idcard = C var/obj/item/weapon/card/id/idcard = C