Merge pull request #4081 from Citadel-Station-13/upstream-merge-32914
[MIRROR] [READY]NTnet refactor, assimilates exonet
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#define COMSIG_PARENT_QDELETED "parent_qdeleted" //before a datum's Destroy() is called: ()
|
||||
|
||||
#define COMSIG_COMPONENT_CLEAN_ACT "clean_act" //called on an object to clean it of cleanables. Usualy with soap: (num/strength)
|
||||
#define COMSIG_COMPONENT_NTNET_RECIEVE "ntnet_recieve" //called on an object by its NTNET connection component on recieve. (sending_id(number), sending_netname(text), data(datum/netdata))
|
||||
|
||||
// /atom signals
|
||||
#define COMSIG_PARENT_ATTACKBY "atom_attackby" //from base of atom/attackby(): (/obj/item, /mob/living, params)
|
||||
|
||||
1
code/__DEFINES/networks.dm
Normal file
1
code/__DEFINES/networks.dm
Normal file
@@ -0,0 +1 @@
|
||||
#define HID_RESTRICTED_END 101 //the first nonrestricted ID, automatically assigned on connection creation.
|
||||
@@ -51,9 +51,10 @@
|
||||
#define INIT_ORDER_TICKER 13
|
||||
#define INIT_ORDER_MAPPING 12
|
||||
#define INIT_ORDER_ATOMS 11
|
||||
#define INIT_ORDER_LANGUAGE 10
|
||||
#define INIT_ORDER_MACHINES 9
|
||||
#define INIT_ORDER_CIRCUIT 8
|
||||
#define INIT_ORDER_NETWORKS 10
|
||||
#define INIT_ORDER_LANGUAGE 9
|
||||
#define INIT_ORDER_MACHINES 8
|
||||
#define INIT_ORDER_CIRCUIT 7
|
||||
#define INIT_ORDER_TIMER 1
|
||||
#define INIT_ORDER_DEFAULT 0
|
||||
#define INIT_ORDER_AIR -1
|
||||
@@ -100,4 +101,4 @@
|
||||
A.overlays.Cut();\
|
||||
}\
|
||||
A.flags_1 &= ~OVERLAY_QUEUED_1;\
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,11 @@ PROCESSING_SUBSYSTEM_DEF(circuit)
|
||||
|
||||
var/cipherkey
|
||||
|
||||
var/list/all_exonet_connections = list() //Address = connection datum.
|
||||
var/list/obj/machinery/exonet_node/all_exonet_nodes = list()
|
||||
|
||||
var/list/all_components = list() // Associative list of [component_name]:[component_path] pairs
|
||||
var/list/cached_components = list() // Associative list of [component_path]:[component] pairs
|
||||
var/list/all_assemblies = list() // Associative list of [assembly_name]:[assembly_path] pairs
|
||||
var/list/cached_assemblies = list() // Associative list of [assembly_path]:[assembly] pairs
|
||||
var/list/all_circuits = list() // Associative list of [circuit_name]:[circuit_path] pairs
|
||||
var/list/circuit_fabricator_recipe_list = list() // Associative list of [category_name]:[list_of_circuit_paths] pairs
|
||||
var/cost_multiplier = MINERAL_MATERIAL_AMOUNT / 10 // Each circuit cost unit is 200cm3
|
||||
|
||||
@@ -58,22 +56,3 @@ PROCESSING_SUBSYSTEM_DEF(circuit)
|
||||
/obj/item/device/integrated_electronics/debugger,
|
||||
/obj/item/device/integrated_electronics/analyzer
|
||||
)
|
||||
|
||||
/datum/controller/subsystem/processing/circuit/proc/get_exonet_node()
|
||||
for(var/i in 1 to all_exonet_nodes.len)
|
||||
var/obj/machinery/exonet_node/E = all_exonet_nodes[i]
|
||||
if(E.is_operating())
|
||||
return E
|
||||
|
||||
/datum/controller/subsystem/processing/circuit/proc/get_exonet_address(addr)
|
||||
return all_exonet_connections[addr]
|
||||
|
||||
|
||||
// Proc: get_atom_from_address()
|
||||
// Parameters: 1 (target_address - the desired address to find)
|
||||
// Description: Searches an address for the atom it is attached for, otherwise returns null.
|
||||
|
||||
/datum/controller/subsystem/processing/circuit/proc/get_atom_from_address(var/target_address)
|
||||
var/datum/exonet_protocol/exonet = SScircuit.get_exonet_address(target_address)
|
||||
if(exonet)
|
||||
return exonet.holder
|
||||
36
code/controllers/subsystem/processing/networks.dm
Normal file
36
code/controllers/subsystem/processing/networks.dm
Normal file
@@ -0,0 +1,36 @@
|
||||
PROCESSING_SUBSYSTEM_DEF(networks)
|
||||
name = "Networks"
|
||||
priority = 80
|
||||
wait = 1
|
||||
stat_tag = "NET"
|
||||
flags = SS_KEEP_TIMING
|
||||
init_order = INIT_ORDER_NETWORKS
|
||||
var/datum/ntnet/station/station_network
|
||||
var/assignment_hardware_id = HID_RESTRICTED_END
|
||||
var/list/networks_by_id = list() //id = network
|
||||
var/list/interfaces_by_id = list() //hardware id = component interface
|
||||
|
||||
/datum/controller/subsystem/processing/networks/Initialize()
|
||||
station_network = new
|
||||
station_network.register_map_supremecy()
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/processing/networks/proc/register_network(datum/ntnet/network)
|
||||
if(!networks_by_id[network.network_id])
|
||||
networks_by_id[network.network_id] = network
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/processing/networks/proc/unregister_network(datum/ntnet/network)
|
||||
networks_by_id -= network.network_id
|
||||
return TRUE
|
||||
|
||||
/datum/controller/subsystem/processing/networks/proc/register_interface(datum/component/ntnet_interface/D)
|
||||
if(!interfaces_by_id[D.hardware_id])
|
||||
interfaces_by_id[D.hardware_id] = D
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/processing/networks/proc/unregister_interface(datum/component/ntnet_interface/D)
|
||||
interfaces_by_id -= D.hardware_id
|
||||
return TRUE
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
Exonet Protocol Version 2
|
||||
|
||||
This is designed to be a fairly simple fake-networking system, allowing you to send and receive messages
|
||||
between the exonet_protocol datums, and for atoms to react to those messages, based on the contents of the message.
|
||||
Hopefully, this can evolve to be a more robust fake-networking system and allow for some devious network hacking in the future.
|
||||
|
||||
Version 1 never existed.
|
||||
|
||||
*Setting up*
|
||||
|
||||
To set up the exonet link, define a variable on your desired atom it is like this;
|
||||
var/datum/exonet_protocol/exonet = null
|
||||
Afterwards, before you want to do networking, call exonet = New(src), then exonet.make_address(string), and give it a string to hash into the new IP.
|
||||
The reason it needs a string is so you can have the addresses be persistant, assuming no-one already took it first.
|
||||
|
||||
When you're no longer wanting to use the address and want to free it up, like when you want to Destroy() it, you need to call remove_address()
|
||||
Destroy() also automatically calls remove_address().
|
||||
|
||||
*Sending messages*
|
||||
|
||||
To send a message to another datum, you need to know it's EPv2 (fake IP) address. Once you know that, call send_message(), place your
|
||||
intended address in the first argument, then the message in the second. For example, send_message(exonet.address, "ping") will make you
|
||||
ping yourself.
|
||||
|
||||
*Receiving messages*
|
||||
You don't need to do anything special to receive the messages, other than give your target exonet datum an address as well. Once something hits
|
||||
your datum with send_message(), receive_message() is called, and the default action is to call receive_exonet_message() on the datum's holder.
|
||||
You'll want to override receive_exonet_message() on your atom, and define what will occur when the message is received.
|
||||
The receiving atom will receive the origin atom (the atom that sent the message), the origin address, and finally the message itself.
|
||||
It's suggested to start with an if or switch statement for the message, to determine what to do.
|
||||
*/
|
||||
|
||||
/datum/exonet_protocol
|
||||
var/address = "" //Resembles IPv6, but with only five 'groups', e.g. XXXX:XXXX:XXXX:XXXX:XXXX
|
||||
var/atom/holder
|
||||
|
||||
/datum/exonet_protocol/New(var/atom/H)
|
||||
holder = H
|
||||
|
||||
/datum/exonet_protocol/Destroy()
|
||||
remove_address()
|
||||
holder = null
|
||||
return ..()
|
||||
|
||||
// Proc: make_address()
|
||||
// Parameters: 1 (string - used to make into a hash that will be part of the new address)
|
||||
// Description: Allocates a new address based on the string supplied. It results in consistant addresses for each round assuming it is not already taken..
|
||||
/datum/exonet_protocol/proc/make_address(var/string)
|
||||
if(!string)
|
||||
return
|
||||
var/hex = copytext(md5(string),1,25)
|
||||
if(!hex)
|
||||
return
|
||||
var/addr_1 = copytext(hex,1,5)
|
||||
var/addr_2 = copytext(hex,5,9)
|
||||
var/addr_3 = copytext(hex,9,13)
|
||||
var/addr_4 = copytext(hex,13,17)
|
||||
address = "fc00:[addr_1]:[addr_2]:[addr_3]:[addr_4]"
|
||||
if(SScircuit.all_exonet_connections[address])
|
||||
stack_trace("WARNING: Exonet address collision in make_address. Holder type if applicable is [holder? holder.type : "NO HOLDER"]!")
|
||||
SScircuit.all_exonet_connections[address] = src
|
||||
|
||||
|
||||
// Proc: make_arbitrary_address()
|
||||
// Parameters: 1 (new_address - the desired address)
|
||||
// Description: Allocates that specific address, if it is available.
|
||||
/datum/exonet_protocol/proc/make_arbitrary_address(var/new_address)
|
||||
if(new_address)
|
||||
if(new_address == SScircuit.get_exonet_address(new_address) ) //Collision test.
|
||||
return FALSE
|
||||
address = new_address
|
||||
SScircuit.all_exonet_connections[address] = src
|
||||
return TRUE
|
||||
|
||||
|
||||
// Proc: remove_address()
|
||||
// Parameters: None
|
||||
// Description: Deallocates the address, freeing it for use.
|
||||
/datum/exonet_protocol/proc/remove_address()
|
||||
SScircuit.all_exonet_connections -= address
|
||||
address = ""
|
||||
|
||||
|
||||
|
||||
// Proc: send_message()
|
||||
// Parameters: 3 (target_address - the desired address to send the message to, data_type - text stating what the content is meant to be used for,
|
||||
// content - the actual 'message' being sent to the address)
|
||||
// Description: Sends the message to target_address, by calling receive_message() on the desired datum. Returns true if the message is recieved.
|
||||
/datum/exonet_protocol/proc/send_message(var/target_address, var/data_type, var/content)
|
||||
if(!address)
|
||||
return FALSE
|
||||
var/obj/machinery/exonet_node/node = SScircuit.get_exonet_node()
|
||||
if(!node) // Telecomms went boom, ion storm, etc.
|
||||
return FALSE
|
||||
var/datum/exonet_protocol/exonet = SScircuit.get_exonet_address(target_address)
|
||||
if(exonet)
|
||||
node.write_log(address, target_address, data_type, content)
|
||||
return exonet.receive_message(holder, address, data_type, content)
|
||||
|
||||
// Proc: receive_message()
|
||||
// Parameters: 4 (origin_atom - the origin datum's holder, origin_address - the address the message originated from,
|
||||
// data_type - text stating what the content is meant to be used for, content - the actual 'message' being sent from origin_atom)
|
||||
// Description: Called when send_message() successfully reaches the intended datum. By default, calls receive_exonet_message() on the holder atom.
|
||||
/datum/exonet_protocol/proc/receive_message(var/atom/origin_atom, var/origin_address, var/data_type, var/content)
|
||||
holder.receive_exonet_message(origin_atom, origin_address, data_type, content)
|
||||
return TRUE // for send_message()
|
||||
|
||||
// Proc: receive_exonet_message()
|
||||
// Parameters: 3 (origin_atom - the origin datum's holder, origin_address - the address the message originated from, message - the message that was sent)
|
||||
// Description: Override this to make your atom do something when a message is received.
|
||||
/atom/proc/receive_exonet_message(var/atom/origin_atom, var/origin_address, var/message, var/text)
|
||||
return
|
||||
59
code/datums/components/ntnet_interface.dm
Normal file
59
code/datums/components/ntnet_interface.dm
Normal file
@@ -0,0 +1,59 @@
|
||||
//Thing meant for allowing datums and objects to access a NTnet network datum.
|
||||
/datum/proc/ntnet_recieve(datum/netdata/data)
|
||||
return
|
||||
|
||||
/datum/proc/ntnet_send(datum/netdata/data, netid)
|
||||
GET_COMPONENT(NIC, /datum/component/ntnet_interface)
|
||||
if(!NIC)
|
||||
return FALSE
|
||||
return NIC.__network_send(data, netid)
|
||||
|
||||
/datum/component/ntnet_interface
|
||||
var/hardware_id //text
|
||||
var/network_name = "" //text
|
||||
var/list/networks_connected_by_id = list() //id = datum/ntnet
|
||||
|
||||
/datum/component/ntnet_interface/Initialize(force_ID, force_name = "NTNet Device", autoconnect_station_network = TRUE) //Don't force ID unless you know what you're doing!
|
||||
if(!force_ID)
|
||||
hardware_id = "[SSnetworks.assignment_hardware_id++]"
|
||||
else
|
||||
hardware_id = force_ID
|
||||
network_name = force_name
|
||||
SSnetworks.register_interface(src)
|
||||
if(autoconnect_station_network)
|
||||
register_connection(SSnetworks.station_network)
|
||||
|
||||
/datum/component/ntnet_interface/Destroy()
|
||||
unregister_all_connections()
|
||||
SSnetworks.unregister_interface(src)
|
||||
return ..()
|
||||
|
||||
/datum/component/ntnet_interface/proc/__network_recieve(datum/netdata/data) //Do not directly proccall!
|
||||
parent.SendSignal(COMSIG_COMPONENT_NTNET_RECIEVE, data)
|
||||
parent.ntnet_recieve(data)
|
||||
|
||||
/datum/component/ntnet_interface/proc/__network_send(datum/netdata/data, netid) //Do not directly proccall!
|
||||
if(netid)
|
||||
if(networks_connected_by_id[netid])
|
||||
var/datum/ntnet/net = networks_connected_by_id[netid]
|
||||
return net.process_data_transmit(src, data)
|
||||
return FALSE
|
||||
for(var/i in networks_connected_by_id)
|
||||
var/datum/ntnet/net = networks_connected_by_id[i]
|
||||
net.process_data_transmit(src, data)
|
||||
return TRUE
|
||||
|
||||
/datum/component/ntnet_interface/proc/register_connection(datum/ntnet/net)
|
||||
if(net.interface_connect(src))
|
||||
networks_connected_by_id[net.network_id] = net
|
||||
return TRUE
|
||||
|
||||
/datum/component/ntnet_interface/proc/unregister_all_connections()
|
||||
for(var/i in networks_connected_by_id)
|
||||
unregister_connection(networks_connected_by_id[i])
|
||||
return TRUE
|
||||
|
||||
/datum/component/ntnet_interface/proc/unregister_connection(datum/ntnet/net)
|
||||
net.interface_disconnect(src)
|
||||
networks_connected_by_id -= net.network_id
|
||||
return TRUE
|
||||
@@ -1,106 +0,0 @@
|
||||
/obj/machinery/exonet_node
|
||||
name = "exonet node"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "exonet_node"
|
||||
idle_power_usage = 25
|
||||
var/on = TRUE
|
||||
var/toggle = TRUE
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
circuit = /obj/item/circuitboard/machine/exonet_node
|
||||
max_integrity = 300
|
||||
integrity_failure = 100
|
||||
armor = list("melee" = 20, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 70)
|
||||
desc = "This machine is exonet node."
|
||||
var/list/logs = list() // Gets written to by exonet's send_message() function.
|
||||
var/opened = FALSE
|
||||
|
||||
/obj/machinery/exonet_node/Initialize()
|
||||
. = ..()
|
||||
SScircuit.all_exonet_nodes += src
|
||||
|
||||
/obj/machinery/exonet_node/Destroy()
|
||||
SScircuit.all_exonet_nodes -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/exonet_node/proc/is_operating()
|
||||
return on && !stat
|
||||
|
||||
// Proc: update_icon()
|
||||
// Parameters: None
|
||||
// Description: Self explanatory.
|
||||
/obj/machinery/exonet_node/update_icon()
|
||||
icon_state = "[initial(icon_state)][on? "" : "_off"]"
|
||||
|
||||
// Proc: update_power()
|
||||
// Parameters: None
|
||||
// Description: Sets the device on/off and adjusts power draw based on stat and toggle variables.
|
||||
/obj/machinery/exonet_node/proc/update_power()
|
||||
on = is_operational() && toggle
|
||||
use_power = on
|
||||
update_icon()
|
||||
|
||||
// Proc: emp_act()
|
||||
// Parameters: 1 (severity - how strong the EMP is, with lower numbers being stronger)
|
||||
// Description: Shuts off the machine for awhile if an EMP hits it. Ion anomalies also call this to turn it off.
|
||||
/obj/machinery/exonet_node/emp_act(severity)
|
||||
if(!(stat & EMPED))
|
||||
stat |= EMPED
|
||||
var/duration = (300 * 10)/severity
|
||||
addtimer(CALLBACK(src, /obj/machinery/exonet_node/proc/unemp_act), rand(duration - 20, duration + 20))
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/machinery/exonet_node/proc/unemp_act(severity)
|
||||
stat &= ~EMPED
|
||||
|
||||
// Proc: attackby()
|
||||
// Parameters: 2 (I - the item being whacked against the machine, user - the person doing the whacking)
|
||||
// Description: Handles deconstruction.
|
||||
/obj/machinery/exonet_node/attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
default_deconstruction_screwdriver(user, I)
|
||||
else if(istype(I, /obj/item/crowbar))
|
||||
default_deconstruction_crowbar(user, I)
|
||||
else
|
||||
return ..()
|
||||
|
||||
// Proc: attack_ai()
|
||||
// Parameters: 1 (user - the AI clicking on the machine)
|
||||
// Description: Redirects to attack_hand()
|
||||
/obj/machinery/exonet_node/attack_ai(mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
/obj/machinery/exonet_node/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, var/force_open = 1,datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "exonet_node", name, 600, 300, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/exonet_node/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["toggle"] = toggle
|
||||
data["logs"] = logs
|
||||
return data
|
||||
|
||||
/obj/machinery/exonet_node/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
toggle = !toggle
|
||||
update_power()
|
||||
if(!toggle)
|
||||
investigate_log("has been turned off by [key_name(usr)].", INVESTIGATE_EXONET)
|
||||
. = TRUE
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
|
||||
// Proc: get_exonet_node()
|
||||
// Parameters: None
|
||||
// Description: Helper proc to get a reference to an Exonet node.
|
||||
|
||||
/obj/machinery/exonet_node/proc/write_log(var/origin_address, var/target_address, var/data_type, var/content)
|
||||
var/msg = "[time2text(world.time, "hh:mm:ss")] | FROM [origin_address] TO [target_address] | TYPE: [data_type] | CONTENT: [content]"
|
||||
logs.Add(msg)
|
||||
@@ -193,19 +193,6 @@
|
||||
/obj/item/stack/cable_coil = 1,
|
||||
/obj/item/stock_parts/subspace/filter = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/exonet_node
|
||||
name = "Exonet Node(machine board)"
|
||||
build_path = /obj/machinery/exonet_node
|
||||
origin_tech = "programming=3;engineering=4;bluespace=3;materials=3"
|
||||
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/stock_parts/subspace/crystal = 1,
|
||||
/obj/item/stock_parts/subspace/treatment = 2,
|
||||
/obj/item/stack/cable_coil = 2)
|
||||
|
||||
/obj/item/circuitboard/machine/teleporter_hub
|
||||
name = "Teleporter Hub (Machine Board)"
|
||||
build_path = /obj/machinery/teleport/hub
|
||||
|
||||
29
code/modules/NTNet/netdata.dm
Normal file
29
code/modules/NTNet/netdata.dm
Normal file
@@ -0,0 +1,29 @@
|
||||
/datum/netdata //this requires some thought later on but for now it's fine.
|
||||
var/network_id
|
||||
|
||||
var/list/recipient_ids = list()
|
||||
var/sender_id
|
||||
|
||||
var/plaintext_data
|
||||
var/plaintext_data_secondary
|
||||
var/plaintext_passkey
|
||||
|
||||
/datum/netdata/proc/json_list_generation_admin() //for admin logs and such.
|
||||
. = list()
|
||||
. |= json_list_generation()
|
||||
|
||||
/datum/netdata/proc/json_list_generation()
|
||||
. = list()
|
||||
. |= json_list_generation_netlog()
|
||||
.["network_id"] = network_id
|
||||
|
||||
/datum/netdata/proc/json_list_generation_netlog()
|
||||
. = list()
|
||||
.["recipient_ids"] = recipient_ids
|
||||
.["sender_id"] = sender_id
|
||||
.["plaintext_data"] = plaintext_data
|
||||
.["plaintext_data_secondary"] = plaintext_data_secondary
|
||||
.["plaintext_passkey"] = plaintext_passkey
|
||||
|
||||
/datum/netdata/proc/generate_netlog()
|
||||
return "[json_encode(json_list_generation_netlog())]"
|
||||
@@ -1,8 +1,7 @@
|
||||
GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
|
||||
|
||||
// This is the NTNet datum. There can be only one NTNet datum in game at once. Modular computers read data from this.
|
||||
/datum/ntnet
|
||||
var/network_id = "Network"
|
||||
var/connected_interfaces_by_id = list() //id = datum/component/ntnet_interface
|
||||
|
||||
var/list/relays = list()
|
||||
var/list/logs = list()
|
||||
var/list/available_station_software = list()
|
||||
@@ -14,25 +13,59 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
var/setting_maxlogcount = 100
|
||||
|
||||
// These only affect wireless. LAN (consoles) are unaffected since it would be possible to create scenario where someone turns off NTNet, and is unable to turn it back on since it refuses connections
|
||||
var/setting_softwaredownload = 1
|
||||
var/setting_peertopeer = 1
|
||||
var/setting_communication = 1
|
||||
var/setting_systemcontrol = 1
|
||||
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software.
|
||||
var/setting_softwaredownload = TRUE
|
||||
var/setting_peertopeer = TRUE
|
||||
var/setting_communication = TRUE
|
||||
var/setting_systemcontrol = TRUE
|
||||
var/setting_disabled = FALSE // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = TRUE // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = FALSE // Set when there is an IDS warning due to malicious (antag) software.
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
/datum/ntnet/New()
|
||||
if(GLOB.ntnet_global && (GLOB.ntnet_global != src))
|
||||
GLOB.ntnet_global = src // There can be only one.
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
||||
relays.Add(R)
|
||||
R.NTNet = src
|
||||
/datum/ntnet/New(_netid)
|
||||
build_software_lists()
|
||||
add_log("NTNet logging system activated.")
|
||||
if(_netid)
|
||||
network_id = _netid
|
||||
if(!SSnetworks.register_network(src))
|
||||
stack_trace("Network [type] with ID [network_id] failed to register and has been deleted.")
|
||||
qdel(src)
|
||||
|
||||
/datum/ntnet/proc/interface_connect(datum/component/ntnet_interface/I)
|
||||
connected_interfaces_by_id[I.hardware_id] = I
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/interface_disconnect(datum/component/ntnet_interface/I)
|
||||
connected_interfaces_by_id -= I.hardware_id
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/find_interface_id(id)
|
||||
return connected_interfaces_by_id[id]
|
||||
|
||||
/datum/ntnet/proc/process_data_transmit(datum/component/ntnet_interface/sender, datum/netdata/data)
|
||||
data.network_id = src
|
||||
log_data_transfer(data)
|
||||
if(!check_relay_operation())
|
||||
return FALSE
|
||||
for(var/i in data.recipient_ids)
|
||||
var/datum/component/ntnet_interface/reciever = find_interface_id(i)
|
||||
if(reciever)
|
||||
reciever.__network_recieve(data)
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/check_relay_operation(zlevel) //can be expanded later but right now it's true/false.
|
||||
for(var/i in relays)
|
||||
var/obj/machinery/ntnet_relay/n = i
|
||||
if(zlevel && n.z != zlevel)
|
||||
continue
|
||||
if(n.is_operational())
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/ntnet/proc/log_data_transfer(datum/netdata/data)
|
||||
logs += "[worldtime2text()] - [data.generate_netlog()]"
|
||||
return
|
||||
|
||||
// Simplified logging: Adds a log. log_string is mandatory parameter, source is optional.
|
||||
/datum/ntnet/proc/add_log(log_string, obj/item/computer_hardware/network_card/source = null)
|
||||
@@ -44,7 +77,6 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
log_text += log_string
|
||||
logs.Add(log_text)
|
||||
|
||||
|
||||
// We have too many logs, remove the oldest entries until we get into the limit
|
||||
if(logs.len > setting_maxlogcount)
|
||||
logs = logs.Copy(logs.len-setting_maxlogcount,0)
|
||||
@@ -55,28 +87,23 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
if(!relays || !relays.len) // No relays found. NTNet is down
|
||||
return FALSE
|
||||
|
||||
var/operating = FALSE
|
||||
|
||||
// Check all relays. If we have at least one working relay, network is up.
|
||||
for(var/M in relays)
|
||||
var/obj/machinery/ntnet_relay/R = M
|
||||
if(R.is_operational())
|
||||
operating = TRUE
|
||||
break
|
||||
if(!check_relay_operation())
|
||||
return FALSE
|
||||
|
||||
if(setting_disabled)
|
||||
return FALSE
|
||||
|
||||
switch(specific_action)
|
||||
if(NTNET_SOFTWAREDOWNLOAD)
|
||||
return (operating && setting_softwaredownload)
|
||||
return setting_softwaredownload
|
||||
if(NTNET_PEERTOPEER)
|
||||
return (operating && setting_peertopeer)
|
||||
return setting_peertopeer
|
||||
if(NTNET_COMMUNICATION)
|
||||
return (operating && setting_communication)
|
||||
return setting_communication
|
||||
if(NTNET_SYSTEMCONTROL)
|
||||
return (operating && setting_systemcontrol)
|
||||
return operating
|
||||
return setting_systemcontrol
|
||||
return TRUE
|
||||
|
||||
// Builds lists that contain downloadable software.
|
||||
/datum/ntnet/proc/build_software_lists()
|
||||
@@ -106,7 +133,7 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
|
||||
// Resets the IDS alarm
|
||||
/datum/ntnet/proc/resetIDS()
|
||||
intrusion_detection_alarm = 0
|
||||
intrusion_detection_alarm = FALSE
|
||||
|
||||
/datum/ntnet/proc/toggleIDS()
|
||||
resetIDS()
|
||||
@@ -143,3 +170,11 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
if(NTNET_SYSTEMCONTROL)
|
||||
setting_systemcontrol = !setting_systemcontrol
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|
||||
|
||||
/datum/ntnet/station
|
||||
network_id = "SS13-NTNET"
|
||||
|
||||
/datum/ntnet/station/proc/register_map_supremecy() //called at map init to make this what station networks use.
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
||||
relays.Add(R)
|
||||
R.NTNet = src
|
||||
@@ -17,7 +17,6 @@
|
||||
var/uid
|
||||
var/static/gl_uid = 1
|
||||
|
||||
|
||||
// Denial of Service attack variables
|
||||
var/dos_overload = 0 // Amount of DoS "packets" in this relay's buffer
|
||||
var/dos_capacity = 500 // Amount of DoS "packets" in buffer required to crash the relay
|
||||
@@ -27,12 +26,12 @@
|
||||
// TODO: Implement more logic here. For now it's only a placeholder.
|
||||
/obj/machinery/ntnet_relay/is_operational()
|
||||
if(stat & (BROKEN | NOPOWER | EMPED))
|
||||
return 0
|
||||
return FALSE
|
||||
if(dos_failure)
|
||||
return 0
|
||||
return FALSE
|
||||
if(!enabled)
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/ntnet_relay/update_icon()
|
||||
if(is_operational())
|
||||
@@ -55,12 +54,12 @@
|
||||
if((dos_overload > dos_capacity) && !dos_failure)
|
||||
dos_failure = 1
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
// If the DoS buffer reaches 0 again, restart.
|
||||
if((dos_overload == 0) && dos_failure)
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
..()
|
||||
|
||||
/obj/machinery/ntnet_relay/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
@@ -89,13 +88,12 @@
|
||||
dos_overload = 0
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
if("toggle")
|
||||
enabled = !enabled
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
SSnetworks.station_network.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/ntnet_relay/attack_hand(mob/living/user)
|
||||
ui_interact(user)
|
||||
|
||||
@@ -103,16 +101,16 @@
|
||||
uid = gl_uid++
|
||||
component_parts = list()
|
||||
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Add(src)
|
||||
NTNet = GLOB.ntnet_global
|
||||
GLOB.ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.relays.Add(src)
|
||||
NTNet = SSnetworks.station_network
|
||||
SSnetworks.station_network.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/ntnet_relay/Destroy()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Remove(src)
|
||||
GLOB.ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.relays.Remove(src)
|
||||
SSnetworks.station_network.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
NTNet = null
|
||||
|
||||
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
|
||||
@@ -543,55 +543,55 @@
|
||||
for(var/mob/O in hearers(1, get_turf(src)))
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep*", null, 1)
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2
|
||||
name = "EPv2 circuit"
|
||||
desc = "Enables the sending and receiving of messages on the Exonet with the EPv2 protocol."
|
||||
extended_desc = "An EPv2 address is a string with the format of XXXX:XXXX:XXXX:XXXX. Data can be send or received using the \
|
||||
/obj/item/integrated_circuit/input/ntnet_packet
|
||||
name = "NTNet networking circuit"
|
||||
desc = "Enables the sending and receiving of messages on NTNet with packet data protocol."
|
||||
extended_desc = "Data can be send or received using the \
|
||||
second pin on each side, with additonal data reserved for the third pin. When a message is received, the second activation pin \
|
||||
will pulse whatever's connected to it. Pulsing the first activation pin will send a message."
|
||||
icon_state = "signal"
|
||||
complexity = 4
|
||||
inputs = list(
|
||||
"target EPv2 address" = IC_PINTYPE_STRING,
|
||||
"target NTNet address" = IC_PINTYPE_STRING,
|
||||
"data to send" = IC_PINTYPE_STRING,
|
||||
"secondary text" = IC_PINTYPE_STRING
|
||||
"secondary text" = IC_PINTYPE_STRING,
|
||||
"passkey" = IC_PINTYPE_STRING, //No this isn't a real passkey encryption scheme but that's why you keep your nodes secure so no one can find it out!
|
||||
)
|
||||
outputs = list(
|
||||
"address received" = IC_PINTYPE_STRING,
|
||||
"data received" = IC_PINTYPE_STRING,
|
||||
"secondary text received" = IC_PINTYPE_STRING
|
||||
"secondary text received" = IC_PINTYPE_STRING,
|
||||
"passkey" = IC_PINTYPE_STRING
|
||||
)
|
||||
activators = list("send data" = IC_PINTYPE_PULSE_IN, "on data received" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2)
|
||||
power_draw_per_use = 50
|
||||
var/datum/exonet_protocol/exonet = null
|
||||
var/datum/ntnet_connection/exonet = null
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/New()
|
||||
..()
|
||||
exonet = new(src)
|
||||
exonet.make_address("EPv2_circuit-[REF(src)]")
|
||||
desc += "<br>This circuit's EPv2 address is: [exonet.address]"
|
||||
/obj/item/integrated_circuit/input/ntnet_packet/Initialize()
|
||||
. = ..()
|
||||
var/datum/component/ntnet_interface/net = LoadComponent(/datum/component/ntnet_interface)
|
||||
desc += "<br>This circuit's NTNet hardware address is: [net.hardware_id]"
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/Destroy()
|
||||
if(exonet)
|
||||
exonet.remove_address()
|
||||
qdel(exonet)
|
||||
exonet = null
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/do_work()
|
||||
/obj/item/integrated_circuit/input/ntnet_packet/do_work()
|
||||
var/target_address = get_pin_data(IC_INPUT, 1)
|
||||
var/message = get_pin_data(IC_INPUT, 2)
|
||||
var/text = get_pin_data(IC_INPUT, 3)
|
||||
var/key = get_pin_data(IC_INPUT, 4)
|
||||
|
||||
if(target_address && istext(target_address))
|
||||
exonet.send_message(target_address, message, text)
|
||||
var/datum/netdata/data = new
|
||||
data.recipient_ids += target_address
|
||||
data.plaintext_data = message
|
||||
data.plaintext_data_secondary = text
|
||||
data.plaintext_passkey = key
|
||||
ntnet_send(data)
|
||||
|
||||
/obj/item/integrated_circuit/input/receive_exonet_message(var/atom/origin_atom, var/origin_address, var/message, var/text)
|
||||
set_pin_data(IC_OUTPUT, 1, origin_address)
|
||||
set_pin_data(IC_OUTPUT, 2, message)
|
||||
set_pin_data(IC_OUTPUT, 3, text)
|
||||
/obj/item/integrated_circuit/input/ntnet_recieve(datum/netdata/data)
|
||||
set_pin_data(IC_OUTPUT, 1, length(data.recipient_ids) >= 1? data.recipient_ids[1] : null)
|
||||
set_pin_data(IC_OUTPUT, 2, data.plaintext_data)
|
||||
set_pin_data(IC_OUTPUT, 3, data.plaintext_data_secondary)
|
||||
set_pin_data(IC_OUTPUT, 4, data.plaintext_passkey)
|
||||
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
/datum/ntnet_conversation/New()
|
||||
id = ntnrc_uid++
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.chat_channels.Add(src)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.chat_channels.Add(src)
|
||||
..()
|
||||
|
||||
/datum/ntnet_conversation/Destroy()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.chat_channels.Remove(src)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.chat_channels.Remove(src)
|
||||
return ..()
|
||||
|
||||
/datum/ntnet_conversation/proc/add_message(message, username)
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
if(!get_ntnet_status())
|
||||
return FALSE
|
||||
var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET]
|
||||
return GLOB.ntnet_global.add_log(text, network_card)
|
||||
return SSnetworks.station_network.add_log(text, network_card)
|
||||
|
||||
/obj/item/device/modular_computer/proc/shutdown_computer(loud = 1)
|
||||
kill_program(forced = TRUE)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
return 1
|
||||
switch(action)
|
||||
if("PRG_target_relay")
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
if("[R.uid]" == params["targid"])
|
||||
target = R
|
||||
return 1
|
||||
@@ -61,14 +61,14 @@
|
||||
if(target)
|
||||
executed = 1
|
||||
target.dos_sources.Add(src)
|
||||
if(GLOB.ntnet_global.intrusion_detection_enabled)
|
||||
if(SSnetworks.station_network.intrusion_detection_enabled)
|
||||
var/obj/item/computer_hardware/network_card/network_card = computer.all_components[MC_NET]
|
||||
GLOB.ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
|
||||
GLOB.ntnet_global.intrusion_detection_alarm = 1
|
||||
SSnetworks.station_network.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
|
||||
SSnetworks.station_network.intrusion_detection_alarm = 1
|
||||
return 1
|
||||
|
||||
/datum/computer_file/program/ntnet_dos/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return
|
||||
|
||||
var/list/data = list()
|
||||
@@ -93,7 +93,7 @@
|
||||
data["dos_strings"] += list(list("nums" = string))
|
||||
else
|
||||
data["relays"] = list()
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
data["relays"] += list(list("id" = R.uid))
|
||||
data["focus"] = target ? target.uid : null
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
if(downloaded_file)
|
||||
return 0
|
||||
|
||||
var/datum/computer_file/program/PRG = GLOB.ntnet_global.find_ntnet_file_by_name(filename)
|
||||
var/datum/computer_file/program/PRG = SSnetworks.station_network.find_ntnet_file_by_name(filename)
|
||||
|
||||
if(!PRG || !istype(PRG))
|
||||
return 0
|
||||
@@ -39,10 +39,10 @@
|
||||
|
||||
ui_header = "downloader_running.gif"
|
||||
|
||||
if(PRG in GLOB.ntnet_global.available_station_software)
|
||||
if(PRG in SSnetworks.station_network.available_station_software)
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
|
||||
hacked_download = 0
|
||||
else if(PRG in GLOB.ntnet_global.available_antag_software)
|
||||
else if(PRG in SSnetworks.station_network.available_antag_software)
|
||||
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 1
|
||||
else
|
||||
@@ -127,7 +127,7 @@
|
||||
data["disk_size"] = hard_drive.max_capacity
|
||||
data["disk_used"] = hard_drive.used_capacity
|
||||
var/list/all_entries[0]
|
||||
for(var/A in GLOB.ntnet_global.available_station_software)
|
||||
for(var/A in SSnetworks.station_network.available_station_software)
|
||||
var/datum/computer_file/program/P = A
|
||||
// Only those programs our user can run will show in the list
|
||||
if(!P.can_run(user,transfer = 1) || hard_drive.find_file_by_name(P.filename))
|
||||
@@ -142,7 +142,7 @@
|
||||
data["hackedavailable"] = 0
|
||||
if(computer.emagged) // If we are running on emagged computer we have access to some "bonus" software
|
||||
var/list/hacked_programs[0]
|
||||
for(var/S in GLOB.ntnet_global.available_antag_software)
|
||||
for(var/S in SSnetworks.station_network.available_antag_software)
|
||||
var/datum/computer_file/program/P = S
|
||||
if(hard_drive.find_file_by_name(P.filename))
|
||||
continue
|
||||
|
||||
@@ -15,22 +15,22 @@
|
||||
switch(action)
|
||||
if("resetIDS")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.resetIDS()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.resetIDS()
|
||||
return 1
|
||||
if("toggleIDS")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.toggleIDS()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.toggleIDS()
|
||||
return 1
|
||||
if("toggleWireless")
|
||||
. = 1
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
|
||||
// NTNet is disabled. Enabling can be done without user prompt
|
||||
if(GLOB.ntnet_global.setting_disabled)
|
||||
GLOB.ntnet_global.setting_disabled = 0
|
||||
if(SSnetworks.station_network.setting_disabled)
|
||||
SSnetworks.station_network.setting_disabled = 0
|
||||
return 1
|
||||
|
||||
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
|
||||
@@ -39,43 +39,43 @@
|
||||
return 1
|
||||
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
GLOB.ntnet_global.setting_disabled = 1
|
||||
SSnetworks.station_network.setting_disabled = 1
|
||||
return 1
|
||||
if("purgelogs")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.purge_logs()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.purge_logs()
|
||||
if("updatemaxlogs")
|
||||
. = 1
|
||||
var/mob/user = usr
|
||||
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.update_max_log_count(logcount)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.update_max_log_count(logcount)
|
||||
if("toggle_function")
|
||||
. = 1
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
GLOB.ntnet_global.toggle_function(text2num(params["id"]))
|
||||
SSnetworks.station_network.toggle_function(text2num(params["id"]))
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return
|
||||
var/list/data = get_header_data()
|
||||
|
||||
data["ntnetstatus"] = GLOB.ntnet_global.check_function()
|
||||
data["ntnetrelays"] = GLOB.ntnet_global.relays.len
|
||||
data["idsstatus"] = GLOB.ntnet_global.intrusion_detection_enabled
|
||||
data["idsalarm"] = GLOB.ntnet_global.intrusion_detection_alarm
|
||||
data["ntnetstatus"] = SSnetworks.station_network.check_function()
|
||||
data["ntnetrelays"] = SSnetworks.station_network.relays.len
|
||||
data["idsstatus"] = SSnetworks.station_network.intrusion_detection_enabled
|
||||
data["idsalarm"] = SSnetworks.station_network.intrusion_detection_alarm
|
||||
|
||||
data["config_softwaredownload"] = GLOB.ntnet_global.setting_softwaredownload
|
||||
data["config_peertopeer"] = GLOB.ntnet_global.setting_peertopeer
|
||||
data["config_communication"] = GLOB.ntnet_global.setting_communication
|
||||
data["config_systemcontrol"] = GLOB.ntnet_global.setting_systemcontrol
|
||||
data["config_softwaredownload"] = SSnetworks.station_network.setting_softwaredownload
|
||||
data["config_peertopeer"] = SSnetworks.station_network.setting_peertopeer
|
||||
data["config_communication"] = SSnetworks.station_network.setting_communication
|
||||
data["config_systemcontrol"] = SSnetworks.station_network.setting_systemcontrol
|
||||
|
||||
data["ntnetlogs"] = list()
|
||||
|
||||
for(var/i in GLOB.ntnet_global.logs)
|
||||
for(var/i in SSnetworks.station_network.logs)
|
||||
data["ntnetlogs"] += list(list("entry" = i))
|
||||
data["ntnetmaxlogs"] = GLOB.ntnet_global.setting_maxlogcount
|
||||
data["ntnetmaxlogs"] = SSnetworks.station_network.setting_maxlogcount
|
||||
|
||||
return data
|
||||
@@ -39,7 +39,7 @@
|
||||
if("PRG_joinchannel")
|
||||
. = 1
|
||||
var/datum/ntnet_conversation/C
|
||||
for(var/datum/ntnet_conversation/chan in GLOB.ntnet_global.chat_channels)
|
||||
for(var/datum/ntnet_conversation/chan in SSnetworks.station_network.chat_channels)
|
||||
if(chan.id == text2num(params["id"]))
|
||||
C = chan
|
||||
break
|
||||
@@ -183,7 +183,7 @@
|
||||
..()
|
||||
|
||||
/datum/computer_file/program/chatclient/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global || !GLOB.ntnet_global.chat_channels)
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.chat_channels)
|
||||
return
|
||||
|
||||
var/list/data = list()
|
||||
@@ -212,7 +212,7 @@
|
||||
|
||||
else // Channel selection screen
|
||||
var/list/all_channels[0]
|
||||
for(var/C in GLOB.ntnet_global.chat_channels)
|
||||
for(var/C in SSnetworks.station_network.chat_channels)
|
||||
var/datum/ntnet_conversation/conv = C
|
||||
if(conv && conv.title)
|
||||
all_channels.Add(list(list(
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
return 1
|
||||
switch(action)
|
||||
if("PRG_downloadfile")
|
||||
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
|
||||
for(var/datum/computer_file/program/nttransfer/P in SSnetworks.station_network.fileservers)
|
||||
if("[P.unique_token]" == params["id"])
|
||||
remote = P
|
||||
break
|
||||
@@ -106,8 +106,8 @@
|
||||
error = ""
|
||||
upload_menu = 0
|
||||
finalize_download()
|
||||
if(src in GLOB.ntnet_global.fileservers)
|
||||
GLOB.ntnet_global.fileservers.Remove(src)
|
||||
if(src in SSnetworks.station_network.fileservers)
|
||||
SSnetworks.station_network.fileservers.Remove(src)
|
||||
for(var/datum/computer_file/program/nttransfer/T in connected_clients)
|
||||
T.crash_download("Remote server has forcibly closed the connection")
|
||||
provided_file = null
|
||||
@@ -133,7 +133,7 @@
|
||||
if(!P.can_run(usr,transfer = 1))
|
||||
error = "Access Error: Insufficient rights to upload file."
|
||||
provided_file = F
|
||||
GLOB.ntnet_global.fileservers.Add(src)
|
||||
SSnetworks.station_network.fileservers.Add(src)
|
||||
return
|
||||
error = "I/O Error: Unable to locate file on hard drive."
|
||||
return 1
|
||||
@@ -171,7 +171,7 @@
|
||||
data["upload_filelist"] = all_files
|
||||
else
|
||||
var/list/all_servers[0]
|
||||
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
|
||||
for(var/datum/computer_file/program/nttransfer/P in SSnetworks.station_network.fileservers)
|
||||
all_servers.Add(list(list(
|
||||
"uid" = P.unique_token,
|
||||
"filename" = "[P.provided_file.filename].[P.provided_file.filetype]",
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if(ethernet) // Computer is connected via wired connection.
|
||||
return 3
|
||||
|
||||
if(!GLOB.ntnet_global || !GLOB.ntnet_global.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return 0
|
||||
|
||||
if(holder)
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
build_path = /obj/item/circuitboard/machine/telecomms/receiver
|
||||
category = list("Subspace Telecomms")
|
||||
|
||||
/datum/design/board/exonet_node
|
||||
name = "Machine Design (Exonet Node)"
|
||||
desc = "Allows for the construction of Exonet Node."
|
||||
id = "e-node"
|
||||
req_tech = list("programming" = 2, "engineering" = 3, "bluespace" = 1)
|
||||
build_path = /obj/item/circuitboard/machine/exonet_node
|
||||
category = list("Subspace Telecomms")
|
||||
|
||||
/datum/design/board/telecomms_bus
|
||||
name = "Machine Design (Bus Mainframe)"
|
||||
desc = "Allows for the construction of Telecommunications Bus Mainframes."
|
||||
|
||||
Reference in New Issue
Block a user