mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 22:47:59 +01:00
All radios now only work in their Z level. This means that the CommSat has a few more additions to work with this change. There is now a new Telecomms Machine called the Relay which allows information to travel across Z levels. It it then linked to a new machine called the Hub, which will receive information from the Relays and send it to the buses. Because every Z level needs these relays, which are linked up with Receivers/Broadcasters, every Z level will get one. There is one in the station, in the RD's office, one in Telecomms as always, one in the Ruskie station which is turned off and hidden from the HUB's linked list. The last one is in Mining but the location for it has not been decided yet.</li>
PDAs now need to be in a Z level with a functioning Relay/Comms Network in order to send messages. It will also send uncompressed (scrambled) messages like you would with the ordinary voice messages. I've gotten rid of the "in world" check for blackboxes, when there can only be one. You can now easily send test signals to see if Telecomms is functioning for an atom. test_telecomms() git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4222 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -24,72 +24,77 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
delay = 7
|
||||
circuitboard = "/obj/item/weapon/circuitboard/telecomms/broadcaster"
|
||||
|
||||
receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
/obj/machinery/telecomms/broadcaster/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
// Don't broadcast rejected signals
|
||||
if(signal.data["reject"])
|
||||
return
|
||||
|
||||
// Don't broadcast rejected signals
|
||||
if(signal.data["reject"])
|
||||
//Is it a test signal?
|
||||
if(signal.data["type"] == 4)
|
||||
signal.data["done"] = 1
|
||||
signal.data["level"] += src.loc.z
|
||||
return
|
||||
|
||||
if(signal.data["message"])
|
||||
|
||||
// Prevents massive radio spam
|
||||
if("[signal.data["message"]]:[signal.data["realname"]]:[src.loc.z]" in recentmessages)
|
||||
return
|
||||
recentmessages.Add("[signal.data["message"]]:[signal.data["realname"]]:[src.loc.z]")
|
||||
|
||||
if(signal.data["message"])
|
||||
signal.data["done"] = 1 // mark the signal as being broadcasted
|
||||
|
||||
// Prevents massive radio spam
|
||||
if("[signal.data["message"]]:[signal.data["realname"]]" in recentmessages)
|
||||
return
|
||||
recentmessages.Add( "[signal.data["message"]]:[signal.data["realname"]]" )
|
||||
// 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
|
||||
|
||||
/** #### - 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"], src.loc.z)
|
||||
|
||||
|
||||
signal.data["done"] = 1 // mark the signal as being broadcasted
|
||||
/** #### - Simple Broadcast - #### **/
|
||||
|
||||
// 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["type"] == 1)
|
||||
|
||||
if(signal.data["slow"] > 0)
|
||||
sleep(signal.data["slow"]) // simulate the network lag if necessary
|
||||
/* ###### Broadcast a message using signal.data ###### */
|
||||
Broadcast_SimpleMessage(signal.data["name"], signal.frequency,
|
||||
signal.data["message"],null, null,
|
||||
signal.data["compression"])
|
||||
|
||||
|
||||
/** #### - Normal Broadcast - #### **/
|
||||
/** #### - Artificial Broadcast - #### **/
|
||||
// (Imitates a mob)
|
||||
|
||||
if(signal.data["type"] == 0)
|
||||
if(signal.data["type"] == 2)
|
||||
|
||||
/* ###### 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"])
|
||||
/* ###### 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"], src.loc.z)
|
||||
|
||||
spawn(5)
|
||||
recentmessages = list()
|
||||
|
||||
/* --- Do a snazzy animation! --- */
|
||||
flick("broadcaster_send", src)
|
||||
|
||||
|
||||
/** #### - 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"])
|
||||
|
||||
|
||||
/** #### - 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"])
|
||||
|
||||
spawn(1)
|
||||
recentmessages = list()
|
||||
|
||||
/* --- Do a snazzy animation! --- */
|
||||
flick("broadcaster_send", src)
|
||||
|
||||
/*
|
||||
Basically just an empty shell for receiving and broadcasting radio messages. Not
|
||||
@@ -109,41 +114,41 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
heatgen = 0
|
||||
var/intercept = 0 // if nonzero, broadcasts all messages to syndicate channel
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
/obj/machinery/telecomms/allinone/receive_signal(datum/signal/signal)
|
||||
|
||||
if(!on) // has to be on to receive messages
|
||||
return
|
||||
if(!on) // has to be on to receive messages
|
||||
return
|
||||
|
||||
if(is_freq_listening(signal)) // detect subspace signals
|
||||
if(is_freq_listening(signal)) // detect subspace signals
|
||||
|
||||
signal.data["done"] = 1 // mark the signal as being broadcasted
|
||||
signal.data["compression"] = 0
|
||||
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
|
||||
// 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
|
||||
if(signal.data["slow"] > 0)
|
||||
sleep(signal.data["slow"]) // simulate the network lag if necessary
|
||||
|
||||
/* ###### Broadcast a message using signal.data ###### */
|
||||
/* ###### Broadcast a message using signal.data ###### */
|
||||
|
||||
var/datum/radio_frequency/connection = signal.data["connection"]
|
||||
var/datum/radio_frequency/connection = signal.data["connection"]
|
||||
|
||||
if(connection.frequency == SYND_FREQ) // if syndicate broadcast, just
|
||||
if(connection.frequency == SYND_FREQ) // if syndicate 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"], src.loc.z)
|
||||
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"],, signal.data["compression"])
|
||||
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"])
|
||||
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"], src.loc.z)
|
||||
|
||||
|
||||
|
||||
@@ -196,12 +201,15 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
If 0, the signal is audible
|
||||
If nonzero, the signal may be partially inaudible or just complete gibberish.
|
||||
|
||||
@param level:
|
||||
The Z level that the sending radio is on.
|
||||
|
||||
**/
|
||||
|
||||
/proc/Broadcast_Message(var/datum/radio_frequency/connection, var/mob/M,
|
||||
var/vmask, var/vmessage, var/obj/item/device/radio/radio,
|
||||
var/message, var/name, var/job, var/realname, var/vname,
|
||||
var/data, var/compression)
|
||||
var/data, var/compression, var/level)
|
||||
|
||||
|
||||
/* ###### Prepare the radio connection ###### */
|
||||
@@ -215,8 +223,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
|
||||
if(data == 1)
|
||||
for (var/obj/item/device/radio/intercom/R in connection.devices["[RADIO_CHAT]"])
|
||||
if(R.receive_range(display_freq) > 0)
|
||||
radios += R
|
||||
if(R.receive_range(display_freq, level) > 0)
|
||||
radios |= R
|
||||
|
||||
|
||||
// --- Broadcast only to intercoms and station-bounced radios ---
|
||||
@@ -227,8 +235,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
if(istype(R, /obj/item/device/radio/headset))
|
||||
continue
|
||||
|
||||
if(R.receive_range(display_freq) > 0)
|
||||
radios += R
|
||||
if(R.receive_range(display_freq, level) > 0)
|
||||
radios |= R
|
||||
|
||||
|
||||
// --- Broadcast to syndicate radio! ---
|
||||
@@ -238,16 +246,15 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
|
||||
for (var/obj/item/device/radio/R in syndicateconnection.devices["[RADIO_CHAT]"])
|
||||
|
||||
if(R.receive_range(SYND_FREQ) > 0)
|
||||
radios += R
|
||||
if(R.receive_range(SYND_FREQ, level) > 0)
|
||||
radios |= R
|
||||
|
||||
// --- Broadcast to ALL radio devices ---
|
||||
|
||||
else
|
||||
for (var/obj/item/device/radio/R in connection.devices["[RADIO_CHAT]"])
|
||||
if(R.receive_range(display_freq) > 0)
|
||||
radios += R
|
||||
|
||||
if(R.receive_range(display_freq, level) > 0)
|
||||
radios |= R
|
||||
|
||||
// Get a list of mobs who can hear from the radios we collected.
|
||||
var/list/receive = get_mobs_in_radio_ranges(radios)
|
||||
@@ -363,31 +370,32 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // 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]"
|
||||
for (var/obj/machinery/blackbox_recorder/BR in world)
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
if(istype(blackbox))
|
||||
switch(display_freq)
|
||||
if(1459)
|
||||
BR.msg_common += blackbox_msg
|
||||
blackbox.msg_common += blackbox_msg
|
||||
if(1351)
|
||||
BR.msg_science += blackbox_msg
|
||||
blackbox.msg_science += blackbox_msg
|
||||
if(1353)
|
||||
BR.msg_command += blackbox_msg
|
||||
blackbox.msg_command += blackbox_msg
|
||||
if(1355)
|
||||
BR.msg_medical += blackbox_msg
|
||||
blackbox.msg_medical += blackbox_msg
|
||||
if(1357)
|
||||
BR.msg_engineering += blackbox_msg
|
||||
blackbox.msg_engineering += blackbox_msg
|
||||
if(1359)
|
||||
BR.msg_security += blackbox_msg
|
||||
blackbox.msg_security += blackbox_msg
|
||||
if(1441)
|
||||
BR.msg_deathsquad += blackbox_msg
|
||||
blackbox.msg_deathsquad += blackbox_msg
|
||||
if(1213)
|
||||
BR.msg_syndicate += blackbox_msg
|
||||
blackbox.msg_syndicate += blackbox_msg
|
||||
if(1349)
|
||||
BR.msg_mining += blackbox_msg
|
||||
blackbox.msg_mining += blackbox_msg
|
||||
if(1347)
|
||||
BR.msg_cargo += blackbox_msg
|
||||
blackbox.msg_cargo += blackbox_msg
|
||||
else
|
||||
BR.messages += blackbox_msg
|
||||
blackbox.messages += blackbox_msg
|
||||
|
||||
//End of research and feedback code.
|
||||
|
||||
@@ -482,7 +490,7 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
|
||||
|
||||
|
||||
/proc/Broadcast_SimpleMessage(var/source, var/frequency, var/text, var/data, var/mob/M, var/compression)
|
||||
/proc/Broadcast_SimpleMessage(var/source, var/frequency, var/text, var/data, var/mob/M, var/compression, var/level)
|
||||
|
||||
|
||||
/* ###### Prepare the radio connection ###### */
|
||||
@@ -502,8 +510,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
|
||||
if(data == 1)
|
||||
for (var/obj/item/device/radio/intercom/R in connection.devices["[RADIO_CHAT]"])
|
||||
|
||||
receive |= R.send_hear(display_freq)
|
||||
if(R.loc && R.loc.z == level)
|
||||
receive |= R.send_hear(display_freq)
|
||||
|
||||
|
||||
// --- Broadcast only to intercoms and station-bounced radios ---
|
||||
@@ -514,7 +522,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
if(istype(R, /obj/item/device/radio/headset))
|
||||
continue
|
||||
|
||||
receive |= R.send_hear(display_freq)
|
||||
if(R.loc && R.loc.z == level)
|
||||
receive |= R.send_hear(display_freq)
|
||||
|
||||
|
||||
// --- Broadcast to syndicate radio! ---
|
||||
@@ -524,7 +533,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
|
||||
for (var/obj/item/device/radio/R in syndicateconnection.devices["[RADIO_CHAT]"])
|
||||
|
||||
receive |= R.send_hear(SYND_FREQ)
|
||||
if(R.loc && R.loc.z == level)
|
||||
receive |= R.send_hear(SYND_FREQ)
|
||||
|
||||
|
||||
// --- Broadcast to ALL radio devices ---
|
||||
@@ -532,7 +542,8 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
else
|
||||
for (var/obj/item/device/radio/R in connection.devices["[RADIO_CHAT]"])
|
||||
|
||||
receive |= R.send_hear(display_freq)
|
||||
if(R.loc && R.loc.z == level)
|
||||
receive |= R.send_hear(display_freq)
|
||||
|
||||
|
||||
/* ###### Organize the receivers into categories for displaying the message ###### */
|
||||
@@ -630,31 +641,32 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/blackbox_msg = "[part_a][source][part_blackbox_b]\"[text]\"[part_c]"
|
||||
//var/blackbox_admin_msg = "[part_a][M.name] (Real name: [M.real_name])[part_blackbox_b][quotedmsg][part_c]"
|
||||
for (var/obj/machinery/blackbox_recorder/BR in world)
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
if(istype(blackbox))
|
||||
switch(display_freq)
|
||||
if(1459)
|
||||
BR.msg_common += blackbox_msg
|
||||
blackbox.msg_common += blackbox_msg
|
||||
if(1351)
|
||||
BR.msg_science += blackbox_msg
|
||||
blackbox.msg_science += blackbox_msg
|
||||
if(1353)
|
||||
BR.msg_command += blackbox_msg
|
||||
blackbox.msg_command += blackbox_msg
|
||||
if(1355)
|
||||
BR.msg_medical += blackbox_msg
|
||||
blackbox.msg_medical += blackbox_msg
|
||||
if(1357)
|
||||
BR.msg_engineering += blackbox_msg
|
||||
blackbox.msg_engineering += blackbox_msg
|
||||
if(1359)
|
||||
BR.msg_security += blackbox_msg
|
||||
blackbox.msg_security += blackbox_msg
|
||||
if(1441)
|
||||
BR.msg_deathsquad += blackbox_msg
|
||||
blackbox.msg_deathsquad += blackbox_msg
|
||||
if(1213)
|
||||
BR.msg_syndicate += blackbox_msg
|
||||
blackbox.msg_syndicate += blackbox_msg
|
||||
if(1349)
|
||||
BR.msg_mining += blackbox_msg
|
||||
blackbox.msg_mining += blackbox_msg
|
||||
if(1347)
|
||||
BR.msg_cargo += blackbox_msg
|
||||
blackbox.msg_cargo += blackbox_msg
|
||||
else
|
||||
BR.messages += blackbox_msg
|
||||
blackbox.messages += blackbox_msg
|
||||
|
||||
//End of research and feedback code.
|
||||
|
||||
@@ -688,5 +700,37 @@ var/list/recentmessages = list() // global list of recent messages broadcasted :
|
||||
for (var/mob/R in heard_gibberish)
|
||||
R.show_message(rendered, 2)
|
||||
|
||||
//Use this to test if an obj can communicate with a Telecommunications Network
|
||||
|
||||
/atom/proc/test_telecomms()
|
||||
var/datum/signal/signal = telecomms_process()
|
||||
return (src.loc.z in signal.data["level"] && signal.data["done"])
|
||||
|
||||
/atom/proc/telecomms_process()
|
||||
|
||||
// First, we want to generate a new radio signal
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 2 // 2 would be a subspace transmission.
|
||||
|
||||
// --- 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,
|
||||
"level" = list() // The level it is being broadcasted at.
|
||||
)
|
||||
signal.frequency = 1459// Common channel
|
||||
|
||||
//#### Sending the signal to all subspace receivers ####//
|
||||
for(var/obj/machinery/telecomms/receiver/R in world)
|
||||
if(src.loc.z == R.loc.z)
|
||||
R.receive_signal(signal)
|
||||
|
||||
sleep(rand(10,25))
|
||||
|
||||
return signal
|
||||
|
||||
|
||||
@@ -13,109 +13,110 @@
|
||||
|
||||
|
||||
|
||||
attackby(obj/item/P as obj, mob/user as mob)
|
||||
/obj/machinery/telecomms/attackby(obj/item/P as obj, mob/user as mob)
|
||||
|
||||
// Using a multitool lets you access the receiver's interface
|
||||
if(istype(P, /obj/item/device/multitool))
|
||||
attack_hand(user)
|
||||
|
||||
switch(construct_op)
|
||||
if(0)
|
||||
if(istype(P, /obj/item/weapon/screwdriver))
|
||||
user << "You unfasten the bolts."
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
construct_op ++
|
||||
if(1)
|
||||
if(istype(P, /obj/item/weapon/screwdriver))
|
||||
user << "You fasten the bolts."
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
construct_op --
|
||||
if(istype(P, /obj/item/weapon/wrench))
|
||||
user << "You dislodge the external plating."
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
construct_op ++
|
||||
if(2)
|
||||
if(istype(P, /obj/item/weapon/wrench))
|
||||
user << "You secure the external plating."
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
construct_op --
|
||||
if(istype(P, /obj/item/weapon/wirecutters))
|
||||
playsound(src.loc, 'wirecutter.ogg', 50, 1)
|
||||
user << "You remove the cables."
|
||||
construct_op ++
|
||||
var/obj/item/weapon/cable_coil/A = new /obj/item/weapon/cable_coil( user.loc )
|
||||
A.amount = 5
|
||||
stat |= BROKEN // the machine's been borked!
|
||||
if(3)
|
||||
if(istype(P, /obj/item/weapon/cable_coil))
|
||||
var/obj/item/weapon/cable_coil/A = P
|
||||
if(A.amount >= 5)
|
||||
user << "You insert the cables."
|
||||
A.amount -= 5
|
||||
if(A.amount <= 0)
|
||||
user.drop_item()
|
||||
del(A)
|
||||
construct_op --
|
||||
stat &= ~BROKEN // the machine's not borked anymore!
|
||||
if(istype(P, /obj/item/weapon/crowbar))
|
||||
user << "You begin prying out the circuit board other components..."
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
if(do_after(user,60))
|
||||
user << "You finish prying out the components."
|
||||
|
||||
// Drop all the component stuff
|
||||
if(contents.len > 0)
|
||||
for(var/obj/x in src)
|
||||
x.loc = user.loc
|
||||
else
|
||||
|
||||
// If the machine wasn't made during runtime, probably doesn't have components:
|
||||
// manually find the components and drop them!
|
||||
var/newpath = text2path(circuitboard)
|
||||
var/obj/item/weapon/circuitboard/C = new newpath
|
||||
for(var/I in C.req_components)
|
||||
for(var/i = 1, i <= C.req_components[I], i++)
|
||||
newpath = text2path(I)
|
||||
var/obj/item/s = new newpath
|
||||
s.loc = user.loc
|
||||
if(istype(P, /obj/item/weapon/cable_coil))
|
||||
var/obj/item/weapon/cable_coil/A = P
|
||||
A.amount = 1
|
||||
|
||||
// Drop a circuit board too
|
||||
C.loc = user.loc
|
||||
|
||||
// Create a machine frame and delete the current machine
|
||||
var/obj/machinery/constructable_frame/machine_frame/F = new
|
||||
F.loc = src.loc
|
||||
del(src)
|
||||
|
||||
|
||||
attack_ai(var/mob/user as mob)
|
||||
// Using a multitool lets you access the receiver's interface
|
||||
if(istype(P, /obj/item/device/multitool))
|
||||
attack_hand(user)
|
||||
|
||||
attack_hand(var/mob/user as mob)
|
||||
switch(construct_op)
|
||||
if(0)
|
||||
if(istype(P, /obj/item/weapon/screwdriver))
|
||||
user << "You unfasten the bolts."
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
construct_op ++
|
||||
if(1)
|
||||
if(istype(P, /obj/item/weapon/screwdriver))
|
||||
user << "You fasten the bolts."
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
construct_op --
|
||||
if(istype(P, /obj/item/weapon/wrench))
|
||||
user << "You dislodge the external plating."
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
construct_op ++
|
||||
if(2)
|
||||
if(istype(P, /obj/item/weapon/wrench))
|
||||
user << "You secure the external plating."
|
||||
playsound(src.loc, 'Ratchet.ogg', 75, 1)
|
||||
construct_op --
|
||||
if(istype(P, /obj/item/weapon/wirecutters))
|
||||
playsound(src.loc, 'wirecutter.ogg', 50, 1)
|
||||
user << "You remove the cables."
|
||||
construct_op ++
|
||||
var/obj/item/weapon/cable_coil/A = new /obj/item/weapon/cable_coil( user.loc )
|
||||
A.amount = 5
|
||||
stat |= BROKEN // the machine's been borked!
|
||||
if(3)
|
||||
if(istype(P, /obj/item/weapon/cable_coil))
|
||||
var/obj/item/weapon/cable_coil/A = P
|
||||
if(A.amount >= 5)
|
||||
user << "You insert the cables."
|
||||
A.amount -= 5
|
||||
if(A.amount <= 0)
|
||||
user.drop_item()
|
||||
del(A)
|
||||
construct_op --
|
||||
stat &= ~BROKEN // the machine's not borked anymore!
|
||||
if(istype(P, /obj/item/weapon/crowbar))
|
||||
user << "You begin prying out the circuit board other components..."
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
if(do_after(user,60))
|
||||
user << "You finish prying out the components."
|
||||
|
||||
// You need a multitool to use this, or be silicon
|
||||
if(!issilicon(user))
|
||||
if(user.get_active_hand())
|
||||
if(!istype(user.get_active_hand(), /obj/item/device/multitool))
|
||||
return
|
||||
else
|
||||
// Drop all the component stuff
|
||||
if(contents.len > 0)
|
||||
for(var/obj/x in src)
|
||||
x.loc = user.loc
|
||||
else
|
||||
|
||||
// If the machine wasn't made during runtime, probably doesn't have components:
|
||||
// manually find the components and drop them!
|
||||
var/newpath = text2path(circuitboard)
|
||||
var/obj/item/weapon/circuitboard/C = new newpath
|
||||
for(var/I in C.req_components)
|
||||
for(var/i = 1, i <= C.req_components[I], i++)
|
||||
newpath = text2path(I)
|
||||
var/obj/item/s = new newpath
|
||||
s.loc = user.loc
|
||||
if(istype(P, /obj/item/weapon/cable_coil))
|
||||
var/obj/item/weapon/cable_coil/A = P
|
||||
A.amount = 1
|
||||
|
||||
// Drop a circuit board too
|
||||
C.loc = user.loc
|
||||
|
||||
// Create a machine frame and delete the current machine
|
||||
var/obj/machinery/constructable_frame/machine_frame/F = new
|
||||
F.loc = src.loc
|
||||
del(src)
|
||||
|
||||
|
||||
/obj/machinery/telecomms/attack_ai(var/mob/user as mob)
|
||||
attack_hand(user)
|
||||
|
||||
/obj/machinery/telecomms/attack_hand(var/mob/user as mob)
|
||||
|
||||
// You need a multitool to use this, or be silicon
|
||||
if(!issilicon(user))
|
||||
if(user.get_active_hand())
|
||||
if(!istype(user.get_active_hand(), /obj/item/device/multitool))
|
||||
return
|
||||
|
||||
if(stat & (BROKEN|NOPOWER) || !on)
|
||||
else
|
||||
return
|
||||
|
||||
var/obj/item/device/multitool/P = null
|
||||
if(!issilicon(user))
|
||||
P = user.get_active_hand()
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
user.machine = src
|
||||
var/dat
|
||||
dat = "<font face = \"Courier\"><HEAD><TITLE>[src.name]</TITLE></HEAD><center><H3>[src.name] Access</H3></center>"
|
||||
dat += "<br>[temp]<br>"
|
||||
var/obj/item/device/multitool/P = null
|
||||
if(!issilicon(user))
|
||||
P = user.get_active_hand()
|
||||
|
||||
user.machine = src
|
||||
var/dat
|
||||
dat = "<font face = \"Courier\"><HEAD><TITLE>[src.name]</TITLE></HEAD><center><H3>[src.name] Access</H3></center>"
|
||||
dat += "<br>[temp]<br>"
|
||||
dat += "<br>Power Status: <a href='?src=\ref[src];input=toggle'>[src.toggled ? "On" : "Off"]</a>"
|
||||
if(on)
|
||||
if(id != "" && id)
|
||||
dat += "<br>Identification String: <a href='?src=\ref[src];input=id'>[id]</a>"
|
||||
else
|
||||
@@ -127,6 +128,8 @@
|
||||
var/i = 0
|
||||
for(var/obj/machinery/telecomms/T in links)
|
||||
i++
|
||||
if(T.hide)
|
||||
continue
|
||||
dat += "<li>\ref[T] [T.name] ([T.id]) <a href='?src=\ref[src];unlink=[i]'>\[X\]</a></li>"
|
||||
dat += "</ol>"
|
||||
|
||||
@@ -152,117 +155,121 @@
|
||||
else
|
||||
dat += "<br><br>MULTITOOL BUFFER: <a href='?src=\ref[src];buffer=1'>\[Add Machine\]</a>"
|
||||
|
||||
dat += "</font>"
|
||||
temp = ""
|
||||
user << browse(dat, "window=tcommachine;size=520x500;can_resize=0")
|
||||
onclose(user, "dormitory")
|
||||
dat += "</font>"
|
||||
temp = ""
|
||||
user << browse(dat, "window=tcommachine;size=520x500;can_resize=0")
|
||||
onclose(user, "dormitory")
|
||||
|
||||
Topic(href, href_list)
|
||||
/obj/machinery/telecomms/Topic(href, href_list)
|
||||
|
||||
if(!issilicon(usr))
|
||||
if(usr.get_active_hand())
|
||||
if(!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
return
|
||||
else
|
||||
if(!issilicon(usr))
|
||||
if(usr.get_active_hand())
|
||||
if(!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
return
|
||||
|
||||
if(stat & (BROKEN|NOPOWER) || !on)
|
||||
else
|
||||
return
|
||||
|
||||
var/obj/item/device/multitool/P = null
|
||||
if(!issilicon(usr))
|
||||
P = usr.get_active_hand()
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
if(href_list["input"])
|
||||
switch(href_list["input"])
|
||||
var/obj/item/device/multitool/P = null
|
||||
if(!issilicon(usr))
|
||||
P = usr.get_active_hand()
|
||||
|
||||
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 && usr in range(1, src))
|
||||
id = newid
|
||||
temp = "<font color = #666633>-% New ID assigned: \"[id]\" %-</font color>"
|
||||
if(href_list["input"])
|
||||
switch(href_list["input"])
|
||||
|
||||
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 && usr in range(1, src))
|
||||
if("toggle")
|
||||
src.toggled = !src.toggled
|
||||
temp = "<font color = #666633>-% [src] has been [src.toggled ? "activated" : "deactivated"].</font color>"
|
||||
|
||||
if(length(newnet) > 15)
|
||||
temp = "<font color = #666633>-% Too many characters in new network tag %-</font color>"
|
||||
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 && usr in range(1, src))
|
||||
id = newid
|
||||
temp = "<font color = #666633>-% New ID assigned: \"[id]\" %-</font color>"
|
||||
|
||||
else
|
||||
for(var/obj/machinery/telecomms/T in links)
|
||||
T.links.Remove(src)
|
||||
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 && usr in range(1, src))
|
||||
|
||||
network = newnet
|
||||
links = list()
|
||||
temp = "<font color = #666633>-% New network tag assigned: \"[network]\" %-</font color>"
|
||||
if(length(newnet) > 15)
|
||||
temp = "<font color = #666633>-% Too many characters in new network tag %-</font color>"
|
||||
|
||||
else
|
||||
for(var/obj/machinery/telecomms/T in links)
|
||||
T.links.Remove(src)
|
||||
|
||||
network = newnet
|
||||
links = list()
|
||||
temp = "<font color = #666633>-% New network tag assigned: \"[network]\" %-</font color>"
|
||||
|
||||
|
||||
if("freq")
|
||||
var/newfreq = input(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, network) as null|num
|
||||
if(newfreq && usr in range(1, src))
|
||||
if(!(newfreq in freq_listening))
|
||||
if("freq")
|
||||
var/newfreq = input(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, network) as null|num
|
||||
if(newfreq && usr in range(1, src))
|
||||
if(!(newfreq in freq_listening))
|
||||
|
||||
if(findtext(num2text(newfreq), "."))
|
||||
newfreq *= 10 // shift the decimal one place
|
||||
if(findtext(num2text(newfreq), "."))
|
||||
newfreq *= 10 // shift the decimal one place
|
||||
|
||||
freq_listening.Add(newfreq)
|
||||
temp = "<font color = #666633>-% New frequency filter assigned: \"[newfreq] GHz\" %-</font color>"
|
||||
freq_listening.Add(newfreq)
|
||||
temp = "<font color = #666633>-% New frequency filter assigned: \"[newfreq] GHz\" %-</font color>"
|
||||
|
||||
if(href_list["delete"])
|
||||
if(href_list["delete"])
|
||||
|
||||
// changed the layout about to workaround a pesky runtime -- Doohl
|
||||
// changed the layout about to workaround a pesky runtime -- Doohl
|
||||
|
||||
var/freq_remove = text2num(href_list["delete"])
|
||||
for(var/x in freq_listening)
|
||||
if(x == freq_remove)
|
||||
var/freq_remove = text2num(href_list["delete"])
|
||||
for(var/x in freq_listening)
|
||||
if(x == freq_remove)
|
||||
|
||||
temp = "<font color = #666633>-% Removed frequency filter [x] %-</font color>"
|
||||
freq_listening.Remove(x)
|
||||
break
|
||||
temp = "<font color = #666633>-% Removed frequency filter [x] %-</font color>"
|
||||
freq_listening.Remove(x)
|
||||
break
|
||||
|
||||
if(href_list["unlink"])
|
||||
if(href_list["unlink"])
|
||||
|
||||
if(text2num(href_list["unlink"]) <= length(links))
|
||||
var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])]
|
||||
temp = "<font color = #666633>-% Removed \ref[T] [T.name] from linked entities. %-</font color>"
|
||||
if(text2num(href_list["unlink"]) <= length(links))
|
||||
var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])]
|
||||
temp = "<font color = #666633>-% Removed \ref[T] [T.name] from linked entities. %-</font color>"
|
||||
|
||||
// Remove link entries from both T and src.
|
||||
if(src in T.links)
|
||||
T.links.Remove(src)
|
||||
links.Remove(T)
|
||||
// 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(href_list["link"])
|
||||
|
||||
if(P)
|
||||
if(P)
|
||||
|
||||
if(P.buffer)
|
||||
if(!(src in P.buffer.links))
|
||||
P.buffer.links.Add(src)
|
||||
if(P.buffer)
|
||||
if(!(src in P.buffer.links))
|
||||
P.buffer.links.Add(src)
|
||||
|
||||
if(!(P.buffer in src.links))
|
||||
src.links.Add(P.buffer)
|
||||
if(!(P.buffer in src.links))
|
||||
src.links.Add(P.buffer)
|
||||
|
||||
temp = "<font color = #666633>-% Successfully linked with \ref[P.buffer] [P.buffer.name] %-</font color>"
|
||||
temp = "<font color = #666633>-% Successfully linked with \ref[P.buffer] [P.buffer.name] %-</font color>"
|
||||
|
||||
else
|
||||
temp = "<font color = #666633>-% Unable to acquire buffer %-</font color>"
|
||||
else
|
||||
temp = "<font color = #666633>-% Unable to acquire buffer %-</font color>"
|
||||
|
||||
if(href_list["buffer"])
|
||||
if(href_list["buffer"])
|
||||
|
||||
P.buffer = src
|
||||
temp = "<font color = #666633>-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-</font color>"
|
||||
P.buffer = src
|
||||
temp = "<font color = #666633>-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-</font color>"
|
||||
|
||||
|
||||
if(href_list["flush"])
|
||||
if(href_list["flush"])
|
||||
|
||||
temp = "<font color = #666633>-% Buffer successfully flushed. %-</font color>"
|
||||
P.buffer = null
|
||||
temp = "<font color = #666633>-% Buffer successfully flushed. %-</font color>"
|
||||
P.buffer = null
|
||||
|
||||
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
updateUsrDialog()
|
||||
updateUsrDialog()
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
Look at radio.dm for the prequel to this code.
|
||||
*/
|
||||
|
||||
var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
||||
|
||||
/obj/machinery/telecomms
|
||||
var/list/links = list() // list of machines this machine is linked to
|
||||
var/traffic = 0 // value increases as traffic increases
|
||||
@@ -24,188 +26,211 @@
|
||||
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/integrity = 100 // basically HP, loses integrity by heat
|
||||
var/heatgen = 20 // how much heat to transfer to the environment
|
||||
var/delay = 10 // how many process() ticks to delay per heat
|
||||
var/heating_power = 40000
|
||||
|
||||
var/long_range_link = 0
|
||||
var/circuitboard = null // string pointing to a circuitboard type
|
||||
var/hide // Is it a hidden machine?
|
||||
|
||||
|
||||
/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount)
|
||||
// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
|
||||
|
||||
proc/relay_information(datum/signal/signal, filter, copysig, amount)
|
||||
// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
|
||||
if(!on)
|
||||
return
|
||||
|
||||
if(!on)
|
||||
return
|
||||
var/send_count = 0
|
||||
|
||||
signal.data["slow"] += rand(0, round((100-integrity))) // apply some lag based on integrity
|
||||
|
||||
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
|
||||
|
||||
signal.data["slow"] += rand(0, round((100-integrity))) // apply some lag based on integrity
|
||||
|
||||
// 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) ))
|
||||
// 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
|
||||
if(machine.loc.z != src.loc.z)
|
||||
if(long_range_link == 0 && machine.long_range_link == 0)
|
||||
continue
|
||||
if(!machine.on)
|
||||
continue
|
||||
if(amount && send_count >= amount)
|
||||
break
|
||||
|
||||
// If we're sending a copy, be sure to create the copy for EACH machine and paste the data
|
||||
var/datum/signal/copy = new
|
||||
if(copysig)
|
||||
|
||||
copy.transmission_method = 2
|
||||
copy.frequency = signal.frequency
|
||||
// Copy the main data contents! Workaround for some nasty bug where the actual array memory is copied and not its contents.
|
||||
copy.data = list(
|
||||
|
||||
"mob" = signal.data["mob"],
|
||||
"mobtype" = signal.data["mobtype"],
|
||||
"realname" = signal.data["realname"],
|
||||
"name" = signal.data["name"],
|
||||
"job" = signal.data["job"],
|
||||
"key" = signal.data["key"],
|
||||
"vmessage" = signal.data["vmessage"],
|
||||
"vname" = signal.data["vname"],
|
||||
"vmask" = signal.data["vmask"],
|
||||
"compression" = signal.data["compression"],
|
||||
"message" = signal.data["message"],
|
||||
"connection" = signal.data["connection"],
|
||||
"radio" = signal.data["radio"],
|
||||
"slow" = signal.data["slow"],
|
||||
"traffic" = signal.data["traffic"],
|
||||
"type" = signal.data["type"],
|
||||
"server" = signal.data["server"],
|
||||
"reject" = signal.data["reject"]
|
||||
)
|
||||
|
||||
// Keep the "original" signal constant
|
||||
if(!signal.data["original"])
|
||||
copy.data["original"] = signal
|
||||
else
|
||||
copy.data["original"] = signal.data["original"]
|
||||
|
||||
else
|
||||
del(copy)
|
||||
|
||||
|
||||
//Is this a test signal?
|
||||
if(signal.data["type"] == 4)
|
||||
send_count++
|
||||
if(machine.is_freq_listening(signal))
|
||||
machine.traffic++
|
||||
machine.receive_information(signal, src)
|
||||
continue
|
||||
// If we're sending a copy, be sure to create the copy for EACH machine and paste the data
|
||||
var/datum/signal/copy = new
|
||||
if(copysig)
|
||||
|
||||
if(copysig && copy)
|
||||
machine.receive_information(copy, src)
|
||||
copy.transmission_method = 2
|
||||
copy.frequency = signal.frequency
|
||||
// Copy the main data contents! Workaround for some nasty bug where the actual array memory is copied and not its contents.
|
||||
copy.data = list(
|
||||
|
||||
"mob" = signal.data["mob"],
|
||||
"mobtype" = signal.data["mobtype"],
|
||||
"realname" = signal.data["realname"],
|
||||
"name" = signal.data["name"],
|
||||
"job" = signal.data["job"],
|
||||
"key" = signal.data["key"],
|
||||
"vmessage" = signal.data["vmessage"],
|
||||
"vname" = signal.data["vname"],
|
||||
"vmask" = signal.data["vmask"],
|
||||
"compression" = signal.data["compression"],
|
||||
"message" = signal.data["message"],
|
||||
"connection" = signal.data["connection"],
|
||||
"radio" = signal.data["radio"],
|
||||
"slow" = signal.data["slow"],
|
||||
"traffic" = signal.data["traffic"],
|
||||
"type" = signal.data["type"],
|
||||
"server" = signal.data["server"],
|
||||
"reject" = signal.data["reject"]
|
||||
)
|
||||
|
||||
// Keep the "original" signal constant
|
||||
if(!signal.data["original"])
|
||||
copy.data["original"] = signal
|
||||
else
|
||||
machine.receive_information(signal, src)
|
||||
copy.data["original"] = signal.data["original"]
|
||||
|
||||
if(send_count > 0 && is_freq_listening(signal))
|
||||
traffic++
|
||||
|
||||
return send_count
|
||||
|
||||
proc/relay_direct_information(datum/signal/signal, obj/machinery/telecomms/machine)
|
||||
// send signal directly to a machine
|
||||
machine.receive_information(signal, src)
|
||||
|
||||
proc/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
// receive information from linked machinery
|
||||
..()
|
||||
|
||||
proc/is_freq_listening(datum/signal/signal)
|
||||
// return 1 if found, 0 if not found
|
||||
if((signal.frequency in freq_listening) || (!freq_listening.len))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
del(copy)
|
||||
|
||||
New()
|
||||
..()
|
||||
if(autolinkers.len)
|
||||
spawn(10)
|
||||
// Links nearby machines
|
||||
|
||||
send_count++
|
||||
if(machine.is_freq_listening(signal))
|
||||
machine.traffic++
|
||||
|
||||
if(copysig && copy)
|
||||
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
|
||||
..()
|
||||
|
||||
/obj/machinery/telecomms/proc/is_freq_listening(datum/signal/signal)
|
||||
// return 1 if found, 0 if not found
|
||||
if((signal.frequency in freq_listening) || (!freq_listening.len))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/machinery/telecomms/New()
|
||||
telecomms_list += src
|
||||
..()
|
||||
if(autolinkers.len)
|
||||
spawn(15)
|
||||
// Links nearby machines
|
||||
if(!long_range_link)
|
||||
for(var/obj/machinery/telecomms/T in orange(15, src))
|
||||
for(var/x in autolinkers)
|
||||
if(T.autolinkers.Find(x))
|
||||
if(!(T in links) && machinetype != T.machinetype)
|
||||
links.Add(T)
|
||||
add_link(T)
|
||||
else
|
||||
for(var/obj/machinery/telecomms/T in telecomms_list)
|
||||
add_link(T)
|
||||
|
||||
if(istype(src, /obj/machinery/telecomms/server))
|
||||
var/obj/machinery/telecomms/server/S = src
|
||||
S.Compiler = new()
|
||||
S.Compiler.Holder = src
|
||||
if(istype(src, /obj/machinery/telecomms/server))
|
||||
var/obj/machinery/telecomms/server/S = src
|
||||
S.Compiler = new()
|
||||
S.Compiler.Holder = src
|
||||
|
||||
/obj/machinery/telecomms/Del()
|
||||
telecomms_list -= src
|
||||
..()
|
||||
|
||||
/obj/machinery/telecomms/proc/add_link(var/obj/machinery/telecomms/T)
|
||||
if((src.loc.z && T.loc.z) || (src.long_range_link && T.long_range_link))
|
||||
for(var/x in autolinkers)
|
||||
if(T.autolinkers.Find(x))
|
||||
if(!(T in links) && machinetype != T.machinetype)
|
||||
links.Add(T)
|
||||
|
||||
/obj/machinery/telecomms/update_icon()
|
||||
if(on)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]_off"
|
||||
|
||||
|
||||
update_icon()
|
||||
if(on)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]_off"
|
||||
|
||||
|
||||
process()
|
||||
/obj/machinery/telecomms/process()
|
||||
if(toggled)
|
||||
if(stat & (BROKEN|NOPOWER) || integrity <= 0) // if powered, on. if not powered, off. if too damaged, off
|
||||
on = 0
|
||||
else
|
||||
on = 1
|
||||
else
|
||||
on = 0
|
||||
|
||||
// Check heat and generate some
|
||||
checkheat()
|
||||
// Check heat and generate some
|
||||
checkheat()
|
||||
|
||||
// Update the icon
|
||||
update_icon()
|
||||
// Update the icon
|
||||
update_icon()
|
||||
|
||||
if(traffic > 0)
|
||||
traffic -= netspeed
|
||||
if(traffic > 0)
|
||||
traffic -= netspeed
|
||||
|
||||
proc/checkheat()
|
||||
// Checks heat from the environment and applies any integrity damage
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
switch(environment.temperature)
|
||||
if(T0C to (T20C + 20))
|
||||
integrity = between(0, integrity, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
integrity = max(0, integrity - 1)
|
||||
if(delay)
|
||||
delay--
|
||||
else
|
||||
// If the machine is on, ready to produce heat, and has positive traffic, genn some heat
|
||||
if(on && traffic > 0)
|
||||
produce_heat(heatgen)
|
||||
delay = initial(delay)
|
||||
/obj/machinery/telecomms/proc/checkheat()
|
||||
// Checks heat from the environment and applies any integrity damage
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
switch(environment.temperature)
|
||||
if(T0C to (T20C + 20))
|
||||
integrity = between(0, integrity, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
integrity = max(0, integrity - 1)
|
||||
if(delay)
|
||||
delay--
|
||||
else
|
||||
// If the machine is on, ready to produce heat, and has positive traffic, genn some heat
|
||||
if(on && traffic > 0)
|
||||
produce_heat(heatgen)
|
||||
delay = initial(delay)
|
||||
|
||||
proc/produce_heat(heat_amt)
|
||||
if(heatgen == 0)
|
||||
return
|
||||
/obj/machinery/telecomms/proc/produce_heat(heat_amt)
|
||||
if(heatgen == 0)
|
||||
return
|
||||
|
||||
if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater.
|
||||
var/turf/simulated/L = loc
|
||||
if(istype(L))
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.temperature < (heat_amt+T0C))
|
||||
if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater.
|
||||
var/turf/simulated/L = loc
|
||||
if(istype(L))
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.temperature < (heat_amt+T0C))
|
||||
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
if(removed)
|
||||
if(removed)
|
||||
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
if(heat_capacity == 0 || heat_capacity == null)
|
||||
heat_capacity = 1
|
||||
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
if(heat_capacity == 0 || heat_capacity == null)
|
||||
heat_capacity = 1
|
||||
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
||||
|
||||
env.merge(removed)
|
||||
env.merge(removed)
|
||||
/*
|
||||
The receiver idles and receives messages from subspace-compatible radio equipment;
|
||||
primarily headsets. They then just relay this information to all linked devices,
|
||||
@@ -224,35 +249,101 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 30
|
||||
machinetype = 1
|
||||
heatgen = 10
|
||||
heatgen = 5
|
||||
circuitboard = "/obj/item/weapon/circuitboard/telecomms/receiver"
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
/obj/machinery/telecomms/receiver/receive_signal(datum/signal/signal)
|
||||
|
||||
if(!on) // has to be on to receive messages
|
||||
return
|
||||
if(!on) // has to be on to receive messages
|
||||
return
|
||||
|
||||
if(signal.transmission_method == 2)
|
||||
|
||||
if(is_freq_listening(signal)) // detect subspace signals
|
||||
|
||||
|
||||
var/sendbus = relay_information(signal, "/obj/machinery/telecomms/bus", 1) // ideally relay the copied information to bus units
|
||||
|
||||
/* We can't send the signal to a bus, so we send it to a processor */
|
||||
if(!sendbus)
|
||||
signal.data["slow"] += rand(5, 10) // slow the signal down
|
||||
relay_information(signal, "/obj/machinery/telecomms/processor", 1) // send copy to processors
|
||||
if(signal.transmission_method == 2)
|
||||
|
||||
if(is_freq_listening(signal)) // detect subspace signals
|
||||
var/can_send = relay_information(signal, "/obj/machinery/telecomms/relay") // 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
|
||||
|
||||
/*
|
||||
The bus mainframe idles and waits for receivers to relay them signals. They act
|
||||
as the main network hub, transferring data packets from and to other machines.
|
||||
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 = "bus"
|
||||
desc = "A mighty piece of hardware used to send/receive massive amounts of data."
|
||||
density = 1
|
||||
anchored = 1
|
||||
use_power = 1
|
||||
idle_power_usage = 80
|
||||
machinetype = 7
|
||||
heatgen = 5
|
||||
circuitboard = "/obj/item/weapon/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/relay))
|
||||
|
||||
//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
|
||||
//The signal is ready to be sent!
|
||||
var/can_send = relay_information(signal, "/obj/machinery/telecomms/relay", 1)
|
||||
if(!can_send)
|
||||
relay_information(signal, "/obj/machinery/telecomms/broadcaster", 1) // Send it to a broadcaster instead, if it's linked to one
|
||||
/*
|
||||
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 = "bus"
|
||||
desc = "A mighty piece of hardware used to send massive amounts of data far away."
|
||||
density = 1
|
||||
anchored = 1
|
||||
use_power = 1
|
||||
idle_power_usage = 30
|
||||
machinetype = 8
|
||||
heatgen = 5
|
||||
circuitboard = "/obj/item/weapon/circuitboard/telecomms/relay"
|
||||
netspeed = 5
|
||||
long_range_link = 1
|
||||
|
||||
/obj/machinery/telecomms/relay/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.
|
||||
var/can_send = relay_information(signal, "/obj/machinery/telecomms/hub", 1) // ideally relay the copied information to bus units
|
||||
if(!can_send)
|
||||
relay_information(signal, "/obj/machinery/telecomms/bus", 1) // Send it to a bus instead, if it's linked to one
|
||||
else
|
||||
//The signal is ready to be sent!
|
||||
relay_information(signal, "/obj/machinery/telecomms/broadcaster", 1)
|
||||
|
||||
/*
|
||||
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 broadcaster if it can't send to a server.
|
||||
Link to a subspace hub if it can't send to a server.
|
||||
*/
|
||||
|
||||
/obj/machinery/telecomms/bus
|
||||
@@ -269,27 +360,26 @@
|
||||
circuitboard = "/obj/item/weapon/circuitboard/telecomms/bus"
|
||||
netspeed = 40
|
||||
|
||||
receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
/obj/machinery/telecomms/bus/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
|
||||
if(is_freq_listening(signal))
|
||||
if(signal.data["compression"]) // if signal is still compressed from subspace transmission
|
||||
// send to one linked processor unit
|
||||
if(is_freq_listening(signal))
|
||||
if(signal.data["compression"]) // if signal is still compressed from subspace transmission
|
||||
// send to one linked processor unit
|
||||
var/send_to_processor = relay_information(signal, "/obj/machinery/telecomms/processor", 1)
|
||||
|
||||
var/send_to_processor = relay_information(signal, "/obj/machinery/telecomms/processor")
|
||||
|
||||
if(!send_to_processor) // failed to send to a processor, relay information anyway
|
||||
signal.data["slow"] += rand(1, 5) // slow the signal down only slightly
|
||||
relay_information(signal, "/obj/machinery/telecomms/server", 1)
|
||||
if(!send_to_processor) // failed to send to a processor, relay information anyway
|
||||
signal.data["slow"] += rand(1, 5) // slow the signal down only slightly
|
||||
relay_information(signal, "/obj/machinery/telecomms/server", 1)
|
||||
|
||||
|
||||
else // the signal has been decompressed by a processor unit
|
||||
// send to all linked server units
|
||||
var/sendserver = relay_information(signal, "/obj/machinery/telecomms/server", 1)
|
||||
else // the signal has been decompressed by a processor unit
|
||||
// send to all linked server units
|
||||
var/sendserver = relay_information(signal, "/obj/machinery/telecomms/server", 1)
|
||||
|
||||
// Can't send to a single server, send to a broadcaster instead! But it needs a processor to do this
|
||||
if(!sendserver)
|
||||
signal.data["slow"] += rand(0, 1) // slow the signal down only slightly
|
||||
relay_information(signal, "/obj/machinery/telecomms/broadcaster")
|
||||
// Can't send to a single server, send to a hub instead!
|
||||
if(!sendserver)
|
||||
signal.data["slow"] += rand(0, 1) // slow the signal down only slightly
|
||||
relay_information(signal, "/obj/machinery/telecomms/hub")
|
||||
|
||||
|
||||
|
||||
@@ -319,16 +409,13 @@
|
||||
|
||||
if(is_freq_listening(signal))
|
||||
signal.data["compression"] = 0 // uncompress subspace 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", 1)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
The server logs all traffic and signal data. Once it records the signal, it sends
|
||||
it to the subspace broadcaster.
|
||||
@@ -365,14 +452,17 @@
|
||||
// would add up to md5("password123comsat")
|
||||
var/language = "human"
|
||||
|
||||
receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
/obj/machinery/telecomms/server/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
|
||||
|
||||
if(signal.data["message"])
|
||||
if(signal.data["message"])
|
||||
|
||||
if(is_freq_listening(signal))
|
||||
if(is_freq_listening(signal))
|
||||
|
||||
if(traffic > 0)
|
||||
totaltraffic += traffic // add current traffic to total traffic
|
||||
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
|
||||
|
||||
@@ -419,36 +509,36 @@
|
||||
if(Compiler && autoruncode)
|
||||
Compiler.Run(signal) // execute the code
|
||||
|
||||
relay_information(signal, "/obj/machinery/telecomms/broadcaster")
|
||||
relay_information(signal, "/obj/machinery/telecomms/hub", 1)
|
||||
|
||||
|
||||
proc/setcode(var/t)
|
||||
if(t)
|
||||
if(istext(t))
|
||||
rawcode = t
|
||||
/obj/machinery/telecomms/server/proc/setcode(var/t)
|
||||
if(t)
|
||||
if(istext(t))
|
||||
rawcode = t
|
||||
|
||||
proc/compile()
|
||||
if(Compiler)
|
||||
return Compiler.Compile(rawcode)
|
||||
/obj/machinery/telecomms/server/proc/compile()
|
||||
if(Compiler)
|
||||
return Compiler.Compile(rawcode)
|
||||
|
||||
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/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
|
||||
|
||||
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()
|
||||
/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()
|
||||
|
||||
|
||||
|
||||
@@ -466,17 +556,48 @@
|
||||
|
||||
// ### Preset machines (Located at centcom!) (Or the Comms Satellite) ###
|
||||
|
||||
//Relay
|
||||
|
||||
/obj/machinery/telecomms/relay/preset
|
||||
network = "tcommsat"
|
||||
|
||||
/obj/machinery/telecomms/relay/preset/station
|
||||
id = "Station Relay"
|
||||
autolinkers = list("s_relay", "s_receiverA", "s_receiverB", "s_broadcasterA", "s_broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/relay/preset/telecomms
|
||||
id = "Telecomms Relay"
|
||||
autolinkers = list("relay", "receiverA", "receiverB", "broadcasterA", "broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/relay/preset/mining
|
||||
id = "Mining Relay"
|
||||
autolinkers = list("m_relay", "m_receiverA", "m_receiverB", "m_broadcasterA", "m_broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/relay/preset/ruskie
|
||||
id = "Ruskie Relay"
|
||||
hide = 1
|
||||
autolinkers = list("r_relay", "r_receiverA", "r_receiverB", "r_broadcasterA", "r_broadcasterB")
|
||||
|
||||
//HUB
|
||||
|
||||
/obj/machinery/telecomms/hub/preset
|
||||
id = "Hub"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("hub", "relay", "s_relay", "m_relay", "science", "medical",
|
||||
"cargo", "mining", "common", "command", "engineering", "security")
|
||||
|
||||
//Receivers
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_left
|
||||
id = "Receiver A"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus1", "bus2") // link to bus units 1 and 2
|
||||
autolinkers = list("receiverA") // link to bus units 1 and 2
|
||||
freq_listening = list(1351, 1355, 1347, 1349) // science, medical, cargo, mining
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_right
|
||||
id = "Receiver B"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus3", "bus4") // Bus units 3 and 4
|
||||
autolinkers = list("receiverB") // Bus units 3 and 4
|
||||
freq_listening = list(1353, 1357, 1359) //command, engineering, security
|
||||
|
||||
//Common and other radio frequencies for people to freely use
|
||||
@@ -485,28 +606,56 @@
|
||||
freq_listening |= i
|
||||
..()
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_left/station
|
||||
id = "Station Receiver A"
|
||||
autolinkers = list("s_receiverA")
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_right/station
|
||||
id = "Station Receiver B"
|
||||
autolinkers = list("s_receiverB")
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_left/mining
|
||||
id = "Mining Receiver A"
|
||||
autolinkers = list("m_receiverA")
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_right/mining
|
||||
id = "Mining Receiver B"
|
||||
autolinkers = list("m_receiverB")
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_left/ruskie
|
||||
id = "Ruskie Receiver A"
|
||||
autolinkers = list("r_receiverA")
|
||||
toggled = 0
|
||||
|
||||
/obj/machinery/telecomms/receiver/preset_right/ruskie
|
||||
id = "Ruskie Receiver B"
|
||||
autolinkers = list("r_receiverB")
|
||||
toggled = 0
|
||||
|
||||
//Buses
|
||||
|
||||
/obj/machinery/telecomms/bus/preset_one
|
||||
id = "Bus 1"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus1", "processor1", "science", "medical")
|
||||
autolinkers = list("processor1", "science", "medical")
|
||||
|
||||
/obj/machinery/telecomms/bus/preset_two
|
||||
id = "Bus 2"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus2", "processor2", "cargo", "mining")
|
||||
autolinkers = list("processor2", "cargo", "mining")
|
||||
|
||||
/obj/machinery/telecomms/bus/preset_three
|
||||
id = "Bus 3"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus3", "processor3", "security", "command")
|
||||
autolinkers = list("processor3", "security", "command")
|
||||
|
||||
/obj/machinery/telecomms/bus/preset_four
|
||||
id = "Bus 4"
|
||||
network = "tcommsat"
|
||||
autolinkers = list("bus4", "processor4", "engineering", "common")
|
||||
autolinkers = list("processor4", "engineering", "common")
|
||||
|
||||
|
||||
//Processors
|
||||
|
||||
/obj/machinery/telecomms/processor/preset_one
|
||||
id = "Processor 1"
|
||||
@@ -528,61 +677,61 @@
|
||||
network = "tcommsat"
|
||||
autolinkers = list("processor4")
|
||||
|
||||
|
||||
//Servers
|
||||
|
||||
/obj/machinery/telecomms/server/presets
|
||||
|
||||
network = "tcommsat"
|
||||
|
||||
science
|
||||
id = "Science Server"
|
||||
freq_listening = list(1351)
|
||||
autolinkers = list("science", "broadcasterA")
|
||||
/obj/machinery/telecomms/server/presets/science
|
||||
id = "Science Server"
|
||||
freq_listening = list(1351)
|
||||
autolinkers = list("science")
|
||||
|
||||
medical
|
||||
id = "Medical Server"
|
||||
freq_listening = list(1355)
|
||||
autolinkers = list("medical", "broadcasterA")
|
||||
/obj/machinery/telecomms/server/presets/medical
|
||||
id = "Medical Server"
|
||||
freq_listening = list(1355)
|
||||
autolinkers = list("medical")
|
||||
|
||||
cargo
|
||||
id = "Cargo Server"
|
||||
freq_listening = list(1347)
|
||||
autolinkers = list("cargo", "broadcasterA")
|
||||
/obj/machinery/telecomms/server/presets/cargo
|
||||
id = "Cargo Server"
|
||||
freq_listening = list(1347)
|
||||
autolinkers = list("cargo")
|
||||
|
||||
mining
|
||||
id = "Mining Server"
|
||||
freq_listening = list(1349)
|
||||
autolinkers = list("mining", "broadcasterA")
|
||||
/obj/machinery/telecomms/server/presets/mining
|
||||
id = "Mining Server"
|
||||
freq_listening = list(1349)
|
||||
autolinkers = list("mining")
|
||||
|
||||
common
|
||||
id = "Common Server"
|
||||
freq_listening = list()
|
||||
autolinkers = list("common", "broadcasterB")
|
||||
/obj/machinery/telecomms/server/presets/common
|
||||
id = "Common Server"
|
||||
freq_listening = list()
|
||||
autolinkers = list("common")
|
||||
|
||||
//Common and other radio frequencies for people to freely use
|
||||
// 1441 to 1489
|
||||
New()
|
||||
for(var/i = 1441, i < 1489, i += 2)
|
||||
freq_listening |= i
|
||||
..()
|
||||
//Common and other radio frequencies for people to freely use
|
||||
// 1441 to 1489
|
||||
/obj/machinery/telecomms/server/presets/common/New()
|
||||
for(var/i = 1441, i < 1489, i += 2)
|
||||
freq_listening |= i
|
||||
..()
|
||||
|
||||
command
|
||||
id = "Command Server"
|
||||
freq_listening = list(1353)
|
||||
autolinkers = list("command", "broadcasterB")
|
||||
/obj/machinery/telecomms/server/presets/command
|
||||
id = "Command Server"
|
||||
freq_listening = list(1353)
|
||||
autolinkers = list("command")
|
||||
|
||||
engineering
|
||||
id = "Engineering Server"
|
||||
freq_listening = list(1357)
|
||||
autolinkers = list("engineering", "broadcasterB")
|
||||
|
||||
security
|
||||
id = "Security Server"
|
||||
freq_listening = list(1359)
|
||||
autolinkers = list("security", "broadcasterB")
|
||||
/obj/machinery/telecomms/server/presets/engineering
|
||||
id = "Engineering Server"
|
||||
freq_listening = list(1357)
|
||||
autolinkers = list("engineering")
|
||||
|
||||
/obj/machinery/telecomms/server/presets/security
|
||||
id = "Security Server"
|
||||
freq_listening = list(1359)
|
||||
autolinkers = list("security")
|
||||
|
||||
|
||||
//Broadcasters
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_left
|
||||
id = "Broadcaster A"
|
||||
@@ -594,6 +743,32 @@
|
||||
network = "tcommsat"
|
||||
autolinkers = list("broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_left/station
|
||||
id = "Station Broadcaster A"
|
||||
autolinkers = list("s_broadcasterA")
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_right/station
|
||||
id = "Station Broadcaster B"
|
||||
autolinkers = list("s_broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_left/mining
|
||||
id = "Mining Broadcaster A"
|
||||
autolinkers = list("m_broadcasterA")
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_right/mining
|
||||
id = "Mining Broadcaster B"
|
||||
autolinkers = list("m_broadcasterB")
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_left/ruskie
|
||||
id = "Ruskie Broadcaster A"
|
||||
autolinkers = list("r_broadcasterA")
|
||||
toggled = 0
|
||||
|
||||
/obj/machinery/telecomms/broadcaster/preset_right/ruskie
|
||||
id = "Ruskie Broadcaster B"
|
||||
autolinkers = list("r_broadcasterB")
|
||||
toggled = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -701,36 +701,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
id.loc = get_turf(src)
|
||||
id = null
|
||||
|
||||
/obj/item/device/pda/proc/telecomms_process(var/receipent, var/originator, var/data)
|
||||
var/telecomms_intact = 0
|
||||
/* Make sure telecomms is intact */
|
||||
for (var/obj/machinery/telecomms/receiver/R in world)
|
||||
|
||||
if((1459 in R.freq_listening) && R.on)
|
||||
|
||||
for (var/obj/machinery/telecomms/bus/B in R.links)
|
||||
|
||||
if((1459 in B.freq_listening) && B.on)
|
||||
|
||||
for(var/obj/machinery/telecomms/server/S in B.links)
|
||||
|
||||
if((1459 in S.freq_listening) && S.on)
|
||||
// Add a log
|
||||
S.add_entry("[originator] sent to [receipent]: \"[data]\"", "PDA log")
|
||||
|
||||
for(var/obj/machinery/telecomms/broadcaster/C in S.links)
|
||||
|
||||
if(((1459 in C.freq_listening || C.freq_listening.len == 0)) && C.on)
|
||||
|
||||
telecomms_intact = 1
|
||||
break
|
||||
|
||||
break
|
||||
break
|
||||
break
|
||||
|
||||
return telecomms_intact
|
||||
|
||||
/obj/item/device/pda/proc/create_message(var/mob/living/U = usr, var/obj/item/device/pda/P)
|
||||
|
||||
var/t = input(U, "Please enter message", name, null) as text
|
||||
@@ -756,7 +726,23 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if(MS.active)
|
||||
useMS = MS
|
||||
break
|
||||
if(useMS) // only send the message if it's stable
|
||||
|
||||
var/datum/signal/signal = telecomms_process()
|
||||
|
||||
var/useTC = 0
|
||||
if(signal)
|
||||
if(signal.data["done"])
|
||||
useTC = 1
|
||||
if(P.loc.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)
|
||||
|
||||
if(useMS && useTC) // only send the message if it's stable
|
||||
if(useTC != 2) // Does our recepient have a broadcaster on their level?
|
||||
U << "ERROR: Cannot reach recepient."
|
||||
return
|
||||
useMS.send_pda_message("[P.owner]","[owner]","[t]")
|
||||
|
||||
tnote += "<i><b>→ To [P.owner]:</b></i><br>[t]<br>"
|
||||
|
||||
@@ -32,9 +32,15 @@
|
||||
if(range > 0)
|
||||
return get_mobs_in_view(canhear_range, src)
|
||||
|
||||
receive_range(freq)
|
||||
receive_range(freq, level)
|
||||
if (!on)
|
||||
return 0
|
||||
if (!(src.wires & WIRE_RECEIVE))
|
||||
return 0
|
||||
if(!src.loc)
|
||||
return 0
|
||||
if(src.loc.z != level)
|
||||
return 0
|
||||
if (!src.listening)
|
||||
return 0
|
||||
if(freq == SYND_FREQ)
|
||||
|
||||
@@ -359,11 +359,13 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
|
||||
|
||||
//#### Sending the signal to all subspace receivers ####//
|
||||
for(var/obj/machinery/telecomms/receiver/R in world)
|
||||
R.receive_signal(signal)
|
||||
if(src.loc.z == R.loc.z)
|
||||
R.receive_signal(signal)
|
||||
|
||||
// Allinone can act as receivers.
|
||||
for(var/obj/machinery/telecomms/allinone/R in world)
|
||||
R.receive_signal(signal)
|
||||
if(src.loc.z == R.loc.z)
|
||||
R.receive_signal(signal)
|
||||
|
||||
// Receiving code can be located in Telecommunications.dm
|
||||
return
|
||||
@@ -409,7 +411,8 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
|
||||
signal.frequency = connection.frequency // Quick frequency set
|
||||
|
||||
for(var/obj/machinery/telecomms/receiver/R in world)
|
||||
R.receive_signal(signal)
|
||||
if(src.loc.z == R.loc.z)
|
||||
R.receive_signal(signal)
|
||||
|
||||
|
||||
sleep(rand(10,25)) // wait a little...
|
||||
@@ -426,7 +429,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
|
||||
|
||||
Broadcast_Message(connection, M, voicemask, M.voice_message,
|
||||
src, message, displayname, jobname, real_name, M.voice_name,
|
||||
filter_type, signal.data["compression"])
|
||||
filter_type, signal.data["compression"], src.loc.z)
|
||||
|
||||
|
||||
|
||||
@@ -535,31 +538,31 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
|
||||
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>" // Tweaked for security headsets -- TLE
|
||||
var/blackbox_msg = "[part_a][M.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]"
|
||||
for (var/obj/machinery/blackbox_recorder/BR in world)
|
||||
if(istype(blackbox))
|
||||
//BR.messages_admin += blackbox_admin_msg
|
||||
switch(display_freq)
|
||||
if(1459)
|
||||
BR.msg_common += blackbox_msg
|
||||
blackbox.msg_common += blackbox_msg
|
||||
if(1351)
|
||||
BR.msg_science += blackbox_msg
|
||||
blackbox.msg_science += blackbox_msg
|
||||
if(1353)
|
||||
BR.msg_command += blackbox_msg
|
||||
blackbox.msg_command += blackbox_msg
|
||||
if(1355)
|
||||
BR.msg_medical += blackbox_msg
|
||||
blackbox.msg_medical += blackbox_msg
|
||||
if(1357)
|
||||
BR.msg_engineering += blackbox_msg
|
||||
blackbox.msg_engineering += blackbox_msg
|
||||
if(1359)
|
||||
BR.msg_security += blackbox_msg
|
||||
blackbox.msg_security += blackbox_msg
|
||||
if(1441)
|
||||
BR.msg_deathsquad += blackbox_msg
|
||||
blackbox.msg_deathsquad += blackbox_msg
|
||||
if(1213)
|
||||
BR.msg_syndicate += blackbox_msg
|
||||
blackbox.msg_syndicate += blackbox_msg
|
||||
if(1349)
|
||||
BR.msg_mining += blackbox_msg
|
||||
blackbox.msg_mining += blackbox_msg
|
||||
if(1347)
|
||||
BR.msg_cargo += blackbox_msg
|
||||
blackbox.msg_cargo += blackbox_msg
|
||||
else
|
||||
BR.messages += blackbox_msg
|
||||
blackbox.messages += blackbox_msg
|
||||
|
||||
//End of research and feedback code.
|
||||
|
||||
@@ -623,13 +626,15 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/device/radio/proc/receive_range(freq)
|
||||
/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
|
||||
// returns: 0 if can't receive, range otherwise
|
||||
|
||||
if (!(wires & WIRE_RECEIVE))
|
||||
return 0
|
||||
if(isnull(src.loc) || src.loc.z != level)
|
||||
return 0
|
||||
if(freq == SYND_FREQ)
|
||||
if(!(src.syndie))//Checks to see if it's allowed on that frequency, based on the encryption keys
|
||||
return 0
|
||||
|
||||
@@ -72,8 +72,10 @@
|
||||
/mob/living/carbon/human/proc/ChangeToHusk()
|
||||
if(HUSK in mutations) return
|
||||
|
||||
facial_hair_style.icon_state = "bald" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE
|
||||
hair_style.icon_state = "bald"
|
||||
if(facial_hair_style)
|
||||
facial_hair_style.icon_state = "bald" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE
|
||||
if(hair_style)
|
||||
hair_style.icon_state = "bald"
|
||||
update_hair(0)
|
||||
|
||||
mutations.Add(HUSK)
|
||||
|
||||
Reference in New Issue
Block a user