networks

Vars | |
area_network_lookup | Area to network, network to area list This is an associated list to quickly find an area using either its id or network Used mainly to make sure all area id's are unique even if a mapper uses the same area many times |
---|---|
interfaces_by_hardware_id | all interfaces by their hardware address. Do NOT use to verify a reciver_id is valid, use the network.root_devices for that |
networks | List of networks using their fully qualified network name. Used for quick lookups of networks for sending packets |
root_networks | List of the root networks starting at their root names. Used to find and/or build network tress |
station_network | Legacy ntnet lookup for software. Should be changed latter so don't rely on this being here. |
used_names | Random name search to make sure we have unique names. DO NOT REMOVE NAMES HERE UNLESS YOU KNOW WHAT YOUR DOING |
Procs | |
PreInit | You shouldn't need to do this. But mapping is async and there is no guarantee that Initialize will run before these networks are dynamically created. So its here. |
_hard_create_network | Hard creates a network. Helper function for create_network_simple and create_network |
add_log | Records a message into the station logging system for the network |
assign_area_network_id | Check if the area is valid and if it doesn't have a network root id. If we are a ruin or a shuttle, we get our own network if we have a template, try to get the network id from the template |
assign_random_name | Generate a name devices |
create_network | Checks to make sure the network is valid. We log BOTH to mapping and telecoms so if your checking for network errors you can find it in mapping to (because its their fault!) Creates or finds a network anywhere in the world using bits of text |
create_network_simple | Creates or finds a network anywhere in the world using a fully qualified name |
fire | Used only for sending NAK/ACK and error reply's Check if the network_id is valid and if not send an error and return Check if the receiver_id is in the network. If not send an error and return |
get_next_HID | Generate a hardware id for devices. |
lookup_area_root_id | Gives an area a root and a network_area_id |
network_list_to_string | Converts a list of string's into a full network_id |
network_string_to_list | Converts string into a list of network branches |
purge_logs | Removes all station logs for the current game |
stat_entry | Limbo network needs to be made at boot up for all error devices As well as the station network incase something funny goes during startup |
transmit | Check if we are a list. If so process the list |
update_max_log_count | Updates the maximum amount of logs and purges those that go beyond that number |
Var Details
area_network_lookup

Area to network, network to area list This is an associated list to quickly find an area using either its id or network Used mainly to make sure all area id's are unique even if a mapper uses the same area many times
interfaces_by_hardware_id

all interfaces by their hardware address. Do NOT use to verify a reciver_id is valid, use the network.root_devices for that
networks

List of networks using their fully qualified network name. Used for quick lookups of networks for sending packets
root_networks

List of the root networks starting at their root names. Used to find and/or build network tress
station_network

Legacy ntnet lookup for software. Should be changed latter so don't rely on this being here.
used_names

Random name search to make sure we have unique names. DO NOT REMOVE NAMES HERE UNLESS YOU KNOW WHAT YOUR DOING
Proc Details
PreInit
You shouldn't need to do this. But mapping is async and there is no guarantee that Initialize will run before these networks are dynamically created. So its here.
_hard_create_network
Hard creates a network. Helper function for create_network_simple and create_network
Hard creates a using a list of branches and returns. No error checking as it should of been done before this call
Arguments:
- network_tree - list,text List of branches of network
add_log
Records a message into the station logging system for the network
This CAN be read in station by personal so do not use it for game debugging during fire. At this point data.receiver_id has already been converted if it was a broadcast but is undefined in this function. It is also dumped to normal logs but remember players can read/intercept these messages Arguments:
- log_string - message to log
- network - optional, It can be a ntnet or just the text equivalent
- hardware_id = optional, text, will look it up and return with the parent.name as well
assign_area_network_id
Check if the area is valid and if it doesn't have a network root id. If we are a ruin or a shuttle, we get our own network if we have a template, try to get the network id from the template
assign_random_name
Generate a name devices
Creates a randomly generated tag or name for devices or anything really it keeps track of a special list that makes sure no name is used more than once
args:
- len (int)(Optional) Default=5 The length of the name
- prefix (string)(Optional) static text in front of the random name
- postfix (string)(Optional) static text in back of the random name Returns (string) The generated name
create_network
Checks to make sure the network is valid. We log BOTH to mapping and telecoms so if your checking for network errors you can find it in mapping to (because its their fault!) Creates or finds a network anywhere in the world using bits of text
This works the same as create_network_simple however it allows the addition of qualified network names. So you can call it with a root_id and a sub network. However this function WILL return null if it cannot be created so it should be used with error checking is involved.
ex. create_network("ROOT_NETWORK", "ATMOS.SCRUBBERS") -> ROOT_NETWORK.ATMOS.SCRUBBERS
Arguments:
- tree - List of string
create_network_simple
Creates or finds a network anywhere in the world using a fully qualified name
This is the simple case finding of a network in the world. It must take a full qualified network name and it will either return an existing network or build a new one from scratch. We must be able to create names on the fly as there is no way for the map loader to tell us ahead of time what networks to create or use for any maps or templates. So this thing will throw silent mapping errors and log them, but will always return a network for something.
Arguments:
- network_id - text, Fully qualified network name
fire
Used only for sending NAK/ACK and error reply's Check if the network_id is valid and if not send an error and return Check if the receiver_id is in the network. If not send an error and return
get_next_HID
Generate a hardware id for devices.
Creates a 32 bit hardware id for network devices. This is random so masking the number won't make routing "easier" (Think Ethernet) It does check if an existing device has the number but will NOT assign it as thats up to the collar
Returns (string) The generated name
lookup_area_root_id
Gives an area a root and a network_area_id
When a device is added to the network on map load, it needs to know where it is. So that it is added to that ruins/base's network instead of the general station network This way people on the station cannot just hack Charlie's doors and visa versa. All area's "should" have this information and if not one is created from existing map tags or ruin template id's. This SHOULD run before the Initialize of a atom, or the root will not be put in the object.area
An example on what the area.network_root_id does/ Before Init: obj.network_id = "ATMOS.SCRUBBER" area.network_root_id="SS13_STATION" area.network_area_id = "BRIDGE" After Init: obj.network_id = "SS13_STATION.ATMOS.SCRUBBER" also obj.network_id = "SS13_STATION.AREA.BRIDGE"
Arguments:
- area - Area to modify the root id.
- template - optional, map_template of that area
network_list_to_string
Converts a list of string's into a full network_id
Converts a list of individual branches into a proper network id. Validates individual parts to make sure they are clean.
ex. list("A","B","C") -> A.B.C
Arguments:
- tree - List of strings
network_string_to_list
Converts string into a list of network branches
Converts a a proper network id into a list of the individual branches
ex. A.B.C -> list("A","B","C")
Arguments:
- tree - List of strings
purge_logs
Removes all station logs for the current game
stat_entry
Limbo network needs to be made at boot up for all error devices As well as the station network incase something funny goes during startup
transmit
Check if we are a list. If so process the list
update_max_log_count
Updates the maximum amount of logs and purges those that go beyond that number
Shouldn't been needed to be run by players but maybe admins need it? Arguments:
- lognumber - new setting_maxlogcount count