Skip to content

Commit

Permalink
removes ntnet (#448)
Browse files Browse the repository at this point in the history
* removes ntnet

* save the (string) trees
  • Loading branch information
francinum authored Aug 4, 2023
1 parent 26bec12 commit c90688b
Show file tree
Hide file tree
Showing 39 changed files with 125 additions and 1,620 deletions.
2 changes: 0 additions & 2 deletions _maps/RandomRuins/SpaceRuins/thelizardsgas.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
/obj/machinery/power/apc/auto_name/directional/north{
coverlocked = 0;
locked = 0;
network_id = null;
start_charge = 60
},
/obj/structure/cable,
Expand Down Expand Up @@ -335,7 +334,6 @@
"Io" = (
/obj/machinery/power/smes{
charge = 2e+006;
network_id = null;
output_level = 0
},
/obj/structure/cable,
Expand Down
2 changes: 0 additions & 2 deletions _maps/map_files/debug/atmos_mintest.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@
/obj/item/pipe_dispenser,
/obj/structure/table/reinforced,
/obj/item/debug/omnitool,
/obj/item/door_remote/omni,
/turf/open/floor/iron,
/area/station/hallway/primary/central)
"be" = (
Expand Down Expand Up @@ -462,7 +461,6 @@
"bH" = (
/obj/structure/table/reinforced,
/obj/item/debug/omnitool,
/obj/item/door_remote/omni,
/turf/open/floor/iron,
/area/station/hallway/primary/central)
"bI" = (
Expand Down
94 changes: 0 additions & 94 deletions code/__DEFINES/networks.dm

This file was deleted.

90 changes: 90 additions & 0 deletions code/controllers/subsystem/networks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
SUBSYSTEM_DEF(networks)
name = "Networks"
wait = 5
flags = SS_KEEP_TIMING|SS_NO_FIRE
init_order = INIT_ORDER_NETWORKS

var/list/relays = list()
/// Legacy ntnet lookup for software.
var/datum/ntnet/station_root/station_network

// Logs moved here
// Amount of logs the system tries to keep in memory. Keep below 999 to prevent byond from acting weirdly.
// High values make displaying logs much laggier.
var/setting_maxlogcount = 100
var/list/logs = list()

/// Random name search for
/// DO NOT REMOVE NAMES HERE UNLESS YOU KNOW WHAT YOUR DOING
var/list/used_names = list()

/datum/controller/subsystem/networks/PreInit()
//We retain this structure for ModComp.
station_network = new

/datum/controller/subsystem/networks/Initialize()
station_network.build_software_lists()
return ..()

/datum/controller/subsystem/networks/proc/check_relay_operation(zlevel=0) //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

/**
* 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
* * hardware_id = optional, text, Blindly stapled to the end.
*/
/datum/controller/subsystem/networks/proc/add_log(log_string, hardware_id = null)
set waitfor = FALSE // so process keeps running
var/list/log_text = list()
log_text += "\[[stationtime2text()]\]"

if(hardware_id)
log_text += "([hardware_id])"
else
log_text += "*SYSTEM*"
log_text += " - "
log_text += log_string
log_string = log_text.Join()

logs.Add(log_string)
//log_telecomms("NetLog: [log_string]") // causes runtime on startup humm

// 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)


/**
* Removes all station logs for the current game
*/
/datum/controller/subsystem/networks/proc/purge_logs()
logs = list()
add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-")

/**
* 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
*/
/datum/controller/subsystem/networks/proc/update_max_log_count(lognumber)
if(!lognumber)
return FALSE
// Trim the value if necessary
lognumber = max(MIN_NTNET_LOGS, min(lognumber, MAX_NTNET_LOGS))
setting_maxlogcount = lognumber
add_log("Configuration Updated. Now keeping [setting_maxlogcount] logs in system memory.")
8 changes: 8 additions & 0 deletions code/controllers/subsystem/packetnets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ SUBSYSTEM_DEF(packets)
///What processing stage we're at
var/stage = SSPACKETS_POWERNETS

/// Generates a unique (at time of read) ID for an atom, It just plays silly with the ref.
/// Pass the target atom in as arg[1]
/datum/controller/subsystem/packets/proc/generate_net_id(caller)
if(!caller)
CRASH("Attempted to generate netid for null")
. = REF(caller)
. = "[copytext(.,4,(length(.)))]0"

/datum/controller/subsystem/packets/PreInit(timeofday)
hibernate_checks = list(
NAMEOF(src, queued_networks),
Expand Down
Loading

0 comments on commit c90688b

Please sign in to comment.