diff --git a/code/__DEFINES/radio.dm b/code/__DEFINES/radio.dm index e0c71836c72..86ccf84d2ae 100644 --- a/code/__DEFINES/radio.dm +++ b/code/__DEFINES/radio.dm @@ -58,3 +58,11 @@ #define RADIO_MEDBOT "12" #define RADIO_MAGNETS "radio_magnet" #define RADIO_LOGIC "radio_logic" + +// Signal types +#define SIGNALTYPE_NORMAL 0 +#define SIGNALTYPE_INTERCOM 1 // Will only broadcast to intercoms +#define SIGNALTYPE_INTERCOM_SBR 2 // Will only broadcast to intercoms and station-bounced radios +#define SIGNALTYPE_ANTAG 3 // Broadcast to syndicate frequency +#define SIGNALTYPE_AINOTRACK 4 // AI can't track down this person. Useful for imitation broadcasts where you can't find the actual mob + diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index aedc16c4162..a8066f62a37 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1813,7 +1813,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) /obj/machinery/portable_atmospherics/canister = "CANISTER", /obj/machinery/portable_atmospherics = "PORT_ATMOS", /obj/machinery/power = "POWER", - /obj/machinery/telecomms = "TCOMMS", /obj/machinery = "MACHINERY", /obj/mecha = "MECHA", /obj/structure/closet/crate = "CRATE", diff --git a/code/controllers/subsystem/radio.dm b/code/controllers/subsystem/radio.dm index 49b30062786..5a49070bf89 100644 --- a/code/controllers/subsystem/radio.dm +++ b/code/controllers/subsystem/radio.dm @@ -54,7 +54,7 @@ SUBSYSTEM_DEF(radio) // If the above switch somehow failed. And it needs the SSradio. part otherwise it fails to compile if(frequency in DEPT_FREQS) return "deptradio" - + // If its none of the others return "radio" diff --git a/code/defines/procs/radio.dm b/code/defines/procs/radio.dm index a3d6647ef41..7c0dc4de7f8 100644 --- a/code/defines/procs/radio.dm +++ b/code/defines/procs/radio.dm @@ -24,62 +24,9 @@ return freq_text -/datum/reception - var/obj/machinery/message_server/message_server = null - var/telecomms_reception = TELECOMMS_RECEPTION_NONE - var/message = "" - -/datum/receptions - var/obj/machinery/message_server/message_server = null - var/sender_reception = TELECOMMS_RECEPTION_NONE - var/list/receiver_reception = new - /proc/get_message_server() if(GLOB.message_servers) for(var/obj/machinery/message_server/MS in GLOB.message_servers) if(MS.active) return MS return null - -/proc/check_signal(var/datum/signal/signal) - return signal && signal.data["done"] - -/proc/get_sender_reception(var/atom/sender, var/datum/signal/signal) - return check_signal(signal) ? TELECOMMS_RECEPTION_SENDER : TELECOMMS_RECEPTION_NONE - -/proc/get_receiver_reception(var/receiver, var/datum/signal/signal) - if(receiver && check_signal(signal)) - var/turf/pos = get_turf(receiver) - // Maybe should get tie-in to the space manager? - if(pos && (pos.z in signal.data["level"])) - return TELECOMMS_RECEPTION_RECEIVER - return TELECOMMS_RECEPTION_NONE - -/proc/get_reception(var/atom/sender, var/receiver, var/message = "", var/do_sleep = 1) - var/datum/reception/reception = new - - // check if telecomms I/O route 1459 is stable - reception.message_server = get_message_server() - - var/datum/signal/signal = sender.telecomms_process(do_sleep) // 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/atom/receivers, var/do_sleep = 1) - var/datum/receptions/receptions = new - receptions.message_server = get_message_server() - - var/datum/signal/signal - if(sender) - signal = sender.telecomms_process(do_sleep) - receptions.sender_reception = get_sender_reception(sender, 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/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index 65424bf9008..c58aed9a89d 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -330,7 +330,7 @@ to_chat(S, "An inhospitable area may be created as a result of destroying this object. Aborting.") return FALSE -/obj/machinery/telecomms/swarmer_act(mob/living/simple_animal/hostile/swarmer/S) +/obj/machinery/tcomms/swarmer_act(mob/living/simple_animal/hostile/swarmer/S) to_chat(S, "This communications relay should be preserved, it will be a useful resource to our masters in the future. Aborting.") return FALSE diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index 2f8321b57bb..1b415bd873e 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -296,14 +296,7 @@ name = "Circuit board (Operating Computer)" build_path = /obj/machinery/computer/operating origin_tech = "programming=2;biotech=3" -/obj/item/circuitboard/comm_monitor - name = "Circuit board (Telecommunications Monitor)" - build_path = /obj/machinery/computer/telecomms/monitor - origin_tech = "programming=3;magnets=3;bluespace=2" -/obj/item/circuitboard/comm_server - name = "Circuit board (Telecommunications Server Monitor)" - build_path = /obj/machinery/computer/telecomms/server - origin_tech = "programming=3;magnets=3;bluespace=2" + /obj/item/circuitboard/comm_traffic name = "Circuitboard (Telecommunications Traffic Control)" build_path = /obj/machinery/computer/telecomms/traffic diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index efee10767ba..6aa1e2ab874 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -899,89 +899,8 @@ to destroy them and players will be able to make replacements. /obj/item/stock_parts/manipulator = 1) // Telecomms circuit boards: -/obj/item/circuitboard/telecomms/receiver - name = "Circuit Board (Subspace Receiver)" - build_path = /obj/machinery/telecomms/receiver - board_type = "machine" - origin_tech = "programming=2;engineering=2;bluespace=1" - frame_desc = "Requires 1 Subspace Ansible, 1 Hyperwave Filter, 2 Manipulators, and 1 Micro-Laser." - req_components = list( - /obj/item/stock_parts/subspace/ansible = 1, - /obj/item/stock_parts/subspace/filter = 1, - /obj/item/stock_parts/manipulator = 2, - /obj/item/stock_parts/micro_laser = 1) - -/obj/item/circuitboard/telecomms/hub - name = "Circuit Board (Hub Mainframe)" - build_path = /obj/machinery/telecomms/hub - board_type = "machine" - origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Manipulators, 2 Cable Coil and 2 Hyperwave Filter." - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stack/cable_coil = 2, - /obj/item/stock_parts/subspace/filter = 2) - -/obj/item/circuitboard/telecomms/relay - name = "Circuit Board (Relay Mainframe)" - build_path = /obj/machinery/telecomms/relay - board_type = "machine" - origin_tech = "programming=2;engineering=2;bluespace=2" - frame_desc = "Requires 2 Manipulators, 2 Cable Coil and 2 Hyperwave Filters." - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stack/cable_coil = 2, - /obj/item/stock_parts/subspace/filter = 2) - -/obj/item/circuitboard/telecomms/bus - name = "Circuit Board (Bus Mainframe)" - build_path = /obj/machinery/telecomms/bus - board_type = "machine" - origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Manipulators, 1 Cable Coil and 1 Hyperwave Filter." - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stack/cable_coil = 1, - /obj/item/stock_parts/subspace/filter = 1) - -/obj/item/circuitboard/telecomms/processor - name = "Circuit Board (Processor Unit)" - build_path = /obj/machinery/telecomms/processor - board_type = "machine" - origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 3 Manipulators, 1 Hyperwave Filter, 2 Treatment Disks, 1 Wavelength Analyzer, 2 Cable Coils and 1 Subspace Amplifier." - req_components = list( - /obj/item/stock_parts/manipulator = 3, - /obj/item/stock_parts/subspace/filter = 1, - /obj/item/stock_parts/subspace/treatment = 2, - /obj/item/stock_parts/subspace/analyzer = 1, - /obj/item/stack/cable_coil = 2, - /obj/item/stock_parts/subspace/amplifier = 1) - -/obj/item/circuitboard/telecomms/server - name = "Circuit Board (Telecommunication Server)" - build_path = /obj/machinery/telecomms/server - board_type = "machine" - origin_tech = "programming=2;engineering=2" - frame_desc = "Requires 2 Manipulators, 1 Cable Coil and 1 Hyperwave Filter." - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stack/cable_coil = 1, - /obj/item/stock_parts/subspace/filter = 1) - -/obj/item/circuitboard/telecomms/broadcaster - name = "Circuit Board (Subspace Broadcaster)" - build_path = /obj/machinery/telecomms/broadcaster - board_type = "machine" - origin_tech = "programming=2;engineering=2;bluespace=1" - frame_desc = "Requires 2 Manipulators, 1 Cable Coil, 1 Hyperwave Filter, 1 Ansible Crystal and 2 High-Powered Micro-Lasers. " - req_components = list( - /obj/item/stock_parts/manipulator = 2, - /obj/item/stack/cable_coil = 1, - /obj/item/stock_parts/subspace/filter = 1, - /obj/item/stock_parts/subspace/crystal = 1, - /obj/item/stock_parts/micro_laser/high = 2) - +#warn AA put new boards here you dingus +// End telecomms circuit boards /obj/item/circuitboard/ore_redemption name = "circuit board (Ore Redemption)" build_path = /obj/machinery/mineral/ore_redemption diff --git a/code/game/machinery/tcomms/_base.dm b/code/game/machinery/tcomms/_base.dm new file mode 100644 index 00000000000..a322a478b1b --- /dev/null +++ b/code/game/machinery/tcomms/_base.dm @@ -0,0 +1,307 @@ +/* + + ParadiseSS13 Telecommunications System + + Rewritten from the ground up because I was totally unhappy with how laggy and complicated the current implementation was + The system is made up of two objects. A main core and relays. + + The main core is basically the same as all of the machines from the previous implementation, apart from the relay + The core handles recieving and sending messages, logging messages, the NTTC configuration, and serves as the linkage hub for relays + + Relays function much in the same way as the old ones. They just expand the reach of tcomms from one z-level to another. + + This file contains extra datums and helper procs which the system utilises. + Unlike old telecomms, everything in here **should** be well documented. If not, feel free to add your own + -aa07 + +*/ + +// Global list for all telecomms machines in the world +GLOBAL_LIST_EMPTY(tcomms_machines) + +// Base type for tcomms machines +/obj/machinery/tcomms + name = "Telecommunications Device" + desc = "Someone forgot to say what this thingy does. Please yell at a coder" + icon = 'icons/obj/tcomms.dmi' + icon_state = "error" + density = TRUE + anchored = TRUE + // Network ID used for names + auto linkage + var/network_id = "None" + // Is the machine active + var/active = TRUE + +/obj/machinery/tcomms/Initialize(mapload) + . = ..() + GLOB.tcomms_machines += src + update_icon() + +/obj/machinery/tcomms/Destroy() + . = ..() + GLOB.tcomms_machines -= src + +/obj/machinery/tcomms/update_icon() + . = ..() + if(active) + icon_state = initial(icon_state) + else + icon_state = "[initial(icon_state)]_off" + +// Datum for a new message being sent over tcomms +/datum/tcomms_message + // Who sent the message + var/sender_name = "Error" + // What job are they + var/sender_job = "Error" + // Pieces of the message + var/list/message_pieces = list() + // Source Z-level + var/source_level = 0 + // What frequency the message is sent on + var/freq = 0 + // Was it sent with a voice changer + var/vmask = FALSE + // Did the signal come from a device that requires tcomms to function + var/needs_tcomms = TRUE + // Origin of the signal + var/datum/radio_frequency/connection + // Who sent it + var/mob/sender + // The radio it was sent from + var/obj/item/radio/radio + // The signal data (See defines/radio.dm) + var/data + // Verbage used + var/verbage = "says" + // Follow target for AI use + var/atom/follow_target = null + // Is this signal meant to be rejected + var/reject = FALSE + // Voice name if the person doesnt have a name (diona, alien, etc) + var/vname + // List of all channels this can be sent or recieved on + var/list/zlevels = list() + + +#define CREW_RADIO_TYPE 0 +#define CENTCOMM_RADIO_TYPE 1 +#define SYNDICATE_RADIO_TYPE 2 + +//Makes sure players cant read radios of a higher level than they are +/proc/is_bad_connection(old_freq, new_freq) + var/old_type = CREW_RADIO_TYPE + var/new_type = CREW_RADIO_TYPE + for(var/antag_freq in SSradio.ANTAG_FREQS) + if(old_freq == antag_freq) + old_type = SYNDICATE_RADIO_TYPE + if(new_freq == antag_freq) + new_type = SYNDICATE_RADIO_TYPE + + for(var/cent_freq in SSradio.CENT_FREQS) + if(old_freq == cent_freq) + old_type = CENTCOMM_RADIO_TYPE + if(new_freq == cent_freq) + new_type = CENTCOMM_RADIO_TYPE + + return new_type > old_type + +#undef CREW_RADIO_TYPE +#undef CENTCOMM_RADIO_TYPE +#undef SYNDICATE_RADIO_TYPE + + +/proc/broadcast_message(datum/tcomms_message/tcm) + + + /* ###### Prepare the radio connection ###### */ + + var/display_freq = tcm.freq + + var/bad_connection = FALSE + var/datum/radio_frequency/new_connection = tcm.connection + + if(tcm.connection.frequency != display_freq) + bad_connection = is_bad_connection(tcm.connection.frequency, display_freq) + new_connection = SSradio.return_frequency(display_freq) + + var/list/obj/item/radio/radios = list() + + // --- Broadcast only to intercom devices --- + + if(tcm.data == SIGNALTYPE_INTERCOM && !bad_connection) + + for(var/obj/item/radio/intercom/R in new_connection.devices["[RADIO_CHAT]"]) + if(R.receive_range(display_freq, tcm.zlevels) > -1) + radios += R + + // --- Broadcast only to intercoms and station-bounced radios --- + + else if(tcm.data == SIGNALTYPE_INTERCOM_SBR && !bad_connection) + + for(var/obj/item/radio/R in new_connection.devices["[RADIO_CHAT]"]) + + if(istype(R, /obj/item/radio/headset)) + continue + + if(R.receive_range(display_freq, tcm.zlevels) > -1) + radios += R + + // --- Broadcast to antag radios! --- + + else if(tcm.data == SIGNALTYPE_ANTAG) + for(var/antag_freq in SSradio.ANTAG_FREQS) + var/datum/radio_frequency/antag_connection = SSradio.return_frequency(antag_freq) + for(var/obj/item/radio/R in antag_connection.devices["[RADIO_CHAT]"]) + if(R.receive_range(antag_freq, tcm.zlevels) > -1) + radios += R + + // --- Broadcast to ALL radio devices --- + + else if(!bad_connection) + + for(var/obj/item/radio/R in new_connection.devices["[RADIO_CHAT]"]) + if(R.receive_range(display_freq, tcm.zlevels) > -1) + radios += R + + // Get a list of mobs who can hear from the radios we collected. + var/list/receive = get_mobs_in_radio_ranges(radios) + + /* ###### Organize the receivers into categories for displaying the message ###### */ + + // Understood the message: + var/list/heard_masked = list() // masked name or no real name + var/list/heard_normal = list() // normal message + + // Did not understand the message: + var/list/heard_voice = list() // voice message (ie "chimpers") + var/list/heard_garbled = list() // garbled message (ie "f*c* **u, **i*er!") + var/list/heard_gibberish= list() // completely screwed over message (ie "F%! (O*# *#!<>&**%!") + + for(var/mob/R in receive) + + /* --- Loop through the receivers and categorize them --- */ + + if(is_admin(R) && !R.get_preference(CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. + continue + + if(istype(R, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes. + continue + + // Ghosts hearing all radio chat don't want to hear syndicate intercepts, they're duplicates + if(tcm.data == SIGNALTYPE_ANTAG && istype(R, /mob/dead/observer) && R.get_preference(CHAT_GHOSTRADIO)) + continue + + + // --- Can understand the speech --- + if(!tcm.sender || R.say_understands(tcm.sender)) + + // - Not human or wearing a voice mask - + if(!tcm.sender || !ishuman(tcm.sender) || tcm.vmask) + heard_masked += R + + // - Human and not wearing voice mask - + else + heard_normal += R + + // --- Can't understand the speech --- + + else + // - Just display a garbled message - + heard_garbled += R + + + /* ###### Begin formatting and sending the message ###### */ + if(length(heard_masked) || length(heard_normal) || length(heard_voice) || length(heard_garbled) || length(heard_gibberish)) + + /* --- Some miscellaneous variables to format the string output --- */ + var/freq_text = get_frequency_name(display_freq) + + var/part_b_extra = "" + if(tcm.data == SIGNALTYPE_ANTAG) // intercepted radio message + part_b_extra = " (Intercepted)" + var/part_a = "\[[freq_text]\][part_b_extra] " // goes in the actual output + + // --- Some more pre-message formatting --- + var/part_b = " " // Tweaked for security headsets -- TLE + var/part_c = "" + + + // --- Filter the message; place it in quotes apply a verb --- + var/quotedmsg = null + if(tcm.sender) + quotedmsg = "[tcm.sender.say_quote(multilingual_to_message(tcm.message_pieces))], \"[multilingual_to_message(tcm.message_pieces)]\"" + else + quotedmsg = "says, \"[multilingual_to_message(tcm.message_pieces)]\"" + + // --- This following recording is intended for research and feedback in the use of department radio channels --- + + var/part_blackbox_b = " \[[freq_text]\] " // Tweaked for security headsets -- TLE + var/blackbox_msg = "[part_a][tcm.sender_name][part_blackbox_b][quotedmsg][part_c]" + //var/blackbox_admin_msg = "[part_a][M.name] (Real name: [M.real_name])[part_blackbox_b][quotedmsg][part_c]" + + //BR.messages_admin += blackbox_admin_msg + if(istype(GLOB.blackbox)) + switch(display_freq) + if(PUB_FREQ) + GLOB.blackbox.msg_common += blackbox_msg + if(SCI_FREQ) + GLOB.blackbox.msg_science += blackbox_msg + if(COMM_FREQ) + GLOB.blackbox.msg_command += blackbox_msg + if(MED_FREQ) + GLOB.blackbox.msg_medical += blackbox_msg + if(ENG_FREQ) + GLOB.blackbox.msg_engineering += blackbox_msg + if(SEC_FREQ) + GLOB.blackbox.msg_security += blackbox_msg + if(DTH_FREQ) + GLOB.blackbox.msg_deathsquad += blackbox_msg + if(SYND_FREQ) + GLOB.blackbox.msg_syndicate += blackbox_msg + if(SYNDTEAM_FREQ) + GLOB.blackbox.msg_syndteam += blackbox_msg + if(SUP_FREQ) + GLOB.blackbox.msg_cargo += blackbox_msg + if(SRV_FREQ) + GLOB.blackbox.msg_service += blackbox_msg + else + GLOB.blackbox.messages += blackbox_msg + //End of research and feedback code. + + /* ###### Send the message ###### */ + + + /* --- Process all the mobs that heard a masked voice (understood) --- */ + + if(length(heard_masked)) + for(var/mob/R in heard_masked) + R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 0, tcm.sender_name, follow_target=tcm.follow_target) + + /* --- Process all the mobs that heard the voice normally (understood) --- */ + + if(length(heard_normal)) + for(var/mob/R in heard_normal) + R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 0, tcm.sender_name, follow_target=tcm.follow_target) + + /* --- Process all the mobs that heard the voice normally (did not understand) --- */ + + if(length(heard_voice)) + for(var/mob/R in heard_voice) + R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender,0, tcm.vname, follow_target=tcm.follow_target) + + /* --- Process all the mobs that heard a garbled voice (did not understand) --- */ + // Displays garbled message (ie "f*c* **u, **i*er!") + + if(length(heard_garbled)) + for(var/mob/R in heard_garbled) + R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 1, tcm.vname, follow_target=tcm.follow_target) + + + /* --- Complete gibberish. Usually happens when there's a compressed message --- */ + + if(length(heard_gibberish)) + for(var/mob/R in heard_gibberish) + R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 1, follow_target=tcm.follow_target) + + return TRUE diff --git a/code/game/machinery/tcomms/core.dm b/code/game/machinery/tcomms/core.dm new file mode 100644 index 00000000000..2da08660f34 --- /dev/null +++ b/code/game/machinery/tcomms/core.dm @@ -0,0 +1,56 @@ +/* + The core of the entire telecomms operation +*/ + +/obj/machinery/tcomms/core + name = "Telecommunications Core" + desc = "A large rack full of communications equipment. Looks important." + icon_state = "core" + // The NTTC config for this device + var/datum/nttc_configuration/nttc = new() + // List of all reachable devices + var/list/reachable_zlevels = list() + // List of all linked relays + var/list/linked_relays = list() + // Password for linking stuff together + var/link_password + +/obj/machinery/tcomms/core/Initialize(mapload) + . = ..() + link_password = GenerateKey() + reachable_zlevels |= loc.z + +// Helper to see if a Z-level is reachable +/obj/machinery/tcomms/core/proc/zlevel_reachable(zlevel) + if(zlevel in reachable_zlevels) + return TRUE + else + return FALSE + +// This handles taking in the message then broadcasting it out +/obj/machinery/tcomms/core/proc/handle_message(datum/tcomms_message/tcm) + // Don't do anything with rejected signals, or if were offline + if(tcm.reject || !active) + return FALSE + // Kill the signal if its on a z-level that isnt reachable + if(!(tcm.source_level in reachable_zlevels)) + return FALSE + + // Now we generate the list of where that signal should go to + tcm.zlevels = reachable_zlevels + tcm.zlevels |= tcm.source_level + + // Now check if they actually have pieces, if so, broadcast + if(tcm.message_pieces) + broadcast_message(tcm) + return TRUE + + return FALSE + +// This remakes the list of reachable zlevels. Call this if you add or remove a relay +/obj/machinery/tcomms/core/proc/refresh_zlevels() + // Refresh the list + reachable_zlevels = list() + for(var/obj/machinery/tcomms/relay/R in GLOB.tcomms_machines) + reachable_zlevels |= R.loc.z + diff --git a/code/game/machinery/tcomms/presets.dm b/code/game/machinery/tcomms/presets.dm new file mode 100644 index 00000000000..80621f9af80 --- /dev/null +++ b/code/game/machinery/tcomms/presets.dm @@ -0,0 +1,32 @@ +/* + All machine presets go in here +*/ + +// STATION CORE // +/obj/machinery/tcomms/core/station + network_id = "STATION-CORE" + +// MINING RELAY // +/obj/machinery/tcomms/relay/mining + network_id = "MINING-RELAY" + autolink_id = "STATION-CORE" + +// ENGINEERING RELAY // +/obj/machinery/tcomms/relay/engineering + network_id = "ENGINEERING-RELAY" + autolink_id = "STATION-CORE" + active = FALSE + +// RUSKIE RELAY // +/obj/machinery/tcomms/relay/ruskie + network_id = "RUSKIE-RELAY" + autolink_id = "STATION-CORE" + active = FALSE + hidden_link = TRUE + +// CC RELAY // +/obj/machinery/tcomms/cc/ruskie + network_id = "CENTCOMM-RELAY" + autolink_id = "STATION-CORE" + hidden_link = TRUE + diff --git a/code/game/machinery/tcomms/relay.dm b/code/game/machinery/tcomms/relay.dm new file mode 100644 index 00000000000..130fa2946ff --- /dev/null +++ b/code/game/machinery/tcomms/relay.dm @@ -0,0 +1,45 @@ +/* + Relays just expand transmitting and recieving to other Z-levels. +*/ + +/obj/machinery/tcomms/relay + name = "Telecommunications Relay" + desc = "A large device with several radio antennas on it." + icon_state = "relay" + // The host core for this relay + var/obj/machinery/tcomms/core/linked_core + // ID of the hub to auto link to + var/autolink_id + // Is this linked to anything at all + var/linked = FALSE + // Is this link invisible on the hub? + var/hidden_link = FALSE + +/obj/machinery/tcomms/relay/Initialize(mapload) + . = ..() + if(mapload && autolink_id) + return INITIALIZE_HINT_LATELOAD + +/obj/machinery/tcomms/relay/Destroy() + Reset() + . = ..() + +/obj/machinery/tcomms/relay/LateInitialize() + . = ..() + for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) + if(C.network_id == autolink_id) + AddLink(C) + // Only ONE of these with one ID should exist per world + break + +/obj/machinery/tcomms/relay/proc/AddLink(obj/machinery/tcomms/core/target) + linked_core = target + target.linked_relays |= src + target.refresh_zlevels() + linked = TRUE + +/obj/machinery/tcomms/relay/proc/Reset() + linked_core.linked_relays -= src + linked_core.refresh_zlevels() + linked_core = null + linked = FALSE diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm deleted file mode 100644 index f19bc0fd43b..00000000000 --- a/code/game/machinery/telecomms/broadcaster.dm +++ /dev/null @@ -1,665 +0,0 @@ -/* - The broadcaster sends processed messages to all radio devices in the game. They - do not have to be headsets; intercoms and station-bounced radios suffice. - - They receive their message from a server after the message has been logged. -*/ - -GLOBAL_LIST_EMPTY(recentmessages) // global list of recent messages broadcasted : used to circumvent massive radio spam -GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages list is kept in sync - -/obj/machinery/telecomms/broadcaster - name = "Subspace Broadcaster" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "broadcaster" - desc = "A dish-shaped machine used to broadcast processed subspace signals." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 25 - machinetype = 5 - circuitboard = /obj/item/circuitboard/telecomms/broadcaster - -/obj/machinery/telecomms/broadcaster/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - // Don't broadcast rejected signals - if(signal.data["reject"]) - return - - if(signal.data["message"]) - - // Prevents massive radio spam - signal.data["done"] = 1 // mark the signal as being broadcasted - // Search for the original signal and mark it as done as well - var/datum/signal/original = signal.data["original"] - if(original) - original.data["done"] = 1 - original.data["compression"] = signal.data["compression"] - original.data["level"] = signal.data["level"] - - var/signal_message = "[signal.frequency]:[signal.data["message"]]:[signal.data["realname"]]" - if(signal_message in GLOB.recentmessages) - return - GLOB.recentmessages.Add(signal_message) - - if(signal.data["slow"] > 0) - sleep(signal.data["slow"]) // simulate the network lag if necessary - - signal.data["level"] |= listening_level - - /** #### - Normal Broadcast - #### **/ - - if(signal.data["type"] == 0) - - /* ###### Broadcast a message using signal.data ###### */ - Broadcast_Message(signal.data["connection"], signal.data["mob"], - signal.data["vmask"], signal.data["vmessage"], - signal.data["radio"], signal.data["message"], - signal.data["name"], signal.data["job"], - signal.data["realname"], signal.data["vname"],, - signal.data["compression"], signal.data["level"], signal.frequency, - signal.data["verb"] ) - - - /** #### - Simple Broadcast - #### **/ - - if(signal.data["type"] == 1) - - /* ###### Broadcast a message using signal.data ###### */ - Broadcast_SimpleMessage(signal.data["name"], signal.frequency, - signal.data["message"],null, null, - signal.data["compression"], listening_level) - - - /** #### - Artificial Broadcast - #### **/ - // (Imitates a mob) - - if(signal.data["type"] == 2) - - /* ###### Broadcast a message using signal.data ###### */ - // Parameter "data" as 4: AI can't track this person/mob - - Broadcast_Message(signal.data["connection"], signal.data["mob"], - signal.data["vmask"], signal.data["vmessage"], - signal.data["radio"], signal.data["message"], - signal.data["name"], signal.data["job"], - signal.data["realname"], signal.data["vname"], 4, signal.data["compression"], signal.data["level"], signal.frequency, - signal.data["verb"]) - - if(!GLOB.message_delay) - GLOB.message_delay = 1 - spawn(10) - GLOB.message_delay = 0 - GLOB.recentmessages = list() - - /* --- Do a snazzy animation! --- */ - flick("broadcaster_send", src) - -/obj/machinery/telecomms/broadcaster/Destroy() - // In case message_delay is left on 1, otherwise it won't reset the list and people can't say the same thing twice anymore. - if(GLOB.message_delay) - GLOB.message_delay = 0 - return ..() - - -/* - Basically just an empty shell for receiving and broadcasting radio messages. Not - very flexible, but it gets the job done. -*/ - -/obj/machinery/telecomms/allinone - name = "Telecommunications Mainframe" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "comm_server" - desc = "A compact machine used for portable subspace telecommuniations processing." - density = 1 - anchored = 1 - use_power = NO_POWER_USE - idle_power_usage = 0 - machinetype = 6 - var/intercept = 0 // if nonzero, broadcasts all messages to syndicate channel - -/obj/machinery/telecomms/allinone/receive_signal(datum/signal/signal) - - if(!on) // has to be on to receive messages - return - - if(is_freq_listening(signal)) // detect subspace signals - - signal.data["done"] = 1 // mark the signal as being broadcasted - signal.data["compression"] = 0 - - // Search for the original signal and mark it as done as well - var/datum/signal/original = signal.data["original"] - if(original) - original.data["done"] = 1 - - if(signal.data["slow"] > 0) - sleep(signal.data["slow"]) // simulate the network lag if necessary - - /* ###### Broadcast a message using signal.data ###### */ - - var/datum/radio_frequency/connection = signal.data["connection"] - - if(connection.frequency in SSradio.ANTAG_FREQS) // if antag broadcast, just - Broadcast_Message(signal.data["connection"], signal.data["mob"], - signal.data["vmask"], signal.data["vmessage"], - signal.data["radio"], signal.data["message"], - signal.data["name"], signal.data["job"], - signal.data["realname"], signal.data["vname"],, signal.data["compression"], list(0), connection.frequency, - signal.data["verb"]) - else - if(intercept) - Broadcast_Message(signal.data["connection"], signal.data["mob"], - signal.data["vmask"], signal.data["vmessage"], - signal.data["radio"], signal.data["message"], - signal.data["name"], signal.data["job"], - signal.data["realname"], signal.data["vname"], 3, signal.data["compression"], list(0), connection.frequency, - signal.data["verb"]) - -#define CREW_RADIO_TYPE 0 -#define CENTCOMM_RADIO_TYPE 1 -#define SYNDICATE_RADIO_TYPE 2 -/proc/Is_Bad_Connection(old_freq, new_freq) //Makes sure players cant read radios of a higher level than they are - var/old_type = CREW_RADIO_TYPE - var/new_type = CREW_RADIO_TYPE - for(var/antag_freq in SSradio.ANTAG_FREQS) - if(old_freq == antag_freq) - old_type = SYNDICATE_RADIO_TYPE - if(new_freq == antag_freq) - new_type = SYNDICATE_RADIO_TYPE - - for(var/cent_freq in SSradio.CENT_FREQS) - if(old_freq == cent_freq) - old_type = CENTCOMM_RADIO_TYPE - if(new_freq == cent_freq) - new_type = CENTCOMM_RADIO_TYPE - - return new_type > old_type - -/** - - Here is the big, bad function that broadcasts a message given the appropriate - parameters. - - @param connection: - The datum generated in radio.dm, stored in signal.data["connection"]. - - @param M: - Reference to the mob/speaker, stored in signal.data["mob"] - - @param vmask: - Boolean value if the mob is "hiding" its identity via voice mask, stored in - signal.data["vmask"] - - @param vmessage: - If specified, will display this as the message; such as "chimpering" - for monkies if the mob is not understood. Stored in signal.data["vmessage"]. - - @param radio: - Reference to the radio broadcasting the message, stored in signal.data["radio"] - - @param message: - The actual string message to display to mobs who understood mob M. Stored in - signal.data["message"] - - @param name: - The name to display when a mob receives the message. signal.data["name"] - - @param job: - The name job to display for the AI when it receives the message. signal.data["job"] - - @param realname: - The "real" name associated with the mob. signal.data["realname"] - - @param vname: - If specified, will use this name when mob M is not understood. signal.data["vname"] - - @param data: - If specified: - 1 -- Will only broadcast to intercoms - 2 -- Will only broadcast to intercoms and station-bounced radios - 3 -- Broadcast to syndicate frequency - 4 -- AI can't track down this person. Useful for imitation broadcasts where you can't find the actual mob - - @param compression: - If 0, the signal is audible - If nonzero, the signal may be partially inaudible or just complete gibberish. - - @param level: - The list of Z levels that the sending radio is broadcasting to. Having 0 in the list broadcasts on all levels - - @param freq - The frequency of the signal - -**/ - -/proc/Broadcast_Message(var/datum/radio_frequency/connection, var/mob/M, - var/vmask, list/vmessage_pieces, var/obj/item/radio/radio, - list/message_pieces, var/name, var/job, var/realname, var/vname, - var/data, var/compression, var/list/level, var/freq, var/verbage = "says", - var/atom/follow_target = null) - - - /* ###### Prepare the radio connection ###### */ - - var/display_freq = freq - - var/bad_connection = FALSE - var/datum/radio_frequency/new_connection = connection - - if(connection.frequency != display_freq) - bad_connection = Is_Bad_Connection(connection.frequency, display_freq) - new_connection = SSradio.return_frequency(display_freq) - - var/list/obj/item/radio/radios = list() - - // --- Broadcast only to intercom devices --- - - if(data == 1 && !bad_connection) - - for(var/obj/item/radio/intercom/R in new_connection.devices["[RADIO_CHAT]"]) - if(R.receive_range(display_freq, level) > -1) - radios += R - - // --- Broadcast only to intercoms and station-bounced radios --- - - else if(data == 2 && !bad_connection) - - for(var/obj/item/radio/R in new_connection.devices["[RADIO_CHAT]"]) - - if(istype(R, /obj/item/radio/headset)) - continue - - if(R.receive_range(display_freq, level) > -1) - radios += R - - // --- Broadcast to antag radios! --- - - else if(data == 3) - for(var/antag_freq in SSradio.ANTAG_FREQS) - var/datum/radio_frequency/antag_connection = SSradio.return_frequency(antag_freq) - for(var/obj/item/radio/R in antag_connection.devices["[RADIO_CHAT]"]) - if(R.receive_range(antag_freq, level) > -1) - radios += R - - // --- Broadcast to ALL radio devices --- - - else if(!bad_connection) - - for(var/obj/item/radio/R in new_connection.devices["[RADIO_CHAT]"]) - if(R.receive_range(display_freq, level) > -1) - radios += R - - // Get a list of mobs who can hear from the radios we collected. - var/list/receive = get_mobs_in_radio_ranges(radios) - - /* ###### Organize the receivers into categories for displaying the message ###### */ - - // Understood the message: - var/list/heard_masked = list() // masked name or no real name - var/list/heard_normal = list() // normal message - - // Did not understand the message: - var/list/heard_voice = list() // voice message (ie "chimpers") - var/list/heard_garbled = list() // garbled message (ie "f*c* **u, **i*er!") - var/list/heard_gibberish= list() // completely screwed over message (ie "F%! (O*# *#!<>&**%!") - - for(var/mob/R in receive) - - /* --- Loop through the receivers and categorize them --- */ - - if(is_admin(R) && !R.get_preference(CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. - continue - - if(istype(R, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes. - continue - - // Ghosts hearing all radio chat don't want to hear syndicate intercepts, they're duplicates - if(data == 3 && istype(R, /mob/dead/observer) && R.get_preference(CHAT_GHOSTRADIO)) - continue - - // --- Check for compression --- - if(compression > 0) - heard_gibberish += R - continue - - // --- Can understand the speech --- - - if(!M || R.say_understands(M)) - - // - Not human or wearing a voice mask - - if(!M || !ishuman(M) || vmask) - heard_masked += R - - // - Human and not wearing voice mask - - else - heard_normal += R - - // --- Can't understand the speech --- - - else - // - The speaker has a prespecified "voice message" to display if not understood - - if(vmessage_pieces) - heard_voice += R - - // - Just display a garbled message - - else - heard_garbled += R - - - /* ###### Begin formatting and sending the message ###### */ - if(length(heard_masked) || length(heard_normal) || length(heard_voice) || length(heard_garbled) || length(heard_gibberish)) - - /* --- Some miscellaneous variables to format the string output --- */ - var/freq_text = get_frequency_name(display_freq) - - var/part_b_extra = "" - if(data == 3) // intercepted radio message - part_b_extra = " (Intercepted)" - var/part_a = "\[[freq_text]\][part_b_extra] " // goes in the actual output - - // --- Some more pre-message formatting --- - var/part_b = " " // Tweaked for security headsets -- TLE - var/part_c = "" - - - // --- Filter the message; place it in quotes apply a verb --- - var/quotedmsg = null - if(M) - quotedmsg = "[M.say_quote(multilingual_to_message(message_pieces))], \"[multilingual_to_message(message_pieces)]\"" - else - quotedmsg = "says, \"[multilingual_to_message(message_pieces)]\"" - - // --- This following recording is intended for research and feedback in the use of department radio channels --- - - var/part_blackbox_b = " \[[freq_text]\] " // Tweaked for security headsets -- TLE - var/blackbox_msg = "[part_a][name][part_blackbox_b][quotedmsg][part_c]" - //var/blackbox_admin_msg = "[part_a][M.name] (Real name: [M.real_name])[part_blackbox_b][quotedmsg][part_c]" - - //BR.messages_admin += blackbox_admin_msg - if(istype(GLOB.blackbox)) - switch(display_freq) - if(PUB_FREQ) - GLOB.blackbox.msg_common += blackbox_msg - if(SCI_FREQ) - GLOB.blackbox.msg_science += blackbox_msg - if(COMM_FREQ) - GLOB.blackbox.msg_command += blackbox_msg - if(MED_FREQ) - GLOB.blackbox.msg_medical += blackbox_msg - if(ENG_FREQ) - GLOB.blackbox.msg_engineering += blackbox_msg - if(SEC_FREQ) - GLOB.blackbox.msg_security += blackbox_msg - if(DTH_FREQ) - GLOB.blackbox.msg_deathsquad += blackbox_msg - if(SYND_FREQ) - GLOB.blackbox.msg_syndicate += blackbox_msg - if(SYNDTEAM_FREQ) - GLOB.blackbox.msg_syndteam += blackbox_msg - if(SUP_FREQ) - GLOB.blackbox.msg_cargo += blackbox_msg - if(SRV_FREQ) - GLOB.blackbox.msg_service += blackbox_msg - else - GLOB.blackbox.messages += blackbox_msg - - //End of research and feedback code. - - /* ###### Send the message ###### */ - - - /* --- Process all the mobs that heard a masked voice (understood) --- */ - - if(length(heard_masked)) - for(var/mob/R in heard_masked) - R.hear_radio(message_pieces, verbage, part_a, part_b, M, 0, name, follow_target=follow_target) - - /* --- Process all the mobs that heard the voice normally (understood) --- */ - - if(length(heard_normal)) - for(var/mob/R in heard_normal) - R.hear_radio(message_pieces, verbage, part_a, part_b, M, 0, realname, follow_target=follow_target) - - /* --- Process all the mobs that heard the voice normally (did not understand) --- */ - - if(length(heard_voice)) - for(var/mob/R in heard_voice) - R.hear_radio(message_pieces, verbage, part_a, part_b, M,0, vname, follow_target=follow_target) - - /* --- Process all the mobs that heard a garbled voice (did not understand) --- */ - // Displays garbled message (ie "f*c* **u, **i*er!") - - if(length(heard_garbled)) - for(var/mob/R in heard_garbled) - R.hear_radio(message_pieces, verbage, part_a, part_b, M, 1, vname, follow_target=follow_target) - - - /* --- Complete gibberish. Usually happens when there's a compressed message --- */ - - if(length(heard_gibberish)) - for(var/mob/R in heard_gibberish) - R.hear_radio(message_pieces, verbage, part_a, part_b, M, 1, follow_target=follow_target) - - return 1 - -/proc/Broadcast_SimpleMessage(var/source, var/frequency, list/message_pieces, var/data, var/mob/M, var/compression, var/level) - var/text = multilingual_to_message(message_pieces) - /* ###### Prepare the radio connection ###### */ - - var/mob/living/carbon/human/H - if(!M) - H = new - M = H - - var/datum/radio_frequency/connection = SSradio.return_frequency(frequency) - - var/display_freq = connection.frequency - - var/list/receive = list() - - - // --- Broadcast only to intercom devices --- - - if(data == 1) - for(var/obj/item/radio/intercom/R in connection.devices["[RADIO_CHAT]"]) - var/turf/position = get_turf(R) - // TODO: Make the radio system cooperate with the space manager - if(position && position.z == level) - receive |= R.send_hear(display_freq, level) - - - // --- Broadcast only to intercoms and station-bounced radios --- - - else if(data == 2) - for(var/obj/item/radio/R in connection.devices["[RADIO_CHAT]"]) - - if(istype(R, /obj/item/radio/headset)) - continue - var/turf/position = get_turf(R) - // TODO: Make the radio system cooperate with the space manager - if(position && position.z == level) - receive |= R.send_hear(display_freq) - - - // --- Broadcast to antag radios! --- - - else if(data == 3) - for(var/freq in SSradio.ANTAG_FREQS) - var/datum/radio_frequency/antag_connection = SSradio.return_frequency(freq) - for(var/obj/item/radio/R in antag_connection.devices["[RADIO_CHAT]"]) - var/turf/position = get_turf(R) - // TODO: Make the radio system cooperate with the space manager - if(position && position.z == level) - receive |= R.send_hear(freq) - - - // --- Broadcast to ALL radio devices --- - - else - for(var/obj/item/radio/R in connection.devices["[RADIO_CHAT]"]) - var/turf/position = get_turf(R) - // TODO: Make the radio system cooperate with the space manager - if(position && position.z == level) - receive |= R.send_hear(display_freq) - - - /* ###### Organize the receivers into categories for displaying the message ###### */ - - // Understood the message: - var/list/heard_normal = list() // normal message - - // Did not understand the message: - var/list/heard_garbled = list() // garbled message (ie "f*c* **u, **i*er!") - var/list/heard_gibberish= list() // completely screwed over message (ie "F%! (O*# *#!<>&**%!") - - for(var/mob/R in receive) - - /* --- Loop through the receivers and categorize them --- */ - - if(R.client && !R.get_preference(CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios. - continue - - - // --- Check for compression --- - if(compression > 0) - - heard_gibberish += R - continue - - // --- Can understand the speech --- - - if(R.say_understands(M)) - - heard_normal += R - - // --- Can't understand the speech --- - - else - // - Just display a garbled message - - - heard_garbled += R - - - /* ###### Begin formatting and sending the message ###### */ - if(length(heard_normal) || length(heard_garbled) || length(heard_gibberish)) - - /* --- Some miscellaneous variables to format the string output --- */ - var/part_a = "" // goes in the actual output - var/freq_text = get_frequency_name(display_freq) - - // --- Some more pre-message formatting --- - - var/part_b_extra = "" - if(data == 3) // intercepted radio message - part_b_extra = " (Intercepted)" - - var/part_b = " \[[freq_text]\][part_b_extra] " // Tweaked for security headsets -- TLE - var/part_blackbox_b = " \[[freq_text]\] " - var/part_c = "" - - var/blackbox_msg = "[part_a][source][part_blackbox_b]\"[text]\"[part_c]" - - //BR.messages_admin += blackbox_admin_msg - if(istype(GLOB.blackbox)) - switch(display_freq) - if(PUB_FREQ) - GLOB.blackbox.msg_common += blackbox_msg - if(SCI_FREQ) - GLOB.blackbox.msg_science += blackbox_msg - if(COMM_FREQ) - GLOB.blackbox.msg_command += blackbox_msg - if(MED_FREQ) - GLOB.blackbox.msg_medical += blackbox_msg - if(ENG_FREQ) - GLOB.blackbox.msg_engineering += blackbox_msg - if(SEC_FREQ) - GLOB.blackbox.msg_security += blackbox_msg - if(DTH_FREQ) - GLOB.blackbox.msg_deathsquad += blackbox_msg - if(SYND_FREQ) - GLOB.blackbox.msg_syndicate += blackbox_msg - if(SYNDTEAM_FREQ) - GLOB.blackbox.msg_syndteam += blackbox_msg - if(SUP_FREQ) - GLOB.blackbox.msg_cargo += blackbox_msg - if(SRV_FREQ) - GLOB.blackbox.msg_service += blackbox_msg - else - GLOB.blackbox.messages += blackbox_msg - - //End of research and feedback code. - - /* ###### Send the message ###### */ - - /* --- Process all the mobs that heard the voice normally (understood) --- */ - - if(length(heard_normal)) - var/rendered = "[part_a][source][part_b]\"[text]\"[part_c]" - - for(var/mob/R in heard_normal) - R.show_message(rendered, 2) - - /* --- Process all the mobs that heard a garbled voice (did not understand) --- */ - // Displays garbled message (ie "f*c* **u, **i*er!") - - if(length(heard_garbled)) - var/quotedmsg = "\"[stars(text)]\"" - var/rendered = "[part_a][source][part_b][quotedmsg][part_c]" - - for(var/mob/R in heard_garbled) - R.show_message(rendered, 2) - - - /* --- Complete gibberish. Usually happens when there's a compressed message --- */ - - if(length(heard_gibberish)) - var/quotedmsg = "\"[Gibberish(text, compression + 50)]\"" - var/rendered = "[part_a][Gibberish(source, compression + 50)][part_b][quotedmsg][part_c]" - - for(var/mob/R in heard_gibberish) - R.show_message(rendered, 2) - - if(H) - qdel(H) - -//Use this to test if an obj can communicate with a Telecommunications Network - -/atom/proc/test_telecomms() - var/datum/signal/signal = src.telecomms_process() - var/turf/position = get_turf(src) - // TODO: Make the radio system cooperate with the space manager - return (position.z in signal.data["level"]) && signal.data["done"] - -/atom/proc/telecomms_process(var/do_sleep = 1) - - // First, we want to generate a new radio signal - var/datum/signal/signal = new - signal.transmission_method = 2 // 2 would be a subspace transmission. - var/turf/pos = get_turf(src) - - // --- Finally, tag the actual signal with the appropriate values --- - signal.data = list( - "slow" = 0, // how much to sleep() before broadcasting - simulates net lag - "message" = "TEST", - "compression" = rand(45, 50), // If the signal is compressed, compress our message too. - "traffic" = 0, // dictates the total traffic sum that the signal went through - "type" = 4, // determines what type of radio input it is: test broadcast - "reject" = 0, - "done" = 0, - // TODO: Make the radio system cooperate with the space manager - "level" = pos.z // The level it is being broadcasted at. - ) - signal.frequency = PUB_FREQ// Common channel - - //#### Sending the signal to all subspace receivers ####// - for(var/obj/machinery/telecomms/receiver/R in GLOB.telecomms_list) - spawn(0) - R.receive_signal(signal) - - if(do_sleep) - sleep(rand(10,25)) - - //log_world("Level: [signal.data["level"]] - Done: [signal.data["done"]]") - - return signal diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm deleted file mode 100644 index f0b5a945f92..00000000000 --- a/code/game/machinery/telecomms/logbrowser.dm +++ /dev/null @@ -1,219 +0,0 @@ -/obj/machinery/computer/telecomms - - light_color = LIGHT_COLOR_DARKGREEN - -/obj/machinery/computer/telecomms/server - name = "telecommunications server monitor" - icon_screen = "comm_logs" - - - var/screen = 0 // the screen number: - var/list/servers = list() // the servers located by the computer - var/obj/machinery/telecomms/server/SelectedServer - - var/network = "NULL" // the network to probe - var/temp = "" // temporary feedback messages - - var/universal_translate = 0 // set to 1 if it can translate nonhuman speech - - req_access = list(ACCESS_TCOMSAT) - circuit = /obj/item/circuitboard/comm_server - - attack_hand(mob/user as mob) - if(stat & (BROKEN|NOPOWER)) - return - user.set_machine(src) - var/list/dat = list() - dat += "Telecommunication Server Monitor
Telecommunications Server Monitor
" - - switch(screen) - - - // --- Main Menu --- - - if(0) - dat += "
[temp]
" - dat += "
Current Network: [network]
" - if(servers.len) - dat += "
Detected Telecommunication Servers:" - dat += "
\[Flush Buffer\]" - - else - dat += "
No servers detected. Scan for servers: \[Scan\]" - - - // --- Viewing Server --- - - if(1) - dat += "
[temp]
" - dat += "
\[Main Menu\] \[Refresh\]
" - dat += "
Current Network: [network]" - dat += "
Selected Server: [SelectedServer.id]" - - if(SelectedServer.totaltraffic >= 1024) - dat += "
Total recorded traffic: [round(SelectedServer.totaltraffic / 1024)] Terrabytes

