From 2f8feff40268787b4674fdee22c5124bb877e650 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Fri, 24 Feb 2017 18:10:08 -0800 Subject: [PATCH] Refactors tcomms stuff a little --- code/controllers/communications.dm | 18 ++++++++ code/game/dna/dna2.dm | 4 ++ code/game/machinery/telecomms/logbrowser.dm | 42 ++----------------- .../machinery/telecomms/telecomunications.dm | 2 + .../game/objects/items/devices/radio/radio.dm | 8 ++-- code/modules/mob/living/carbon/brain/brain.dm | 11 +++++ .../scripting/Implementations/Telecomms.dm | 3 +- 7 files changed, 45 insertions(+), 43 deletions(-) diff --git a/code/controllers/communications.dm b/code/controllers/communications.dm index e65cc040917..9b056472bde 100644 --- a/code/controllers/communications.dm +++ b/code/controllers/communications.dm @@ -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" diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index 82f7ffb2e93..c8a4d91038e 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -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 diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm index 49133b1cd43..5b799d3a2e4 100644 --- a/code/game/machinery/telecomms/logbrowser.dm +++ b/code/game/machinery/telecomms/logbrowser.dm @@ -64,52 +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 += "
  • [C.name] \[X\]
    " - // -- 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"] - - if(ispathhuman(mobtype) || ispathbrain(mobtype)) - race = "Human" // The initializing thing wouldn't work anyways since it just kept the path, and kept no species data - - - else if(ispath(mobtype, /mob/living/carbon/human/monkey)) // I am aware this will only work for always-monkeys, and not - // those made a monkey after first being a human. - race = "Monkey" - language = race - - else if(ispathsilicon(mobtype) || C.parameters["job"] == "AI") // sometimes M gets deleted prematurely for AIs... just check the job - race = "Artificial Life" - - else if(ispathslime(mobtype)) // NT knows a lot about slimes, but not aliens. Can identify slimes - race = "Slime" - language = race - - else if(ispathbot(mobtype)) - race = "Bot" - - else if(ispathanimal(mobtype)) - race = "Domestic Animal" - language = race - - else - race = "Unidentifiable" - language = race - // -- 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 += "Data type: [C.input_type]
    " dat += "Source: [C.parameters["name"]] (Job: [C.parameters["job"]])
    " - dat += "Class: [race]
    " + dat += "Class: [C.parameters["race"]]
    " dat += "Contents: \"[C.parameters["message"]]\"
    " @@ -118,7 +82,7 @@ else dat += "Data type: Audio File
    " dat += "Source: Unidentifiable
    " - dat += "Class: [race]
    " + dat += "Class: [C.parameters["race"]]
    " dat += "Contents: Unintelligble
    " dat += "

  • " diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index a4e481f430b..953fdb68b8b 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -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"] diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index e144c5d3c50..1203ded2f43 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -403,6 +403,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 @@ -464,6 +465,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 @@ -562,7 +564,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) @@ -573,11 +575,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) diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index e8afbb0360b..655ad111cf1 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -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()) diff --git a/code/modules/scripting/Implementations/Telecomms.dm b/code/modules/scripting/Implementations/Telecomms.dm index 722c21e3ef3..2cc7cae3512 100644 --- a/code/modules/scripting/Implementations/Telecomms.dm +++ b/code/modules/scripting/Implementations/Telecomms.dm @@ -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 \ No newline at end of file + S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters