82 lines
2.6 KiB
Plaintext
82 lines
2.6 KiB
Plaintext
/*
|
|
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_state = "bus"
|
|
desc = "A mighty piece of hardware used to send massive amounts of data quickly."
|
|
density = TRUE
|
|
use_power = IDLE_POWER_USE
|
|
idle_power_usage = 50
|
|
netspeed = 40
|
|
circuit = /obj/item/circuitboard/machine/telecomms/bus
|
|
var/change_frequency = FALSE
|
|
var/change_freq_value = 0
|
|
|
|
/obj/machinery/telecomms/bus/RefreshParts()
|
|
idle_power_usage = 50
|
|
for(var/obj/item/stock_parts/manipulator/P in component_parts)
|
|
idle_power_usage -= (P.rating * 2) //Has 2 manipulators
|
|
|
|
/obj/machinery/telecomms/bus/receive_information(datum/signal/subspace/signal, obj/machinery/telecomms/machine_from)
|
|
if(!istype(signal) || !is_freq_listening(signal))
|
|
return
|
|
|
|
if(change_frequency && (change_freq_value && signal.frequency != FREQ_SYNDICATE))
|
|
signal.frequency = change_freq_value
|
|
|
|
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
|
|
if(relay_information(signal, /obj/machinery/telecomms/processor))
|
|
return
|
|
|
|
// Try sending it!
|
|
var/list/try_send = list(signal.server_type, /obj/machinery/telecomms/hub, /obj/machinery/telecomms/broadcaster)
|
|
|
|
for(var/send in try_send)
|
|
if(relay_information(signal, send))
|
|
break
|
|
|
|
//Preset Buses
|
|
|
|
/obj/machinery/telecomms/bus/preset_one
|
|
id = "Bus 1"
|
|
network = "tcommsat"
|
|
freq_listening = list(FREQ_SCIENCE, FREQ_MEDICAL)
|
|
autolinkers = list("processor1", "science", "medical")
|
|
|
|
/obj/machinery/telecomms/bus/preset_two
|
|
id = "Bus 2"
|
|
network = "tcommsat"
|
|
freq_listening = list(FREQ_SUPPLY, FREQ_SERVICE)
|
|
autolinkers = list("processor2", "supply", "service")
|
|
|
|
/obj/machinery/telecomms/bus/preset_three
|
|
id = "Bus 3"
|
|
network = "tcommsat"
|
|
freq_listening = list(FREQ_SECURITY, FREQ_COMMAND)
|
|
autolinkers = list("processor3", "security", "command")
|
|
|
|
/obj/machinery/telecomms/bus/preset_four
|
|
id = "Bus 4"
|
|
network = "tcommsat"
|
|
freq_listening = list(FREQ_ENGINEERING)
|
|
autolinkers = list("processor4", "engineering", "common")
|
|
|
|
/obj/machinery/telecomms/bus/preset_four/Initialize(mapload)
|
|
. = ..()
|
|
for(var/i = MIN_FREQ, i <= MAX_FREQ, i += 2)
|
|
freq_listening |= i
|
|
|
|
/obj/machinery/telecomms/bus/preset_one/birdstation
|
|
name = "Bus"
|
|
autolinkers = list("processor1", "common")
|
|
freq_listening = list()
|