" - else - dat += "
Total recorded traffic: [SelectedServer.totaltraffic] Gigabytes

" - - dat += "Stored Logs:
    " - - 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 += "
  1. [C.name] \[X\]
    " - - // -- If the orator is a human, or universal translate is active, OR mob has universal speech on -- - - 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: [C.parameters["race"]]
    " - dat += "Contents: \"[C.parameters["message"]]\"
    " - - - // -- Orator is not human and universal translate not active -- - - else - dat += "Data type: Audio File
    " - dat += "Source: Unidentifiable
    " - dat += "Class: [C.parameters["race"]]
    " - dat += "Contents: Unintelligble
    " - - dat += "

  2. " - - else if(C.input_type == "Execution Error") - - dat += "
  3. [C.name] \[X\]
    " - dat += "Output: \"[C.parameters["message"]]\"
    " - dat += "

  4. " - - - dat += "
" - - - - user << browse(dat.Join(""), "window=comm_monitor;size=575x400") - onclose(user, "server_control") - - temp = "" - return - - - Topic(href, href_list) - if(..()) - return - - - add_fingerprint(usr) - usr.set_machine(src) - - if(href_list["viewserver"]) - screen = 1 - for(var/obj/machinery/telecomms/T in servers) - if(T.id == href_list["viewserver"]) - SelectedServer = T - break - - if(href_list["operation"]) - switch(href_list["operation"]) - - if("release") - servers = list() - screen = 0 - - if("mainmenu") - screen = 0 - - if("scan") - if(servers.len > 0) - temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -" - - else - for(var/obj/machinery/telecomms/server/T in range(25, src)) - if(T.network == network) - servers.Add(T) - - if(!servers.len) - temp = "- FAILED: UNABLE TO LOCATE SERVERS IN \[[network]\] -" - else - temp = "- [servers.len] SERVERS PROBED & BUFFERED -" - - screen = 0 - - if(href_list["delete"]) - - if(!src.allowed(usr) && !emagged) - to_chat(usr, "ACCESS DENIED.") - return - - if(SelectedServer) - - var/datum/comm_log_entry/D = SelectedServer.log_entries[text2num(href_list["delete"])] - - temp = "- DELETED ENTRY: [D.name] -" - - SelectedServer.log_entries.Remove(D) - qdel(D) - - else - temp = "- FAILED: NO SELECTED MACHINE -" - - if(href_list["network"]) - - var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text - - if(newnet && ((usr in range(1, src) || issilicon(usr)))) - if(length(newnet) > 15) - temp = "- FAILED: NETWORK TAG STRING TOO LENGHTLY -" - - else - - network = newnet - screen = 0 - servers = list() - temp = "- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -" - - updateUsrDialog() - return - - attackby(var/obj/item/D as obj, var/mob/user as mob, params) - if(istype(D, /obj/item/screwdriver)) - playsound(src.loc, D.usesound, 50, 1) - if(do_after(user, 20 * D.toolspeed, target = src)) - if(src.stat & BROKEN) - to_chat(user, "The broken glass falls out.") - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) - new /obj/item/shard(loc) - var/obj/item/circuitboard/comm_server/M = new /obj/item/circuitboard/comm_server( A ) - for(var/obj/C in src) - C.loc = src.loc - A.circuit = M - A.state = 3 - A.icon_state = "3" - A.anchored = 1 - qdel(src) - else - to_chat(user, "You disconnect the monitor.") - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) - var/obj/item/circuitboard/comm_server/M = new /obj/item/circuitboard/comm_server( A ) - for(var/obj/C in src) - C.loc = src.loc - A.circuit = M - A.state = 4 - A.icon_state = "4" - A.anchored = 1 - qdel(src) - updateUsrDialog() - return - return ..() - - emag_act(user as mob) - if(!emagged) - playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1) - emagged = 1 - to_chat(user, "You you disable the security protocols") diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm deleted file mode 100644 index 452c7280e80..00000000000 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ /dev/null @@ -1,399 +0,0 @@ -/* - - All telecommunications interactions: - -*/ - - -/obj/machinery/telecomms - var/temp = "" // output message - var/construct_op = 0 - - -/obj/machinery/telecomms/attackby(obj/item/P as obj, mob/user as mob, params) - - // Using a multitool lets you access the receiver's interface - if(istype(P, /obj/item/multitool)) - attack_hand(user) - - - switch(construct_op) - if(0) - if(istype(P, /obj/item/screwdriver)) - to_chat(user, "You unfasten the bolts.") - playsound(src.loc, P.usesound, 50, 1) - construct_op++ - return - if(1) - if(istype(P, /obj/item/screwdriver)) - to_chat(user, "You fasten the bolts.") - playsound(src.loc,P.usesound, 50, 1) - construct_op-- - if(istype(P, /obj/item/wrench)) - to_chat(user, "You dislodge the external plating.") - playsound(src.loc, P.usesound, 75, 1) - construct_op++ - return - if(2) - if(istype(P, /obj/item/wrench)) - to_chat(user, "You secure the external plating.") - playsound(src.loc, P.usesound, 75, 1) - construct_op-- - if(istype(P, /obj/item/wirecutters)) - playsound(src.loc, P.usesound, 50, 1) - to_chat(user, "You remove the cables.") - construct_op++ - var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( user.loc ) - A.amount = 5 - stat |= BROKEN // the machine's been borked! - return - if(3) - if(istype(P, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/A = P - if(A.amount >= 5) - playsound(loc, A.usesound, 50, 1) - to_chat(user, "You insert the cables.") - A.amount -= 5 - if(A.amount <= 0) - user.drop_item() - qdel(A) - construct_op-- - stat &= ~BROKEN // the machine's not borked anymore! - return - if(istype(P, /obj/item/crowbar)) - to_chat(user, "You begin prying out the circuit board other components...") - playsound(src.loc, P.usesound, 50, 1) - if(do_after(user, 60 * P.toolspeed, target = src)) - to_chat(user, "You finish prying out the components.") - - // Drop all the component stuff - if(component_parts) - for(var/obj/I in component_parts) - I.loc = src.loc - else - // If the machine wasn't made during runtime, probably doesn't have components: - // manually find the components and drop them! - var/obj/item/circuitboard/C = new circuitboard - for(var/I in C.req_components) - for(var/i = 1, i <= C.req_components[I], i++) - var/obj/item/s = new I - s.loc = src.loc - if(istype(s, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/A = s - A.amount = 1 - - // Drop a circuit board too - C.loc = src.loc - - // Create a machine frame and delete the current machine - var/obj/machinery/constructable_frame/machine_frame/F = new - F.loc = src.loc - qdel(src) - return - return ..() - -/obj/machinery/telecomms/proc/formatInput(var/label,var/varname, var/input) - var/value = vars[varname] - if(!value || value=="") - value="-----" - return "[label]: [value]" - -/obj/machinery/telecomms/attack_ai(var/mob/user as mob) - attack_hand(user) - -/obj/machinery/telecomms/attack_hand(var/mob/user as mob) - update_multitool_menu(user) - -/obj/machinery/telecomms/multitool_menu(var/mob/user,var/obj/item/multitool/P) - // You need a multitool to use this, or be silicon - if(!issilicon(user)) - // istype returns false if the value is null - if(!istype(user.get_active_hand(), /obj/item/multitool)) - return - - if(stat & (BROKEN|NOPOWER)) - return - - var/dat - - dat = {" -

[temp]

-

Power Status: [src.toggled ? "On" : "Off"]

"} - if(on && toggled) - dat += {" -

[formatInput("Identification String","id","id")]

-

[formatInput("Network","network","network")]

-

Prefabrication: [autolinkers.len ? "TRUE" : "FALSE"]

- "} - if(hide) - dat += "

Shadow Link: ACTIVE

" - - //Show additional options for certain machines. - dat += Options_Menu() - - dat += {"

Linked Network Entities:

    "} - var/i = 0 - for(var/obj/machinery/telecomms/T in links) - i++ - if(T.hide && !src.hide) - continue - dat += "
  1. \ref[T] [T.name] ([T.id]) \[X\]
  2. " - - // AUTOFIXED BY fix_string_idiocy.py - // C:\Users\Rob\Documents\Projects\vgstation13\code\game\machinery\telecomms\machine_interactions.dm:140: dat += "
" - dat += {" -

Filtering Frequencies:

"} - // END AUTOFIX - i = 0 - if(length(freq_listening)) - dat += "" - else - dat += "
  • NONE
  • " - - - // AUTOFIXED BY fix_string_idiocy.py - // C:\Users\Rob\Documents\Projects\vgstation13\code\game\machinery\telecomms\machine_interactions.dm:155: dat += "
    \[Add Filter\]" - dat += {"

    \[Add Filter\]

    -
    "} - // END AUTOFIX - - return dat - -/obj/machinery/telecomms/canLink(var/obj/O) - return istype(O,/obj/machinery/telecomms) - -/obj/machinery/telecomms/isLinkedWith(var/obj/O) - return O != null && (O in links) - -/obj/machinery/telecomms/getLink(var/idx) - return (idx >= 1 && idx <= links.len) ? links[idx] : null - -// Off-Site Relays -// -// You are able to send/receive signals from the station's z level (changeable in the STATION_Z #define) if -// the relay is on the telecomm satellite (changable in the TELECOMM_Z #define) - - -/obj/machinery/telecomms/relay/proc/toggle_level() - - var/turf/position = get_turf(src) - - // Toggle on/off getting signals from the station or the current Z level - // TODO: Could work with the space manager better - if(is_station_level(src.listening_level)) // equals the station - src.listening_level = position.z - return 1 - else if(level_boosts_signal(position.z)) - src.listening_level = level_name_to_num(MAIN_STATION) - return 1 - return 0 - -// Returns a multitool from a user depending on their mobtype. - -/obj/machinery/telecomms/proc/get_multitool(mob/user as mob) - - var/obj/item/multitool/P = null - // Let's double check - if(!issilicon(user) && istype(user.get_active_hand(), /obj/item/multitool)) - P = user.get_active_hand() - else if(isAI(user)) - var/mob/living/silicon/ai/U = user - P = U.aiMulti - else if(isrobot(user) && in_range(user, src)) - if(istype(user.get_active_hand(), /obj/item/multitool)) - P = user.get_active_hand() - return P - -// Additional Options for certain machines. Use this when you want to add an option to a specific machine. -// Example of how to use below. - -/obj/machinery/telecomms/proc/Options_Menu() - return "" - -/* -// Add an option to the processor to switch processing mode. (COMPRESS -> UNCOMPRESS or UNCOMPRESS -> COMPRESS) -/obj/machinery/telecomms/processor/Options_Menu() - var/dat = "
    Processing Mode: [process_mode ? "UNCOMPRESS" : "COMPRESS"]" - return dat -*/ -// The topic for Additional Options. Use this for checking href links for your specific option. -// Example of how to use below. -/obj/machinery/telecomms/proc/Options_Topic(href, href_list) - return - -/* -/obj/machinery/telecomms/processor/Options_Topic(href, href_list) - - if(href_list["process"]) - temp = "-% Processing mode changed. %-" - src.process_mode = !src.process_mode -*/ - -// RELAY - -/obj/machinery/telecomms/relay/Options_Menu() - var/dat = "" - if(level_boosts_signal(src.z)) - dat += "
    Signal Locked to Station: [is_station_level(listening_level) ? "TRUE" : "FALSE"]" - dat += "
    Broadcasting: [broadcasting ? "YES" : "NO"]" - dat += "
    Receiving: [receiving ? "YES" : "NO"]" - return dat - -/obj/machinery/telecomms/relay/Options_Topic(href, href_list) - - if(href_list["receive"]) - receiving = !receiving - temp = "-% Receiving mode changed. %-" - if(href_list["broadcast"]) - broadcasting = !broadcasting - temp = "-% Broadcasting mode changed. %-" - if(href_list["change_listening"]) - //Lock to the station OR lock to the current position! - //You need at least two receivers and two broadcasters for this to work, this includes the machine. - var/result = toggle_level() - if(result) - temp = "-% [src]'s signal has been successfully changed." - else - temp = "-% [src] could not lock it's signal onto the station. Two broadcasters or receivers required." - -// BUS - -/obj/machinery/telecomms/bus/Options_Menu() - var/dat = "
    Change Signal Frequency: [change_frequency ? "YES ([change_frequency])" : "NO"]" - return dat - -/obj/machinery/telecomms/bus/Options_Topic(href, href_list) - - if(href_list["change_freq"]) - - var/newfreq = input(usr, "Specify a new frequency for new signals to change to. Enter null to turn off frequency changing. Decimals assigned automatically.", src, network) as null|num - if(canAccess(usr)) - if(newfreq) - if(findtext(num2text(newfreq), ".")) - newfreq *= 10 // shift the decimal one place - if(newfreq < 10000) - change_frequency = newfreq - temp = "-% New frequency to change to assigned: \"[newfreq] GHz\" %-" - else - change_frequency = 0 - temp = "-% Frequency changing deactivated %-" - - -/obj/machinery/telecomms/Topic(href, href_list) - - if(!issilicon(usr)) - if(!istype(usr.get_active_hand(), /obj/item/multitool)) - return - - if(stat & (BROKEN|NOPOWER)) - return - - var/obj/item/multitool/P = get_multitool(usr) - - if(href_list["input"]) - switch(href_list["input"]) - - if("toggle") - - src.toggled = !src.toggled - temp = "-% [src] has been [src.toggled ? "activated" : "deactivated"]." - update_power() - - /* - if("hide") - src.hide = !hide - temp = "-% Shadow Link has been [src.hide ? "activated" : "deactivated"]." - */ - - if("id") - var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID for this machine", src, id) as null|text),1,MAX_MESSAGE_LEN) - if(newid && canAccess(usr)) - id = newid - temp = "-% New ID assigned: \"[id]\" %-" - - if("network") - var/newnet = input(usr, "Specify the new network for this machine. This will break all current links.", src, network) as null|text - if(newnet && canAccess(usr)) - - if(length(newnet) > 15) - temp = "-% Too many characters in new network tag %-" - - else - for(var/obj/machinery/telecomms/T in links) - T.links.Remove(src) - - network = newnet - links = list() - temp = "-% New network tag assigned: \"[network]\" %-" - - - if("freq") - var/newfreq = input(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, network) as null|num - if(newfreq && canAccess(usr)) - if(findtext(num2text(newfreq), ".")) - newfreq *= 10 // shift the decimal one place - if(!(newfreq in freq_listening) && newfreq < 10000) - freq_listening.Add(newfreq) - temp = "-% New frequency filter assigned: \"[newfreq] GHz\" %-" - - if(href_list["delete"]) - - // changed the layout about to workaround a pesky runtime -- Doohl - - var/x = text2num(href_list["delete"]) - temp = "-% Removed frequency filter [x] %-" - freq_listening.Remove(x) - - if(href_list["unlink"]) - - if(text2num(href_list["unlink"]) <= length(links)) - var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])] - temp = "-% Removed \ref[T] [T.name] from linked entities. %-" - - // Remove link entries from both T and src. - - if(src in T.links) - T.links.Remove(src) - links.Remove(T) - - if(href_list["link"]) - - if(P) - var/obj/machinery/telecomms/T = P.buffer - if(istype(T) && T != src) - if(!(src in T.links)) - T.links += src - - if(!(T in links)) - links += T - - temp = "-% Successfully linked with [(T.UID())] [T.name] %-" - - else - temp = "-% Unable to acquire buffer %-" - - if(href_list["buffer"]) - - P.buffer = src - temp = "-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-" - - - if(href_list["flush"]) - - temp = "-% Buffer successfully flushed. %-" - P.buffer = null - - src.Options_Topic(href, href_list) - - usr.set_machine(src) - src.add_fingerprint(usr) - - updateUsrDialog() - -/obj/machinery/telecomms/proc/canAccess(var/mob/user) - if(issilicon(user) || in_range(user, src)) - return 1 - return 0 diff --git a/code/game/machinery/telecomms/ntsl2.dm b/code/game/machinery/telecomms/ntsl2.dm index 23c5f3c6372..ec938c46bfd 100644 --- a/code/game/machinery/telecomms/ntsl2.dm +++ b/code/game/machinery/telecomms/ntsl2.dm @@ -2,7 +2,6 @@ #define JOB_STYLE_2 "Name - Job" #define JOB_STYLE_3 "\[Job\] Name" #define JOB_STYLE_4 "(Job) Name" -GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) // Custom Implementations for NTTC /* NTTC Configuration Datum * This is an abstract handler for the configuration loadout. It's set up like this both for ease of transfering in and out of the UI @@ -510,3 +509,54 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) dat += "" return dat +//// NTTC PC //// +/obj/machinery/computer/telecomms/traffic + name = "telecommunications traffic control" + + light_color = LIGHT_COLOR_DARKGREEN + + req_access = list(ACCESS_TCOMSAT) + circuit = /obj/item/circuitboard/comm_traffic + + // NTTC + var/window_id // mostly used to let the configuration datum update the user's UI + var/unlocked = FALSE + +/obj/machinery/computer/telecomms/traffic/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + unlocked = !unlocked + to_chat(user, "This computer is now [unlocked ? "Unlocked" : "Locked"]. Reopen the UI to see the difference.") + +/obj/machinery/computer/telecomms/traffic/attack_hand(mob/user) + interact(user) + +/obj/machinery/computer/telecomms/traffic/interact(mob/user) + if(stat & (BROKEN|NOPOWER)) + return 0 + + /* + if(GLOB.nttc_config.valid_languages.len == 1) + GLOB.nttc_config.update_languages() // this is silly but it has to be done because NTTC inits before languages do + var/datum/asset/assets = get_asset_datum(/datum/asset/simple/nttc) + assets.send(user) + + var/dat = file2text("html/nttc/dist/index.html") + if(unlocked) + dat += "\n" + var/datum/browser/nttc/nt_browser = new(user, name, "NTTC", 720, 480, src, GLOB.nttc_config.nttc_serialize()) + nt_browser.set_content(dat) + nt_browser.open() + window_id = nt_browser.window_id + */ + +/obj/machinery/computer/telecomms/traffic/Topic(href, href_list) + if(..()) + return 1 + + var/mob/user = usr + if(!istype(user) || !user.client) + return 0 + + //GLOB.nttc_config.Topic(user, href_list, window_id, src) diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm deleted file mode 100644 index 212d8592e92..00000000000 --- a/code/game/machinery/telecomms/presets.dm +++ /dev/null @@ -1,234 +0,0 @@ -// ### Preset machines ### - -//Relay - -/obj/machinery/telecomms/relay/preset - network = "tcommsat" - -/obj/machinery/telecomms/relay/preset/station - id = "Station Relay" - listening_level = 1 - autolinkers = list("s_relay") - -/obj/machinery/telecomms/relay/preset/telecomms - id = "Telecomms Relay" - autolinkers = list("relay") - -/obj/machinery/telecomms/relay/preset/mining - id = "Mining Relay" - autolinkers = list("m_relay") - -/obj/machinery/telecomms/relay/preset/ruskie - id = "Ruskie Relay" - hide = 1 - toggled = 0 - autolinkers = list("r_relay") - -/obj/machinery/telecomms/relay/preset/engioutpost - id = "Engineering Outpost" - hide = 1 - toggled = 0 - autolinkers = list("e_relay") - -/obj/machinery/telecomms/relay/preset/centcom - id = "Centcom Relay" - hide = 1 - toggled = 1 - //anchored = 1 - use_power = NO_POWER_USE - //idle_power_usage = 0 - autolinkers = list("c_relay") - -//HUB - -/obj/machinery/telecomms/hub/preset - id = "Hub" - network = "tcommsat" - autolinkers = list("hub", "relay", "c_relay", "s_relay", "m_relay", "r_relay", "e_relay", "science", "medical", - "supply", "service", "common", "command", "engineering", "security", - "receiverA", "receiverB", "broadcasterA", "broadcasterB") - -/obj/machinery/telecomms/hub/preset_cent - id = "CentComm Hub" - network = "tcommsat" - use_power = NO_POWER_USE - autolinkers = list("hub_cent", "c_relay", "s_relay", "m_relay", "r_relay", "e_relay", - "centcomm", "receiverCent", "broadcasterCent") - -//Receivers - -//--PRESET LEFT--// - -/obj/machinery/telecomms/receiver/preset_left - id = "Receiver A" - network = "tcommsat" - autolinkers = list("receiverA") // link to relay - freq_listening = list(SCI_FREQ, MED_FREQ, SUP_FREQ, SRV_FREQ) - - -//--PRESET RIGHT--// - -/obj/machinery/telecomms/receiver/preset_right - id = "Receiver B" - network = "tcommsat" - autolinkers = list("receiverB") // link to relay - freq_listening = list(AI_FREQ, COMM_FREQ, ENG_FREQ, SEC_FREQ) - - //Common and other radio frequencies for people to freely use -/obj/machinery/telecomms/receiver/preset_right/New() - for(var/i = PUBLIC_LOW_FREQ, i < PUBLIC_HIGH_FREQ, i += 2) - freq_listening |= i - ..() - -/obj/machinery/telecomms/receiver/preset_cent - id = "CentComm Receiver" - network = "tcommsat" - use_power = NO_POWER_USE - autolinkers = list("receiverCent") - freq_listening = list(ERT_FREQ, DTH_FREQ) - -//Buses - -/obj/machinery/telecomms/bus/preset_one - id = "Bus 1" - network = "tcommsat" - freq_listening = list(SCI_FREQ, MED_FREQ) - autolinkers = list("processor1", "science", "medical") - -/obj/machinery/telecomms/bus/preset_two - id = "Bus 2" - network = "tcommsat" - freq_listening = list(SUP_FREQ, SRV_FREQ) - autolinkers = list("processor2", "supply", "service") - -/obj/machinery/telecomms/bus/preset_three - id = "Bus 3" - network = "tcommsat" - freq_listening = list(SEC_FREQ, COMM_FREQ) - autolinkers = list("processor3", "security", "command") - -/obj/machinery/telecomms/bus/preset_four - id = "Bus 4" - network = "tcommsat" - freq_listening = list(ENG_FREQ, AI_FREQ, PUB_FREQ) - autolinkers = list("processor4", "engineering", "common") - -/obj/machinery/telecomms/bus/preset_four/New() - for(var/i = PUBLIC_LOW_FREQ, i < PUBLIC_HIGH_FREQ, i += 2) - freq_listening |= i - ..() - -/obj/machinery/telecomms/bus/preset_cent - id = "CentComm Bus" - network = "tcommsat" - use_power = NO_POWER_USE - freq_listening = list(ERT_FREQ, DTH_FREQ) - autolinkers = list("processorCent", "centcomm") - -//Processors - -/obj/machinery/telecomms/processor/preset_one - id = "Processor 1" - network = "tcommsat" - autolinkers = list("processor1") // processors are sort of isolated; they don't need backward links - -/obj/machinery/telecomms/processor/preset_two - id = "Processor 2" - network = "tcommsat" - autolinkers = list("processor2") - -/obj/machinery/telecomms/processor/preset_three - id = "Processor 3" - network = "tcommsat" - autolinkers = list("processor3") - -/obj/machinery/telecomms/processor/preset_four - id = "Processor 4" - network = "tcommsat" - autolinkers = list("processor4") - -/obj/machinery/telecomms/processor/preset_cent - id = "CentComm Processor" - network = "tcommsat" - use_power = NO_POWER_USE - autolinkers = list("processorCent") - -//Servers - -/obj/machinery/telecomms/server/presets - - network = "tcommsat" - -/obj/machinery/telecomms/server/presets/science - id = "Science Server" - freq_listening = list(SCI_FREQ) - autolinkers = list("science") - -/obj/machinery/telecomms/server/presets/medical - id = "Medical Server" - freq_listening = list(MED_FREQ) - autolinkers = list("medical") - -/obj/machinery/telecomms/server/presets/supply - id = "Supply Server" - freq_listening = list(SUP_FREQ) - autolinkers = list("supply") - -/obj/machinery/telecomms/server/presets/service - id = "Service Server" - freq_listening = list(SRV_FREQ) - autolinkers = list("service") - -/obj/machinery/telecomms/server/presets/common - id = "Common Server" - freq_listening = list(PUB_FREQ, AI_FREQ) - autolinkers = list("common") - -//Common and other radio frequencies for people to freely use -/obj/machinery/telecomms/server/presets/common/New() - for(var/i = PUBLIC_LOW_FREQ, i < PUBLIC_HIGH_FREQ, i += 2) - freq_listening |= i - ..() - -/obj/machinery/telecomms/server/presets/command - id = "Command Server" - freq_listening = list(COMM_FREQ) - autolinkers = list("command") - -/obj/machinery/telecomms/server/presets/engineering - id = "Engineering Server" - freq_listening = list(ENG_FREQ) - autolinkers = list("engineering") - -/obj/machinery/telecomms/server/presets/security - id = "Security Server" - freq_listening = list(SEC_FREQ) - autolinkers = list("security") - -/obj/machinery/telecomms/server/presets/centcomm - id = "CentComm Server" - freq_listening = list(ERT_FREQ, DTH_FREQ) - use_power = NO_POWER_USE - autolinkers = list("centcomm") - -//Broadcasters - -//--PRESET LEFT--// - -/obj/machinery/telecomms/broadcaster/preset_left - id = "Broadcaster A" - network = "tcommsat" - autolinkers = list("broadcasterA") - -//--PRESET RIGHT--// - -/obj/machinery/telecomms/broadcaster/preset_right - id = "Broadcaster B" - network = "tcommsat" - autolinkers = list("broadcasterB") - -/obj/machinery/telecomms/broadcaster/preset_cent - id = "CentComm Broadcaster" - network = "tcommsat" - use_power = NO_POWER_USE - autolinkers = list("broadcasterCent") diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm deleted file mode 100644 index aa4eb4d9c22..00000000000 --- a/code/game/machinery/telecomms/telecomunications.dm +++ /dev/null @@ -1,529 +0,0 @@ -/* - Hello, friends, this is Doohl from sexylands. You may be wondering what this - monstrous code file is. Sit down, boys and girls, while I tell you the tale. - - - The machines defined in this file were designed to be compatible with any radio - signals, provided they use subspace transmission. Currently they are only used for - headsets, but they can eventually be outfitted for real COMPUTER networks. This - is just a skeleton, ladies and gentlemen. - - Look at radio.dm for the prequel to this code. -*/ - -GLOBAL_LIST_EMPTY(telecomms_list) - -/obj/machinery/telecomms - var/list/links = list() // list of machines this machine is linked to - var/traffic = 0 // value increases as traffic increases - var/netspeed = 5 // how much traffic to lose per tick (50 gigabytes/second * netspeed) - var/list/autolinkers = list() // list of text/number values to link with - var/id = "NULL" // identification string - var/network = "NULL" // the network of the machinery - - var/list/freq_listening = list() // list of frequencies to tune into: if none, will listen to all - - var/machinetype = 0 // just a hacky way of preventing alike machines from pairing - var/toggled = 1 // Is it toggled on - var/on = 1 - var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub) - var/circuitboard = null // type pointing to a circuitboard type - var/hide = 0 // Is it a hidden machine? - var/listening_level = 0 // 0 = auto set in New() - this is the z level that the machine is listening to. - Mtoollink = 1 - -/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20) - // relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending - - if(!on) - return -// to_chat(world, "[src] ([src.id]) - [signal.debug_print()]") - var/send_count = 0 - - - // Apply some lag based on traffic rates - var/netlag = round(traffic / 50) - if(netlag > signal.data["slow"]) - signal.data["slow"] = netlag - -// Loop through all linked machines and send the signal or copy. - for(var/obj/machinery/telecomms/machine in links) - if(filter && !istype( machine, text2path(filter) )) - continue - if(!machine.on) - continue - if(amount && send_count >= amount) - break - // TODO: Make the radio system cooperate with the space manager - if(machine.loc.z != listening_level) - if(long_range_link == 0 && machine.long_range_link == 0) - continue - // If we're sending a copy, be sure to create the copy for EACH machine and paste the data - var/datum/signal/copy - if(copysig) - copy = new - copy.transmission_method = 2 - copy.frequency = signal.frequency - copy.data = signal.data.Copy() - - // Keep the "original" signal constant - if(!signal.data["original"]) - copy.data["original"] = signal - else - copy.data["original"] = signal.data["original"] - - send_count++ - if(machine.is_freq_listening(signal)) - machine.traffic++ - - if(copysig) - machine.receive_information(copy, src) - else - machine.receive_information(signal, src) - - - if(send_count > 0 && is_freq_listening(signal)) - traffic++ - - return send_count - -/obj/machinery/telecomms/proc/relay_direct_information(datum/signal/signal, obj/machinery/telecomms/machine) - // send signal directly to a machine - machine.receive_information(signal, src) - -/obj/machinery/telecomms/proc/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - // receive information from linked machinery - return - -/obj/machinery/telecomms/proc/is_freq_listening(datum/signal/signal) - // return 1 if found, 0 if not found - if(!signal) - return 0 - if((signal.frequency in freq_listening) || (!freq_listening.len)) - return 1 - else - return 0 - - -/obj/machinery/telecomms/New() - GLOB.telecomms_list += src - ..() - - //Set the listening_level if there's none. - if(!listening_level) - //Defaults to our Z level! - var/turf/position = get_turf(src) - // TODO: Make the radio system cooperate with the space manager - listening_level = position.z - -/obj/machinery/telecomms/Initialize() - ..() - if(autolinkers.len) - // Links nearby machines - if(!long_range_link) - for(var/obj/machinery/telecomms/T in orange(20, src)) - add_link(T) - else - for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) - add_link(T) - - -/obj/machinery/telecomms/Destroy() - GLOB.telecomms_list -= src - for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list) - comm.links -= src - links.Cut() - return ..() - -// Used in auto linking -/obj/machinery/telecomms/proc/add_link(var/obj/machinery/telecomms/T) - var/turf/position = get_turf(src) - var/turf/T_position = get_turf(T) - // TODO: Make the radio system cooperate with the space manager - if((position.z == T_position.z) || (src.long_range_link && T.long_range_link)) - for(var/x in autolinkers) - if(T.autolinkers.Find(x)) - if(src != T) - links |= T - -/obj/machinery/telecomms/update_icon() - if(on) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]_off" - -/obj/machinery/telecomms/proc/update_power() - - if(toggled) - if(stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off - on = 0 - else - on = 1 - else - on = 0 - -/obj/machinery/telecomms/process() - update_power() - - // Update the icon - update_icon() - - if(traffic > 0) - traffic -= netspeed - -/obj/machinery/telecomms/emp_act(severity) - if(prob(100/severity)) - if(!(stat & EMPED)) - stat |= EMPED - var/duration = (300 * 10)/severity - spawn(rand(duration - 20, duration + 20)) // Takes a long time for the machines to reboot. - stat &= ~EMPED - ..() - -/* - The receiver idles and receives messages from subspace-compatible radio equipment; - primarily headsets. They then just relay this information to all linked devices, - which can would probably be network hubs. - - Link to Processor Units in case receiver can't send to bus units. -*/ - -/obj/machinery/telecomms/receiver - name = "Subspace Receiver" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "broadcast receiver" - desc = "This machine has a dish-like shape and green lights. It is designed to detect and process subspace radio activity." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 30 - machinetype = 1 - circuitboard = /obj/item/circuitboard/telecomms/receiver - -/obj/machinery/telecomms/receiver/receive_signal(datum/signal/signal) - - if(!on) // has to be on to receive messages - return - if(!signal) - return - if(!check_receive_level(signal)) - return - - if(signal.transmission_method == 2) - - if(is_freq_listening(signal)) // detect subspace signals - - //Remove the level and then start adding levels that it is being broadcasted in. - signal.data["level"] = list() - - var/can_send = relay_information(signal, "/obj/machinery/telecomms/hub") // ideally relay the copied information to relays - if(!can_send) - relay_information(signal, "/obj/machinery/telecomms/bus") // Send it to a bus instead, if it's linked to one - -/obj/machinery/telecomms/receiver/proc/check_receive_level(datum/signal/signal) - - if(signal.data["level"] != listening_level) - for(var/obj/machinery/telecomms/hub/H in links) - var/list/connected_levels = list() - for(var/obj/machinery/telecomms/relay/R in H.links) - if(R.can_receive(signal)) - connected_levels |= R.listening_level - if(signal.data["level"] in connected_levels) - return 1 - return 0 - return 1 - - -/* - The HUB idles until it receives information. It then passes on that information - depending on where it came from. - - This is the heart of the Telecommunications Network, sending information where it - is needed. It mainly receives information from long-distance Relays and then sends - that information to be processed. Afterwards it gets the uncompressed information - from Servers/Buses and sends that back to the relay, to then be broadcasted. -*/ - -/obj/machinery/telecomms/hub - name = "Telecommunication Hub" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "hub" - desc = "A mighty piece of hardware used to send/receive massive amounts of data." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 80 - machinetype = 7 - circuitboard = /obj/item/circuitboard/telecomms/hub - long_range_link = 1 - netspeed = 40 - - -/obj/machinery/telecomms/hub/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - if(is_freq_listening(signal)) - if(istype(machine_from, /obj/machinery/telecomms/receiver)) - //If the signal is compressed, send it to the bus. - relay_information(signal, "/obj/machinery/telecomms/bus", 1) // ideally relay the copied information to bus units - else - // Get a list of relays that we're linked to, then send the signal to their levels. - relay_information(signal, "/obj/machinery/telecomms/relay", 1) - relay_information(signal, "/obj/machinery/telecomms/broadcaster", 1) // Send it to a broadcaster. - - -/* - The relay idles until it receives information. It then passes on that information - depending on where it came from. - - The relay is needed in order to send information pass Z levels. It must be linked - with a HUB, the only other machine that can send/receive pass Z levels. -*/ - -/obj/machinery/telecomms/relay - name = "Telecommunication Relay" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "relay" - desc = "A mighty piece of hardware used to send massive amounts of data far away." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 30 - machinetype = 8 - circuitboard = /obj/item/circuitboard/telecomms/relay - netspeed = 5 - long_range_link = 1 - var/broadcasting = 1 - var/receiving = 1 - -/obj/machinery/telecomms/relay/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - - // Add our level and send it back - if(can_send(signal)) - signal.data["level"] |= listening_level - -// Checks to see if it can send/receive. - -/obj/machinery/telecomms/relay/proc/can(datum/signal/signal) - if(!on) - return 0 - if(!is_freq_listening(signal)) - return 0 - return 1 - -/obj/machinery/telecomms/relay/proc/can_send(datum/signal/signal) - if(!can(signal)) - return 0 - return broadcasting - -/obj/machinery/telecomms/relay/proc/can_receive(datum/signal/signal) - if(!can(signal)) - return 0 - return receiving - -/* - The bus mainframe idles and waits for hubs to relay them signals. They act - as junctions for the network. - - They transfer uncompressed subspace packets to processor units, and then take - the processed packet to a server for logging. - - Link to a subspace hub if it can't send to a server. -*/ - -/obj/machinery/telecomms/bus - name = "Bus Mainframe" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "bus" - desc = "A mighty piece of hardware used to send massive amounts of data quickly." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 50 - machinetype = 2 - circuitboard = /obj/item/circuitboard/telecomms/bus - netspeed = 40 - var/change_frequency = 0 - -/obj/machinery/telecomms/bus/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - - if(is_freq_listening(signal)) - - if(change_frequency) - signal.frequency = change_frequency - - if(!istype(machine_from, /obj/machinery/telecomms/processor) && machine_from != src) // Signal must be ready (stupid assuming machine), let's send it - // send to one linked processor unit - var/send_to_processor = relay_information(signal, "/obj/machinery/telecomms/processor") - - if(send_to_processor) - return - // failed to send to a processor, relay information anyway - signal.data["slow"] += rand(1, 5) // slow the signal down only slightly - src.receive_information(signal, src) - - // Try sending it! - var/list/try_send = list("/obj/machinery/telecomms/server", "/obj/machinery/telecomms/hub", "/obj/machinery/telecomms/broadcaster") - var/i = 0 - for(var/send in try_send) - if(i) - signal.data["slow"] += rand(0, 1) // slow the signal down only slightly - i++ - var/can_send = relay_information(signal, send) - if(can_send) - break - - - -/* - The processor is a very simple machine that decompresses subspace signals and - transfers them back to the original bus. It is essential in producing audible - data. - - Link to servers if bus is not present -*/ - -/obj/machinery/telecomms/processor - name = "Processor Unit" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "processor" - desc = "This machine is used to process large quantities of information." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 30 - machinetype = 3 - circuitboard = /obj/item/circuitboard/telecomms/processor - var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals - - receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - - if(is_freq_listening(signal)) - - if(process_mode) - signal.data["compression"] = 0 // uncompress subspace signal - else - signal.data["compression"] = 100 // even more compressed signal - - if(istype(machine_from, /obj/machinery/telecomms/bus)) - relay_direct_information(signal, machine_from) // send the signal back to the machine - else // no bus detected - send the signal to servers instead - signal.data["slow"] += rand(5, 10) // slow the signal down - relay_information(signal, "/obj/machinery/telecomms/server") - - -/* - The server logs all traffic and signal data. Once it records the signal, it sends - it to the subspace broadcaster. - - Store a maximum of 100 logs and then deletes them. -*/ - - -/obj/machinery/telecomms/server - name = "Telecommunication Server" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "comm_server" - desc = "A machine used to store data and network statistics." - density = 1 - anchored = 1 - use_power = IDLE_POWER_USE - idle_power_usage = 15 - machinetype = 4 - circuitboard = /obj/item/circuitboard/telecomms/server - var/list/log_entries = list() - var/list/stored_names = list() - var/list/TrafficActions = list() - var/logs = 0 // number of logs - var/totaltraffic = 0 // gigabytes (if > 1024, divide by 1024 -> terrabytes) - - var/encryption = "null" // encryption key: ie "password" - var/salt = "null" // encryption salt: ie "123comsat" - // would add up to md5("password123comsat") - var/obj/item/radio/headset/server_radio = null - -/obj/machinery/telecomms/server/Initialize() - ..() - server_radio = new() - -/obj/machinery/telecomms/server/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - if(signal.data["message"]) - if(is_freq_listening(signal)) - if(traffic > 0) - totaltraffic += traffic // add current traffic to total traffic - - //Is this a test signal? Bypass logging - if(signal.data["type"] != 4) - // If signal has a message and appropriate frequency - update_logs() - - var/datum/comm_log_entry/log = new - var/mob/M = signal.data["mob"] - - // 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["key"] = signal.data["key"] - log.parameters["vmessage"] = multilingual_to_message(signal.data["message"]) - log.parameters["vname"] = signal.data["vname"] - log.parameters["message"] = multilingual_to_message(signal.data["message"]) - log.parameters["name"] = signal.data["name"] - log.parameters["realname"] = signal.data["realname"] - - if(!istype(M, /mob/new_player) && M) - log.parameters["uspeech"] = M.universal_speak - else - log.parameters["uspeech"] = 0 - - // If the signal is still compressed, make the log entry gibberish - if(signal.data["compression"] > 0) - log.parameters["message"] = Gibberish(multilingual_to_message(signal.data["message"]), signal.data["compression"] + 50) - log.parameters["job"] = Gibberish(signal.data["job"], signal.data["compression"] + 50) - log.parameters["name"] = Gibberish(signal.data["name"], signal.data["compression"] + 50) - log.parameters["realname"] = Gibberish(signal.data["realname"], signal.data["compression"] + 50) - log.parameters["vname"] = Gibberish(signal.data["vname"], signal.data["compression"] + 50) - log.input_type = "Corrupt File" - - // Log and store everything that needs to be logged - log_entries.Add(log) - if(!(signal.data["name"] in stored_names)) - stored_names.Add(signal.data["name"]) - logs++ - signal.data["server"] = src - - // Give the log a name - var/identifier = num2text( rand(-1000,1000) + world.time ) - log.name = "data packet ([md5(identifier)])" - - // Run NTTC against the signal - if(GLOB.nttc_config) - GLOB.nttc_config.modify_signal(signal) - - var/can_send = relay_information(signal, "/obj/machinery/telecomms/hub") - if(!can_send) - relay_information(signal, "/obj/machinery/telecomms/broadcaster") - -/obj/machinery/telecomms/server/proc/update_logs() - // start deleting the very first log entry - if(logs >= 400) - for(var/i = 1, i <= logs, i++) // locate the first garbage collectable log entry and remove it - var/datum/comm_log_entry/L = log_entries[i] - if(L.garbage_collector) - log_entries.Remove(L) - logs-- - break - -/obj/machinery/telecomms/server/proc/add_entry(var/content, var/input) - var/datum/comm_log_entry/log = new - var/identifier = num2text( rand(-1000,1000) + world.time ) - log.name = "[input] ([md5(identifier)])" - log.input_type = input - log.parameters["message"] = content - log_entries.Add(log) - update_logs() - -// Simple log entry datum -/datum/comm_log_entry - var/parameters = list() // carbon-copy to signal.data[] - var/name = "data packet (#)" - var/garbage_collector = 1 // if set to 0, will not be garbage collected - var/input_type = "Speech File" diff --git a/code/game/machinery/telecomms/telemonitor.dm b/code/game/machinery/telecomms/telemonitor.dm deleted file mode 100644 index 73a9261feb0..00000000000 --- a/code/game/machinery/telecomms/telemonitor.dm +++ /dev/null @@ -1,161 +0,0 @@ -/* - Telecomms monitor tracks the overall trafficing of a telecommunications network - and displays a heirarchy of linked machines. -*/ - - -/obj/machinery/computer/telecomms/monitor - name = "telecommunications monitor" - icon_screen = "comm_monitor" - - var/screen = 0 // the screen number: - var/list/machinelist = list() // the machines located by the computer - var/obj/machinery/telecomms/SelectedMachine - - var/network = "NULL" // the network to probe - - var/temp = "" // temporary feedback messages - circuit = /obj/item/circuitboard/comm_monitor - - light_color = LIGHT_COLOR_DARKGREEN - - attack_hand(mob/user as mob) - if(stat & (BROKEN|NOPOWER)) - return - user.set_machine(src) - var/dat = "Telecommunications Monitor
    Telecommunications Monitor
    " - - switch(screen) - - - // --- Main Menu --- - - if(0) - dat += "
    [temp]

    " - dat += "
    Current Network: [network]
    " - if(machinelist.len) - dat += "
    Detected Network Entities:" - dat += "
    \[Flush Buffer\]" - else - dat += "\[Probe Network\]" - - - // --- Viewing Machine --- - - if(1) - dat += "
    [temp]
    " - dat += "
    \[Main Menu\]
    " - dat += "
    Current Network: [network]
    " - dat += "Selected Network Entity: [SelectedMachine.name] ([SelectedMachine.id])
    " - dat += "Linked Entities:
      " - for(var/obj/machinery/telecomms/T in SelectedMachine.links) - if(!T.hide) - dat += "
    1. \ref[T.id] [T.name] ([T.id])
    2. " - dat += "
    " - - - - user << browse(dat, "window=comm_monitor;size=575x400") - onclose(user, "server_control") - - temp = "" - return - - - Topic(href, href_list) - if(..()) - return - - - add_fingerprint(usr) - usr.set_machine(src) - - if(href_list["viewmachine"]) - screen = 1 - for(var/obj/machinery/telecomms/T in machinelist) - if(T.id == href_list["viewmachine"]) - SelectedMachine = T - break - - if(href_list["operation"]) - switch(href_list["operation"]) - - if("release") - machinelist = list() - screen = 0 - - if("mainmenu") - screen = 0 - - if("probe") - if(machinelist.len > 0) - temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -" - - else - for(var/obj/machinery/telecomms/T in range(25, src)) - if(T.network == network) - machinelist.Add(T) - - if(!machinelist.len) - temp = "- FAILED: UNABLE TO LOCATE NETWORK ENTITIES IN \[[network]\] -" - else - temp = "- [machinelist.len] ENTITIES LOCATED & BUFFERED -" - - screen = 0 - - - if(href_list["network"]) - - var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text - if(newnet && ((usr in range(1, src) || issilicon(usr)))) - if(length(newnet) > 15) - temp = "- FAILED: NETWORK TAG STRING TOO LENGHTLY -" - - else - network = newnet - screen = 0 - machinelist = list() - temp = "- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -" - - updateUsrDialog() - return - - attackby(var/obj/item/D as obj, var/mob/user as mob, params) - if(istype(D, /obj/item/screwdriver)) - playsound(src.loc, D.usesound, 50, 1) - if(do_after(user, 20 * D.toolspeed, target = src)) - if(src.stat & BROKEN) - to_chat(user, "The broken glass falls out.") - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) - new /obj/item/shard(loc) - var/obj/item/circuitboard/comm_monitor/M = new /obj/item/circuitboard/comm_monitor( A ) - for(var/obj/C in src) - C.loc = src.loc - A.circuit = M - A.state = 3 - A.icon_state = "3" - A.anchored = 1 - qdel(src) - else - to_chat(user, "You disconnect the monitor.") - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) - var/obj/item/circuitboard/comm_monitor/M = new /obj/item/circuitboard/comm_monitor( A ) - for(var/obj/C in src) - C.loc = src.loc - A.circuit = M - A.state = 4 - A.icon_state = "4" - A.anchored = 1 - qdel(src) - updateUsrDialog() - return - return ..() - - emag_act(user as mob) - if(!emagged) - playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1) - emagged = 1 - to_chat(user, "You you disable the security protocols") diff --git a/code/game/machinery/telecomms/traffic_control.dm b/code/game/machinery/telecomms/traffic_control.dm deleted file mode 100644 index 55997d49105..00000000000 --- a/code/game/machinery/telecomms/traffic_control.dm +++ /dev/null @@ -1,49 +0,0 @@ -/obj/machinery/computer/telecomms/traffic - name = "telecommunications traffic control" - - light_color = LIGHT_COLOR_DARKGREEN - - req_access = list(ACCESS_TCOMSAT) - circuit = /obj/item/circuitboard/comm_traffic - - // NTTC - var/window_id // mostly used to let the configuration datum update the user's UI - var/unlocked = FALSE - -/obj/machinery/computer/telecomms/traffic/multitool_act(mob/user, obj/item/I) - . = TRUE - if(!I.use_tool(src, user, 0, volume = I.tool_volume)) - return - unlocked = !unlocked - to_chat(user, "This computer is now [unlocked ? "Unlocked" : "Locked"]. Reopen the UI to see the difference.") - -/obj/machinery/computer/telecomms/traffic/attack_hand(mob/user) - interact(user) - -/obj/machinery/computer/telecomms/traffic/interact(mob/user) - if(stat & (BROKEN|NOPOWER)) - return 0 - - if(GLOB.nttc_config.valid_languages.len == 1) - GLOB.nttc_config.update_languages() // this is silly but it has to be done because NTTC inits before languages do - - var/datum/asset/assets = get_asset_datum(/datum/asset/simple/nttc) - assets.send(user) - - var/dat = file2text("html/nttc/dist/index.html") - if(unlocked) - dat += "\n" - var/datum/browser/nttc/nt_browser = new(user, name, "NTTC", 720, 480, src, GLOB.nttc_config.nttc_serialize()) - nt_browser.set_content(dat) - nt_browser.open() - window_id = nt_browser.window_id - -/obj/machinery/computer/telecomms/traffic/Topic(href, href_list) - if(..()) - return 1 - - var/mob/user = usr - if(!istype(user) || !user.client) - return 0 - - GLOB.nttc_config.Topic(user, href_list, window_id, src) diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 105f6730140..0b171208554 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -21,6 +21,7 @@ var/ks1type = null var/ks2type = null dog_fashion = null + requires_tcomms = TRUE /obj/item/radio/headset/New() ..() diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 732dc362f28..d57b23b9b0f 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -58,6 +58,8 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( var/datum/radio_frequency/radio_connection var/list/datum/radio_frequency/secure_radio_connections = new + var/requires_tcomms = FALSE // Does this device require tcomms to work.If TRUE it wont function at all without tcomms. If FALSE, it will work without tcomms, just slowly + /obj/item/radio/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) @@ -258,10 +260,24 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( if(jammed) message = Gibberish(message, 100) var/list/message_pieces = message_to_multilingual(message) - Broadcast_Message(connection, A, - 0, "*garbled automated announcement*", src, - message_pieces, from, "Automated Announcement", from, "synthesized voice", - 4, 0, zlevel, connection.frequency, follow_target = follow_target) + + // Make us a message datum! + var/datum/tcomms_message/tcm = new + tcm.connection = connection + tcm.sender = A + tcm.radio = src + tcm.sender_name = from + tcm.message_pieces = message_pieces + tcm.sender_job = "Automated Announcement" + tcm.vname = "synthesized voice" + tcm.data = SIGNALTYPE_AINOTRACK + tcm.source_level = zlevel + tcm.freq = connection.frequency + tcm.follow_target = follow_target + + // Now put that through the stuff + for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) + INVOKE_ASYNC(C, /obj/machinery/tcomms/core.proc/handle_message, tcm) qdel(A) // Just a dummy mob used for making announcements, so we don't create AIs to do this @@ -318,48 +334,31 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( if(!M.IsVocal()) return 0 - /* Quick introduction: - This new radio system uses a very robust FTL signaling technology unoriginally - dubbed "subspace" which is somewhat similar to 'blue-space' but can't - actually transmit large mass. Headsets are the only radio devices capable - of sending subspace transmissions to the Communications Satellite. - - A headset sends a signal to a subspace listener/receiver elsewhere in space, - the signal gets processed and logged, and an audible transmission gets sent - to each individual headset. - */ - - //#### Grab the connection datum ####// - var/message_mode = handle_message_mode(M, message_pieces, channel) - switch(message_mode) //special cases - if(RADIO_CONNECTION_FAIL) - return 0 - if(RADIO_CONNECTION_NON_SUBSPACE) - return 1 - - if(!istype(message_mode, /datum/radio_frequency)) //if not a special case, it should be returning a radio connection - return 0 - - var/datum/radio_frequency/connection = message_mode - var/turf/position = get_turf(src) - var/jammed = FALSE + var/turf/position = get_turf(src) for(var/obj/item/jammer/jammer in GLOB.active_jammers) if(get_dist(position, get_turf(jammer)) < jammer.range) jammed = TRUE break - //#### Tagging the signal with all appropriate identity values ####// + var/message_mode = handle_message_mode(M, message_pieces, channel) + switch(message_mode) //special cases + // This is if the connection fails + if(RADIO_CONNECTION_FAIL) + return 0 + // This is if were using either a binary key, or a hivemind through a headset somehow. Dont ask. + if(RADIO_CONNECTION_NON_SUBSPACE) + return 1 + + if(!istype(message_mode, /datum/radio_frequency)) //if not a special case, it should be returning a radio connection + return + + var/datum/radio_frequency/connection = message_mode + // ||-- The mob's name identity --|| var/displayname = M.name // grab the display name (name you get when you hover over someone's icon) - var/real_name = M.real_name // mob's real name - var/mobkey = "none" // player key associated with mob var/voicemask = 0 // the speaker is wearing a voice mask - if(M.client) - mobkey = M.key // assign the mob's key - - var/jobname // the mob's "job" if(jammed) @@ -397,7 +396,7 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( if(ishuman(M)) var/mob/living/carbon/human/H = M displayname = H.voice - if(H.voice != real_name) + if(H.voice != M.real_name) voicemask = TRUE if(syndiekey && syndiekey.change_voice && connection.frequency == SYND_FREQ) @@ -405,124 +404,34 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( jobname = "Unknown" voicemask = TRUE + // Make us a message datum! + var/datum/tcomms_message/tcm = new + tcm.sender_name = displayname + tcm.sender_job = jobname + tcm.message_pieces = message_pieces + tcm.source_level = position.z + tcm.freq = connection.frequency + tcm.vmask = voicemask + tcm.needs_tcomms = requires_tcomms + tcm.connection = connection + tcm.vname = M.voice_name + // Now put that through the stuff + var/handled = FALSE + if(connection) + for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) + if(C.handle_message(tcm)) + handled = TRUE + return TRUE - /* ###### Radio headsets can only broadcast through subspace ###### */ + // If we dont need tcomms and we have no connection + if(!requires_tcomms && !handled) + tcm.zlevels = list(position.z) + // Simulate two seconds of lag + addtimer(CALLBACK(GLOBAL_PROC, .proc/broadcast_message, tcm), 20) + return TRUE - if(subspace_transmission) - // First, we want to generate a new radio signal - var/datum/signal/signal = new - signal.transmission_method = 2 // 2 would be a subspace transmission. - // transmission_method could probably be enumerated through #define. Would be neater. - - // --- Finally, tag the actual signal with the appropriate values --- - signal.data = 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 - "key" = mobkey, // the mob's key - "vmessage" = pick(M.speak_emote), // the message to display if the voice wasn't understood - "vname" = M.voice_name, // the name to display if the voice wasn't understood - "vmask" = voicemask, // 1 if the mob is using a voice gas mask - - // We store things that would otherwise be kept in the actual mob - // so that they can be logged even AFTER the mob is deleted or something - - // Other tags: - "compression" = rand(45,50), // compressed radio signal - "message" = message_pieces, // the actual sent message - "connection" = connection, // the radio connection to use - "radio" = src, // stores the radio used for transmission - "slow" = 0, // how much to sleep() before broadcasting - simulates net lag - "traffic" = 0, // dictates the total traffic sum that the signal went through - "type" = 0, // determines what type of radio input it is: normal broadcast - "server" = null, // the last server to log this signal - "reject" = 0, // if nonzero, the signal will not be accepted by any broadcasting machinery - "level" = position.z, // The source's z level - "verb" = verb - ) - signal.frequency = connection.frequency // Quick frequency set - - //#### Sending the signal to all subspace receivers ####// - - for(var/obj/machinery/telecomms/receiver/R in GLOB.telecomms_list) - spawn(0) - R.receive_signal(signal) - - // Allinone can act as receivers. - for(var/obj/machinery/telecomms/allinone/R in GLOB.telecomms_list) - spawn(0) - R.receive_signal(signal) - - // Receiving code can be located in Telecommunications.dm - return signal.data["done"] && (position.z in signal.data["level"]) - - - /* ###### Intercoms and station-bounced radios ###### */ - - var/filter_type = 2 - - /* --- Intercoms can only broadcast to other intercoms, but bounced radios can broadcast to bounced radios and intercoms --- */ - if(istype(src, /obj/item/radio/intercom)) - filter_type = 1 - - - var/datum/signal/signal = new - signal.transmission_method = 2 - - - /* --- Try to send a normal subspace broadcast first */ - - signal.data = 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 - "key" = mobkey, // the mob's key - "vmessage" = pick(M.speak_emote), // the message to display if the voice wasn't understood - "vname" = M.voice_name, // the name to display if the voice wasn't understood - "vmask" = voicemask, // 1 if the mob is using a voice gas mas - - "compression" = 0, // uncompressed radio signal - "message" = message_pieces, // the actual sent message - "connection" = connection, // the radio connection to use - "radio" = src, // stores the radio used for transmission - "slow" = 0, - "traffic" = 0, - "type" = 0, - "server" = null, - "reject" = 0, - "level" = position.z, - "verb" = verb - ) - signal.frequency = connection.frequency // Quick frequency set - - for(var/obj/machinery/telecomms/receiver/R in GLOB.telecomms_list) - spawn(0) - R.receive_signal(signal) - - - sleep(rand(10,25)) // wait a little... - - if(signal.data["done"] && (position.z in signal.data["level"])) - // we're done here. - return 1 - - // Oh my god; the comms are down or something because the signal hasn't been broadcasted yet in our level. - // Send a mundane broadcast with limited targets: - - //THIS IS TEMPORARY. YEAH RIGHT - if(!connection) return 0 //~Carn - - return Broadcast_Message(connection, M, voicemask, pick(M.speak_emote), - src, message_pieces, displayname, jobname, real_name, M.voice_name, - filter_type, signal.data["compression"], list(position.z), connection.frequency,verb) + // If we didnt get here, oh fuck + return FALSE /obj/item/radio/hear_talk(mob/M as mob, list/message_pieces, var/verb = "says") diff --git a/code/game/objects/items/weapons/stock_parts.dm b/code/game/objects/items/weapons/stock_parts.dm index 1cc2b25edf0..0d5591bbc16 100644 --- a/code/game/objects/items/weapons/stock_parts.dm +++ b/code/game/objects/items/weapons/stock_parts.dm @@ -235,57 +235,6 @@ rating = 4 materials = list(MAT_METAL=80) -// Subspace stock parts - -/obj/item/stock_parts/subspace/ansible - name = "subspace ansible" - icon_state = "subspace_ansible" - desc = "A compact module capable of sensing extradimensional activity." - origin_tech = "programming=2;magnets=2;materials=2;bluespace=1" - materials = list(MAT_METAL=30, MAT_GLASS=10) - -/obj/item/stock_parts/subspace/filter - name = "hyperwave filter" - icon_state = "hyperwave_filter" - desc = "A tiny device capable of filtering and converting super-intense radiowaves." - origin_tech = "programming=2;magnets=2" - materials = list(MAT_METAL=30, MAT_GLASS=10) - -/obj/item/stock_parts/subspace/amplifier - name = "subspace amplifier" - icon_state = "subspace_amplifier" - desc = "A compact micro-machine capable of amplifying weak subspace transmissions." - origin_tech = "programming=2;magnets=2;materials=2;bluespace=2" - materials = list(MAT_METAL=30, MAT_GLASS=10) - -/obj/item/stock_parts/subspace/treatment - name = "subspace treatment disk" - icon_state = "treatment_disk" - desc = "A compact micro-machine capable of stretching out hyper-compressed radio waves." - origin_tech = "programming=2;magnets=2;materials=2;bluespace=2" - materials = list(MAT_METAL=30, MAT_GLASS=10) - -/obj/item/stock_parts/subspace/analyzer - name = "subspace wavelength analyzer" - icon_state = "wavelength_analyzer" - desc = "A sophisticated analyzer capable of analyzing cryptic subspace wavelengths." - origin_tech = "programming=2;magnets=2;materials=2;bluespace=2" - materials = list(MAT_METAL=30, MAT_GLASS=10) - -/obj/item/stock_parts/subspace/crystal - name = "ansible crystal" - icon_state = "ansible_crystal" - desc = "A crystal made from pure glass used to transmit laser databursts to subspace." - origin_tech = "magnets=2;materials=2;bluespace=2;plasmatech=2" - materials = list(MAT_GLASS=50) - -/obj/item/stock_parts/subspace/transmitter - name = "subspace transmitter" - icon_state = "subspace_transmitter" - desc = "A large piece of equipment used to open a window into the subspace dimension." - origin_tech = "magnets=2;materials=2;bluespace=2" - materials = list(MAT_METAL=50) - /obj/item/research//Makes testing much less of a pain -Sieve name = "research" icon = 'icons/obj/stock_parts.dmi' diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 3fa86cee3a4..951eb79f853 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -251,9 +251,7 @@ a { if(P) if(P.buffer) var/id = null - if(istype(P.buffer, /obj/machinery/telecomms)) - id=P.buffer:id - else if("id_tag" in P.buffer.vars) + if("id_tag" in P.buffer.vars) id=P.buffer:id_tag dat += "

    MULTITOOL BUFFER: [P.buffer] [id ? "([id])" : ""]" diff --git a/code/game/objects/structures/decor/machinery/telecomms.dm b/code/game/objects/structures/decor/machinery/telecomms.dm deleted file mode 100644 index 1068cfb0b4e..00000000000 --- a/code/game/objects/structures/decor/machinery/telecomms.dm +++ /dev/null @@ -1,23 +0,0 @@ -/obj/structure/decor/machinery/telecomms/processor - name = "Processor Unit" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "processor" - desc = "This machine is used to process large quantities of information." - -/obj/structure/decor/machinery/telecomms/hub - name = "Telecommunication Hub" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "hub" - desc = "A mighty piece of hardware used to send/receive massive amounts of data." - -/obj/structure/decor/machinery/telecomms/server - name = "Telecommunication Server" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "comm_server" - desc = "A machine used to store data and network statistics." - -/obj/structure/decor/machinery/telecomms/relay - name = "Telecommunication Relay" - icon = 'icons/obj/stationobjs.dmi' - icon_state = "relay" - desc = "A mighty piece of hardware used to send massive amounts of data far away." diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1864a677727..13a258e4212 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -954,7 +954,9 @@ Traitors and the like can also be revived with the previous role mostly intact. if(confirm != "Yes") return - GLOB.nttc_config.reset() + for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) + C.nttc.reset() + log_admin("[key_name(usr)] reset NTTC scripts.") message_admins("[key_name_admin(usr)] reset NTTC scripts.") feedback_add_details("admin_verb","RAT2") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/crafting/recipes.dm b/code/modules/crafting/recipes.dm index 15a8ae02490..35d2671cc13 100644 --- a/code/modules/crafting/recipes.dm +++ b/code/modules/crafting/recipes.dm @@ -199,8 +199,7 @@ name = "Ion Scatter Shell" result = /obj/item/ammo_casing/shotgun/ion reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1, - /obj/item/stock_parts/micro_laser/ultra = 1, - /obj/item/stock_parts/subspace/crystal = 1) + /obj/item/stock_parts/micro_laser/ultra = 1) tools = list(TOOL_SCREWDRIVER) time = 5 category = CAT_WEAPONRY diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index ec3b5a28f64..6ce60982898 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -14,8 +14,10 @@ if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. GLOB.event_announcement.Announce(alert) +#warn AA, make ion anomalies disable the hubs only +/* /datum/event/communications_blackout/start() - for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) + for(var/obj/machinery/tcomms/T in GLOB.telecomms_list) T.emp_act(1) /proc/communications_blackout(var/silent = 1) @@ -28,3 +30,4 @@ to_chat(A, "
    ") for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) T.emp_act(1) +*/ diff --git a/code/modules/mining/abandonedcrates.dm b/code/modules/mining/abandonedcrates.dm index 454b31b3b74..9b74c922a6b 100644 --- a/code/modules/mining/abandonedcrates.dm +++ b/code/modules/mining/abandonedcrates.dm @@ -82,7 +82,7 @@ new /obj/item/clothing/head/corgi(src) if(67 to 68) for(var/i in 1 to rand(4, 7)) - var /newitem = pick(subtypesof(/obj/item/stock_parts) - /obj/item/stock_parts/subspace) + var /newitem = pick(subtypesof(/obj/item/stock_parts)) new newitem(src) if(69 to 70) new /obj/item/stack/ore/bluespace_crystal(src, 5) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 251a67a6c4b..41786017ea2 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -79,7 +79,7 @@ var/obj/desired_perches = list(/obj/structure/computerframe, /obj/structure/displaycase, \ /obj/structure/filingcabinet, /obj/machinery/teleport, \ /obj/machinery/suit_storage_unit, /obj/machinery/clonepod, \ - /obj/machinery/dna_scannernew, /obj/machinery/telecomms, \ + /obj/machinery/dna_scannernew, /obj/machinery/tcomms, \ /obj/machinery/nuclearbomb, /obj/machinery/particle_accelerator, \ /obj/machinery/recharge_station, /obj/machinery/smartfridge, \ /obj/machinery/computer) diff --git a/code/modules/modular_computers/NTNet/NTNet_relay.dm b/code/modules/modular_computers/NTNet/NTNet_relay.dm index c0cc534ea0b..f50567e6710 100644 --- a/code/modules/modular_computers/NTNet/NTNet_relay.dm +++ b/code/modules/modular_computers/NTNet/NTNet_relay.dm @@ -99,7 +99,6 @@ component_parts = list() component_parts += new /obj/item/circuitboard/machine/ntnet_relay(null) component_parts += new /obj/item/stack/cable_coil(null, 2) - component_parts += new /obj/item/stock_parts/subspace/filter(null) if(GLOB.ntnet_global) GLOB.ntnet_global.relays.Add(src) @@ -123,6 +122,4 @@ name = "NTNet Relay (Machine Board)" build_path = /obj/machinery/ntnet_relay origin_tech = "programming=3;bluespace=3;magnets=2" - req_components = list( - /obj/item/stack/cable_coil = 2, - /obj/item/stock_parts/subspace/filter = 1) + req_components = list(/obj/item/stack/cable_coil = 2) diff --git a/code/modules/pda/messenger.dm b/code/modules/pda/messenger.dm index 066db440cc8..5ccef4dee41 100644 --- a/code/modules/pda/messenger.dm +++ b/code/modules/pda/messenger.dm @@ -151,24 +151,33 @@ useMS = MS break - var/datum/signal/signal = pda.telecomms_process() + var/turf/sender_pos = get_turf(U) + var/turf/recipient_pos = get_turf(P) - var/useTC = 0 - if(signal) - if(signal.data["done"]) - useTC = 1 - var/turf/pos = get_turf(P) - // TODO: Make the radio system cooperate with the space manager - if(pos.z in signal.data["level"]) - useTC = 2 - //Let's make this barely readable - if(signal.data["compression"] > 0) - t = Gibberish(t, signal.data["compression"] + 50) + // Can the message be sent + var/sendable = FALSE + // Can the message be received? + var/receivable = FALSE + + for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) + if(C.zlevel_reachable(sender_pos.z)) + sendable = TRUE + if(C.zlevel_reachable(recipient_pos.z)) + receivable = TRUE + // Once both are done, exit the loop + if(sendable && receivable) + break + + if(!sendable) // Are we in the range of a reciever? + to_chat(U, "ERROR: No connection to server.") + return + + if(!receivable) // Is our recipient in the range of a reciever? + to_chat(U, "ERROR: No connection to recipient.") + return + + if(useMS && sendable && receivable) // only send the message if its going to work - if(useMS && useTC) // only send the message if it's stable - if(useTC != 2) // Does our recipient have a broadcaster on their level? - 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]"))) diff --git a/code/modules/research/designs/comp_board_designs.dm b/code/modules/research/designs/comp_board_designs.dm index 821ef606518..f0699861e09 100644 --- a/code/modules/research/designs/comp_board_designs.dm +++ b/code/modules/research/designs/comp_board_designs.dm @@ -302,26 +302,6 @@ build_path = /obj/item/circuitboard/supplycomp category = list("Computer Boards") -/datum/design/comm_monitor - name = "Console Board (Telecommunications Monitoring Console)" - desc = "Allows for the construction of circuit boards used to build a telecommunications monitor." - id = "comm_monitor" - req_tech = list("programming" = 3, "magnets" = 3, "bluespace" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/comm_monitor - category = list("Computer Boards") - -/datum/design/comm_server - name = "Console Board (Telecommunications Server Monitoring Console)" - desc = "Allows for the construction of circuit boards used to build a telecommunication server browser and monitor." - id = "comm_server" - req_tech = list("programming" = 3, "magnets" = 3, "bluespace" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/comm_server - category = list("Computer Boards") - /datum/design/comm_traffic name = "Console Board (Telecommunications Traffic Control Console)" desc = "Allows for the construction of circuit boards used to build a telecommunications traffic control console." diff --git a/code/modules/research/designs/telecomms_designs.dm b/code/modules/research/designs/telecomms_designs.dm index 848349dab83..1840998be9d 100644 --- a/code/modules/research/designs/telecomms_designs.dm +++ b/code/modules/research/designs/telecomms_designs.dm @@ -1,143 +1,3 @@ //////////////////////////////////////// //////////Telecomms Equipment/////////// //////////////////////////////////////// -/datum/design/telecomms_bus - name = "Machine Board (Bus Mainframe)" - desc = "Allows for the construction of Telecommunications Bus Mainframes." - id = "s-bus" - req_tech = list("programming" = 2, "engineering" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/bus - category = list("Subspace Telecomms") - -/datum/design/telecomms_hub - name = "Machine Board (Hub Mainframe)" - desc = "Allows for the construction of Telecommunications Hub Mainframes." - id = "s-hub" - req_tech = list("programming" = 2, "engineering" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/hub - category = list("Subspace Telecomms") - - -/datum/design/telecomms_processor - name = "Machine Board (Processor Unit)" - desc = "Allows for the construction of Telecommunications Processor equipment." - id = "s-processor" - req_tech = list("programming" = 2, "engineering" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/processor - category = list("Subspace Telecomms") - -/datum/design/telecomms_relay - name = "Machine Board (Relay Mainframe)" - desc = "Allows for the construction of Telecommunications Relay Mainframes." - id = "s-relay" - req_tech = list("programming" = 2, "engineering" = 2, "bluespace" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/relay - category = list("Subspace Telecomms") - -/datum/design/telecomms_server - name = "Machine Board (Server Mainframe)" - desc = "Allows for the construction of Telecommunications Servers." - id = "s-server" - req_tech = list("programming" = 2, "engineering" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/server - category = list("Subspace Telecomms") - -/datum/design/subspace_broadcaster - name = "Machine Board (Subspace Broadcaster)" - desc = "Allows for the construction of Subspace Broadcasting equipment." - id = "s-broadcaster" - req_tech = list("programming" = 2, "engineering" = 2) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/broadcaster - category = list("Subspace Telecomms") - -/datum/design/subspace_receiver - name = "Machine Board (Subspace Receiver)" - desc = "Allows for the construction of Subspace Receiver equipment." - id = "s-receiver" - req_tech = list("programming" = 2, "engineering" = 2, "bluespace" = 1) - build_type = IMPRINTER - materials = list(MAT_GLASS = 1000) - build_path = /obj/item/circuitboard/telecomms/receiver - category = list("Subspace Telecomms") - -/datum/design/subspace_crystal - name = "Ansible Crystal" - desc = "A sophisticated analyzer capable of analyzing cryptic subspace wavelengths." - id = "s-crystal" - req_tech = list("magnets" = 2, "materials" = 2, "bluespace" = 3, "plasmatech" = 3) - build_type = PROTOLATHE - materials = list(MAT_GLASS = 800, MAT_SILVER = 100, MAT_GOLD = 100) - build_path = /obj/item/stock_parts/subspace/crystal - category = list("Stock Parts") - -/datum/design/hyperwave_filter - name = "Hyperwave Filter" - desc = "A tiny device capable of filtering and converting super-intense radiowaves." - id = "s-filter" - req_tech = list("programming" = 3, "magnets" = 3) - build_type = PROTOLATHE - materials = list(MAT_METAL = 100, MAT_SILVER = 100) - build_path = /obj/item/stock_parts/subspace/filter - category = list("Stock Parts") - -/datum/design/subspace_amplifier - name = "Subspace Amplifier" - desc = "A compact micro-machine capable of amplifying weak subspace transmissions." - id = "s-amplifier" - req_tech = list("programming" = 3, "magnets" = 4, "materials" = 3, "bluespace" = 2) - build_type = PROTOLATHE - materials = list(MAT_METAL = 100, MAT_GOLD = 100, MAT_URANIUM = 100) - build_path = /obj/item/stock_parts/subspace/amplifier - category = list("Stock Parts") - -/datum/design/subspace_analyzer - name = "Subspace Analyzer" - desc = "A sophisticated analyzer capable of analyzing cryptic subspace wavelengths." - id = "s-analyzer" - req_tech = list("programming" = 3, "magnets" = 4, "materials" = 2, "bluespace" = 3) - build_type = PROTOLATHE - materials = list(MAT_METAL = 100, MAT_GOLD = 100) - build_path = /obj/item/stock_parts/subspace/analyzer - category = list("Stock Parts") - -/datum/design/subspace_ansible - name = "Subspace Ansible" - desc = "A compact module capable of sensing extradimensional activity." - id = "s-ansible" - req_tech = list("programming" = 2, "magnets" = 2, "materials" = 2) - build_type = PROTOLATHE - materials = list(MAT_METAL = 100, MAT_SILVER = 100) - build_path = /obj/item/stock_parts/subspace/ansible - category = list("Stock Parts") - -/datum/design/subspace_transmitter - name = "Subspace Transmitter" - desc = "A large piece of equipment used to open a window into the subspace dimension." - id = "s-transmitter" - req_tech = list("magnets" = 3, "materials" = 4, "bluespace" = 4) - build_type = PROTOLATHE - materials = list(MAT_GLASS = 100, MAT_SILVER = 100, MAT_URANIUM = 100) - build_path = /obj/item/stock_parts/subspace/transmitter - category = list("Stock Parts") - -/datum/design/subspace_treatment - name = "Subspace Treatment Disk" - desc = "A compact micro-machine capable of stretching out hyper-compressed radio waves." - id = "s-treatment" - req_tech = list("programming" = 2, "magnets" = 3, "materials" = 2, "bluespace" = 3) - build_type = PROTOLATHE - materials = list(MAT_METAL = 100, MAT_SILVER = 200) - build_path = /obj/item/stock_parts/subspace/treatment - category = list("Stock Parts") diff --git a/icons/obj/tcomms.dmi b/icons/obj/tcomms.dmi new file mode 100644 index 00000000000..ab21b0e500f Binary files /dev/null and b/icons/obj/tcomms.dmi differ diff --git a/paradise.dme b/paradise.dme index 7324ffaf044..95486d6fd4f 100644 --- a/paradise.dme +++ b/paradise.dme @@ -746,14 +746,10 @@ #include "code\game\machinery\embedded_controller\embedded_program_base.dm" #include "code\game\machinery\pipe\construction.dm" #include "code\game\machinery\pipe\pipe_dispenser.dm" -#include "code\game\machinery\telecomms\broadcaster.dm" -#include "code\game\machinery\telecomms\logbrowser.dm" -#include "code\game\machinery\telecomms\machine_interactions.dm" +#include "code\game\machinery\tcomms\_base.dm" +#include "code\game\machinery\tcomms\core.dm" +#include "code\game\machinery\tcomms\relay.dm" #include "code\game\machinery\telecomms\ntsl2.dm" -#include "code\game\machinery\telecomms\presets.dm" -#include "code\game\machinery\telecomms\telecomunications.dm" -#include "code\game\machinery\telecomms\telemonitor.dm" -#include "code\game\machinery\telecomms\traffic_control.dm" #include "code\game\magic\Uristrunes.dm" #include "code\game\mecha\mech_bay.dm" #include "code\game\mecha\mech_fabricator.dm" @@ -1127,7 +1123,6 @@ #include "code\game\objects\structures\crates_lockers\closets\secure\secure_closets.dm" #include "code\game\objects\structures\crates_lockers\closets\secure\security.dm" #include "code\game\objects\structures\decor\decor.dm" -#include "code\game\objects\structures\decor\machinery\telecomms.dm" #include "code\game\objects\structures\lavaland\necropolis_tendril.dm" #include "code\game\objects\structures\stool_bed_chair_nest\alien_nests.dm" #include "code\game\objects\structures\stool_bed_chair_nest\bed.dm"