Refactor telecomms and consoles to operate on logical zlevels

This commit is contained in:
Atermonera
2020-04-28 17:56:35 -04:00
committed by VirgoBot
parent c66c3cec86
commit eb6eb7bcd6
13 changed files with 736 additions and 1 deletions
@@ -87,7 +87,10 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
signal.data["realname"], signal.data["vname"], DATA_NORMAL,
signal.data["compression"], signal.data["level"], signal.frequency,
signal.data["verb"], forced_radios)
<<<<<<< HEAD
=======
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
/** #### - Simple Broadcast - #### **/
@@ -345,7 +348,10 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
var/list/message_pieces, var/name, var/job, var/realname, var/vname,
var/data, var/compression, var/list/level, var/freq, var/verbage = "says",
var/list/forced_radios)
<<<<<<< HEAD
=======
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
/* ###### Prepare the radio connection ###### */
@@ -355,7 +361,11 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
for(var/obj/item/device/radio/R in forced_radios)
//Cursory check to ensure they are 'on' and stuff
<<<<<<< HEAD
if(R.receive_range(display_freq, list(0)) > -1)
=======
if(R.receive_range(display_freq, list(0)))
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
radios |= R
// --- Broadcast only to intercom devices ---
@@ -229,11 +229,19 @@
if(href_list["range_down"])
if(overmap_range > overmap_range_min)
overmap_range--
<<<<<<< HEAD
update_idle_power_usage(initial(idle_power_usage)**(overmap_range+1))
if(href_list["range_up"])
if(overmap_range < overmap_range_max)
overmap_range++
update_idle_power_usage(initial(idle_power_usage)**(overmap_range+1))
=======
idle_power_usage = initial(idle_power_usage)**(overmap_range+1)
if(href_list["range_up"])
if(overmap_range < overmap_range_max)
overmap_range++
idle_power_usage = initial(idle_power_usage)**(overmap_range+1)
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
// RECEIVER
/obj/machinery/telecomms/receiver/Options_Menu()
@@ -245,11 +253,19 @@
if(href_list["range_down"])
if(overmap_range > overmap_range_min)
overmap_range--
<<<<<<< HEAD
update_idle_power_usage(initial(idle_power_usage)**(overmap_range+1))
if(href_list["range_up"])
if(overmap_range < overmap_range_max)
overmap_range++
update_idle_power_usage(initial(idle_power_usage)**(overmap_range+1))
=======
idle_power_usage = initial(idle_power_usage)**(overmap_range+1)
if(href_list["range_up"])
if(overmap_range < overmap_range_max)
overmap_range++
idle_power_usage = initial(idle_power_usage)**(overmap_range+1)
>>>>>>> e92ed43... Merge pull request #6990 from VOREStation/pol-tcomupdate
/obj/machinery/telecomms/Topic(href, href_list)
+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