Merge pull request #6515 from Crazylemon64/fast_servermonitor

Telecomms monitor is speedier now
This commit is contained in:
Fox McCloud
2017-02-24 23:25:47 -05:00
committed by GitHub
8 changed files with 58 additions and 48 deletions
+10
View File
@@ -129,11 +129,21 @@
#define isswarmer(A) (istype((A), /mob/living/simple_animal/hostile/swarmer))
#define isguardian(A) (istype((A), /mob/living/simple_animal/hostile/guardian))
#define issilicon(A) (istype((A), /mob/living/silicon))
#define isAI(A) (istype((A), /mob/living/silicon/ai))
#define isrobot(A) (istype((A), /mob/living/silicon/robot))
#define ispAI(A) (istype((A), /mob/living/silicon/pai))
// For the tcomms monitor
#define ispathhuman(A) (ispath(A, /mob/living/carbon/human))
#define ispathbrain(A) (ispath(A, /mob/living/carbon/brain))
#define ispathslime(A) (ispath(A, /mob/living/carbon/slime))
#define ispathbot(A) (ispath(A, /mob/living/simple_animal/bot))
#define ispathsilicon(A) (ispath(A, /mob/living/silicon))
#define ispathanimal(A) (ispath(A, /mob/living/simple_animal))
#define isAutoAnnouncer(A) (istype((A), /mob/living/automatedannouncer))
#define isAIEye(A) (istype((A), /mob/camera/aiEye))
+18
View File
@@ -347,3 +347,21 @@ var/global/datum/controller/radio/radio_controller
var/list/L = data[i]
for(var/t in L)
. += "data\[\"[i]\"\] list has: [t]"
/datum/signal/proc/get_race(mob/M)
if(ishuman(M))
var/mob/living/carbon/human/H = M
. = H.species.name
else if(isbrain(M))
var/mob/living/carbon/brain/B = M
. = B.get_race()
else if(issilicon(M))
. = "Artificial Life"
else if(isslime(M))
. = "Slime"
else if(isbot(M))
. = "Bot"
else if(isanimal(M))
. = "Domestic Animal"
else
. = "Unidentifiable"
+4
View File
@@ -426,3 +426,7 @@ var/global/list/bad_blocks[0]
species = data["species"]
b_type = data["b_type"]
real_name = data["real_name"]
// a nice hook for if/when we refactor species on dna
/datum/dna/proc/get_species_name()
return species
+6 -44
View File
@@ -24,7 +24,8 @@
if(stat & (BROKEN|NOPOWER))
return
user.set_machine(src)
var/dat = "<TITLE>Telecommunication Server Monitor</TITLE><center><b>Telecommunications Server Monitor</b></center>"
var/list/dat = list()
dat += "<TITLE>Telecommunication Server Monitor</TITLE><center><b>Telecommunications Server Monitor</b></center>"
switch(screen)
@@ -63,55 +64,16 @@
var/i = 0
for(var/datum/comm_log_entry/C in SelectedServer.log_entries)
i++
// If the log is a speech file
if(C.input_type == "Speech File")
dat += "<li><font color = #008F00>[C.name]</font color> <font color = #FF0000><a href='?src=[UID()];delete=[i]'>\[X\]</a></font color><br>"
// -- Determine race of orator --
var/race // The actual race of the mob
var/language = "Human" // MMIs, pAIs, Cyborgs and humans all speak Human
var/mobtype = C.parameters["mobtype"]
var/mob/M = new mobtype
if(ishuman(M) || isbrain(M))
var/mob/living/carbon/human/H = M
race = "[H.species.name]"
else if(issmall(M))
race = "Monkey"
language = race
else if(issilicon(M) || C.parameters["job"] == "AI") // sometimes M gets deleted prematurely for AIs... just check the job
race = "Artificial Life"
else if(isslime(M)) // NT knows a lot about slimes, but not aliens. Can identify slimes
race = "Slime"
language = race
else if(isbot(M))
race = "Bot"
else if(isanimal(M))
race = "Domestic Animal"
language = race
else
race = "<i>Unidentifiable</i>"
language = race
qdel(M)
// -- If the orator is a human, or universal translate is active, OR mob has universal speech on --
if(language == "Human" || universal_translate || C.parameters["uspeech"])
if(user.say_understands(null, C.parameters["language"]) || universal_translate || C.parameters["uspeech"])
dat += "<u><font color = #18743E>Data type</font color></u>: [C.input_type]<br>"
dat += "<u><font color = #18743E>Source</font color></u>: [C.parameters["name"]] (Job: [C.parameters["job"]])<br>"
dat += "<u><font color = #18743E>Class</font color></u>: [race]<br>"
dat += "<u><font color = #18743E>Class</font color></u>: [C.parameters["race"]]<br>"
dat += "<u><font color = #18743E>Contents</font color></u>: \"[C.parameters["message"]]\"<br>"
@@ -120,7 +82,7 @@
else
dat += "<u><font color = #18743E>Data type</font color></u>: Audio File<br>"
dat += "<u><font color = #18743E>Source</font color></u>: <i>Unidentifiable</i><br>"
dat += "<u><font color = #18743E>Class</font color></u>: [race]<br>"
dat += "<u><font color = #18743E>Class</font color></u>: [C.parameters["race"]]<br>"
dat += "<u><font color = #18743E>Contents</font color></u>: <i>Unintelligble</i><br>"
dat += "</li><br>"
@@ -136,7 +98,7 @@
user << browse(dat, "window=comm_monitor;size=575x400")
user << browse(dat.Join(""), "window=comm_monitor;size=575x400")
onclose(user, "server_control")
temp = ""
@@ -475,7 +475,9 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
// Copy the signal.data entries we want
log.parameters["mobtype"] = signal.data["mobtype"]
log.parameters["race"] = signal.data["race"]
log.parameters["job"] = signal.data["job"]
log.parameters["language"] = signal.data["language"]
log.parameters["key"] = signal.data["key"]
log.parameters["vmessage"] = signal.data["message"]
log.parameters["vname"] = signal.data["vname"]
@@ -401,6 +401,7 @@ var/global/list/default_medbay_channels = list(
// Identity-associated tags:
"mob" = M, // store a reference to the mob
"mobtype" = M.type, // the mob's type
"race" = signal.get_race(M),
"realname" = real_name, // the mob's real name
"name" = displayname, // the mob's display name
"job" = jobname, // the mob's job
@@ -462,6 +463,7 @@ var/global/list/default_medbay_channels = list(
"mob" = M, // store a reference to the mob
"mobtype" = M.type, // the mob's type
"race" = signal.get_race(M), // text to show next to mob in comms log console
"realname" = real_name, // the mob's real name
"name" = displayname, // the mob's display name
"job" = jobname, // the mob's job
@@ -560,7 +562,7 @@ var/global/list/default_medbay_channels = list(
var/range = receive_range(freq, level)
if(range > -1)
return get_mobs_in_view(canhear_range, src)
/obj/item/device/radio/proc/is_listening()
var/is_listening = TRUE
if(!on)
@@ -571,11 +573,11 @@ var/global/list/default_medbay_channels = list(
is_listening = FALSE
return is_listening
/obj/item/device/radio/proc/send_announcement()
if(is_listening())
return get_mobs_in_view(canhear_range, src)
return null
/obj/item/device/radio/examine(mob/user, var/distance = -1)
@@ -82,6 +82,17 @@ I'm using this for Stat to give it a more nifty interface to work with
/mob/living/carbon/brain/proc/has_synthetic_assistance()
return (container && istype(container, /obj/item/device/mmi)) || in_contents_of(/obj/mecha)
/mob/living/carbon/brain/proc/get_race()
if(container)
var/obj/item/device/mmi/M = container
if(istype(M) && M.held_brain)
return M.held_brain.dna.get_species_name()
else
return "Artificial Life"
if(istype(loc, /obj/item/organ/internal/brain))
var/obj/item/organ/internal/brain/B = loc
return B.dna.get_species_name()
/mob/living/carbon/brain/Stat()
..()
if(has_synthetic_assistance())
@@ -321,6 +321,7 @@
newsign.data["mob"] = null
newsign.data["mobtype"] = /mob/living/carbon/human
newsign.data["race"] = "Automated Signal"
newsign.data["name"] = source
newsign.data["realname"] = newsign.data["name"]
newsign.data["job"] = "[job]"
@@ -343,4 +344,4 @@
var/pass = S.relay_information(newsign, "/obj/machinery/telecomms/hub")
if(!pass)
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters