Refactor telecomms and consoles to operate on logical zlevels

This commit is contained in:
Atermonera
2020-04-28 14:55:04 -07:00
committed by VirgoBot
parent c66c3cec86
commit eb6eb7bcd6
13 changed files with 736 additions and 1 deletions
+41 -1
View File
@@ -287,7 +287,11 @@ var/global/list/default_medbay_channels = list(
/obj/item/device/radio/proc/autosay(var/message, var/from, var/channel, var/list/zlevels) //BS12 EDIT
var/datum/radio_frequency/connection = null
if(channel && channels && channels.len > 0)
<<<<<<< HEAD
if (channel == "department")
=======
if(channel == "department")
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
channel = channels[1]
connection = secure_radio_connections[channel]
else
@@ -304,7 +308,11 @@ var/global/list/default_medbay_channels = list(
Broadcast_Message(connection, A,
0, "*garbled automated announcement*", src,
message_to_multilingual(message), from, "Automated Announcement", from, "synthesized voice",
<<<<<<< HEAD
4, 0, zlevels, connection.frequency, "states")
=======
DATA_FAKE, 0, zlevels, connection.frequency, "states")
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
// Interprets the message mode when talking into a radio, possibly returning a connection datum
/obj/item/device/radio/proc/handle_message_mode(mob/living/M as mob, list/message_pieces, message_mode)
@@ -363,8 +371,12 @@ var/global/list/default_medbay_channels = list(
if(!istype(message_mode, /datum/radio_frequency))
return FALSE
var/datum/radio_frequency/connection = message_mode
var/pos_z = get_z(src)
var/datum/radio_frequency/connection = message_mode
<<<<<<< HEAD
var/pos_z = get_z(src)
=======
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
//#### Tagging the signal with all appropriate identity values ####//
@@ -425,7 +437,11 @@ var/global/list/default_medbay_channels = list(
"name" = displayname, // the mob's display name
"job" = jobname, // the mob's job
"key" = mobkey, // the mob's key
<<<<<<< HEAD
"vmessage" = message_to_multilingual(pick(M.speak_emote)), // the message to display if the voice wasn't understood
=======
"vmessage" = pick(M.speak_emote), // the message to display if the voice wasn't understood
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
"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
@@ -477,9 +493,13 @@ var/global/list/default_medbay_channels = list(
// First, we want to generate a new radio signal
signal.transmission_method = TRANSMISSION_SUBSPACE
<<<<<<< HEAD
//#### Sending the signal to all subspace receivers ####//
=======
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
//#### Sending the signal to all subspace receivers ####//
for(var/obj/machinery/telecomms/receiver/R in telecomms_list)
R.receive_signal(signal)
@@ -494,6 +514,7 @@ var/global/list/default_medbay_channels = list(
else if(adhoc_fallback) //Less huzzah, we have to fallback
to_chat(loc, "<span class='warning'>\The [src] pings as it falls back to local radio transmission.</span>")
subspace_transmission = FALSE
<<<<<<< HEAD
else //Oh well
return FALSE
@@ -508,6 +529,22 @@ var/global/list/default_medbay_channels = list(
signal.transmission_method = TRANSMISSION_SUBSPACE
signal.data["compression"] = 0
=======
else //Oh well
return FALSE
/* ###### Intercoms and station-bounced radios ###### */
else
/* --- Intercoms can only broadcast to other intercoms, but bounced radios can broadcast to bounced radios and intercoms --- */
if(istype(src, /obj/item/device/radio/intercom))
filter_type = DATA_INTERCOM
/* --- Try to send a normal subspace broadcast first */
signal.transmission_method = TRANSMISSION_SUBSPACE
signal.data["compression"] = 0
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
for(var/obj/machinery/telecomms/receiver/R in telecomms_list)
R.receive_signal(signal)
@@ -536,8 +573,11 @@ var/global/list/default_medbay_channels = list(
if(get_dist(src, M) <= canhear_range)
talk_into(M, message_pieces, null, verb)
<<<<<<< HEAD
=======
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
/obj/item/device/radio/proc/receive_range(freq, level)
// check if this radio can receive on the given frequency, and if so,
// what the range is in which mobs will hear the radio
@@ -132,6 +132,7 @@
return -1
if(!listening)
return -1
<<<<<<< HEAD
if(!on)
return -1
if(!freq)
@@ -142,3 +143,24 @@
return canhear_range
else
return -1
=======
if(is_jammed(src))
return -1
if (!on)
return -1
if (!freq) //recieved on main frequency
if (!listening)
return -1
else
var/accept = (freq==frequency && listening)
if (!accept)
for (var/ch_name in channels)
var/datum/radio_frequency/RF = secure_radio_connections[ch_name]
if (RF && RF.frequency==freq && (channels[ch_name]&FREQ_LISTENING))
accept = 1
break
if (!accept)
return -1
return canhear_range
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate