mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-16 20:52:33 +00:00
* Adds a modular computer subsystem to shift modPCs away from radios (#71732) ## About The Pull Request Adds the modular computer subsystem which is meant to replace mod PC's reliance on networks and radios, specifically the network subsystem, the ntnet interface, and /datum/ntnet. This PR removes station_root ntnets entirely, but I tried to keep it small. This PR also removes a ton of unused vars and defines, such as NTNet channels that were unused (peer2peer and systemcontrol), atmos networks (as they were removed a while ago) and NTNet var on relays (its stated purpose is so admins can see it through varedits, but that's useless now that it's a subsystem) I also removed ``setting_disabled`` as a thing the RD can do, it turned off ALL ntnet systems. However, this was when there were 4 different ones, now that there's only 2 I thought it was redundant and he could just click 2 buttons to close them. ## Why It's Good For The Game ``/datum/ntnet``, ``/datum/component/ntnet_interface``, and ``/datum/controller/subsystem/networks`` are all old-code messes that depend on eachother and is hard for people to understand what exactly it adds to the game. 90% of its features is allowing the Wirecarp app to see all the ruins that spawned in-game, which I don't think is something that we even WANT (why does the RD need to know that oldstation spawned? Why should they know this anyway??) This hopefully starts to simplify networks/ntnet to make it easier to remove in the future, because surely there are better alternatives than **this** ## Changelog 🆑 refactor: Modular computers NTnet and applications run on its own subsystem, please report any new bugs you may find. /🆑 * Adds a modular computer subsystem to shift modPCs away from radios * Fixed contractor uplink Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: tastyfish <crazychris32@gmail.com>
90 lines
3.6 KiB
Plaintext
90 lines
3.6 KiB
Plaintext
SUBSYSTEM_DEF(modular_computers)
|
|
name = "Modular Computers"
|
|
flags = SS_NO_FIRE
|
|
|
|
///List of all programs available to download from the NTNet store.
|
|
var/list/available_station_software = list()
|
|
///List of all programs that can be downloaded from an emagged NTNet store.
|
|
var/list/available_antag_software = list()
|
|
///List of all chat channels created by Chat Client.
|
|
var/list/chat_channels = list()
|
|
|
|
///Boolean on whether downloading software works.
|
|
var/setting_softwaredownload = TRUE
|
|
///Boolean on whether downloading communication apps like the Chat client works.
|
|
var/setting_communication = TRUE
|
|
|
|
///Boolean on whether the IDS warning system is enabled
|
|
var/intrusion_detection_enabled = TRUE
|
|
///Boolean to show a message warning if there's an active intrusion for Wirecarp users.
|
|
var/intrusion_detection_alarm = FALSE
|
|
|
|
///List of all available NTNet relays.
|
|
var/list/obj/machinery/ntnet_relay/ntnet_relays = list()
|
|
|
|
/datum/controller/subsystem/modular_computers/Initialize()
|
|
build_software_lists()
|
|
initialized = TRUE
|
|
return SS_INIT_SUCCESS
|
|
|
|
///Finds all downloadable programs and adds them to their respective downloadable list.
|
|
/datum/controller/subsystem/modular_computers/proc/build_software_lists()
|
|
for(var/datum/computer_file/program/prog as anything in subtypesof(/datum/computer_file/program))
|
|
// Has no TGUI file so is not meant to be a downloadable thing.
|
|
if(!initial(prog.tgui_id))
|
|
continue
|
|
prog = new prog
|
|
|
|
if(prog.available_on_ntnet)
|
|
available_station_software.Add(prog)
|
|
if(prog.available_on_syndinet)
|
|
available_antag_software.Add(prog)
|
|
|
|
///Checks if at least one ntnet relay is functional.
|
|
/datum/controller/subsystem/modular_computers/proc/check_relay_operation()
|
|
for(var/obj/machinery/ntnet_relay/relays as anything in ntnet_relays)
|
|
if(!relays.is_operational)
|
|
continue
|
|
return TRUE
|
|
return FALSE
|
|
|
|
/datum/controller/subsystem/modular_computers/proc/toggle_function(function)
|
|
if(!function)
|
|
return
|
|
function = text2num(function)
|
|
switch(function)
|
|
if(NTNET_SOFTWAREDOWNLOAD)
|
|
setting_softwaredownload = !setting_softwaredownload
|
|
SSnetworks.add_log("Configuration Updated. Wireless network firewall now [setting_softwaredownload ? "allows" : "disallows"] connection to software repositories.")
|
|
if(NTNET_COMMUNICATION)
|
|
setting_communication = !setting_communication
|
|
SSnetworks.add_log("Configuration Updated. Wireless network firewall now [setting_communication ? "allows" : "disallows"] instant messaging and similar communication services.")
|
|
|
|
///Checks whether NTNet is available for a specific function, checking NTNet relays and shutdowns. If none is passed, none is needed.
|
|
/datum/controller/subsystem/modular_computers/proc/check_function(specific_action = NONE)
|
|
// No relays found. NTNet is down
|
|
if(!length(ntnet_relays))
|
|
return FALSE
|
|
// Check all relays. If we have at least one working relay, network is up.
|
|
if(!check_relay_operation())
|
|
return FALSE
|
|
|
|
switch(specific_action)
|
|
if(NTNET_SOFTWAREDOWNLOAD)
|
|
return setting_softwaredownload
|
|
if(NTNET_COMMUNICATION)
|
|
return setting_communication
|
|
return TRUE
|
|
|
|
///Attempts to find a new file through searching the available stores with its name.
|
|
/datum/controller/subsystem/modular_computers/proc/find_ntnet_file_by_name(filename)
|
|
for(var/datum/computer_file/program/programs as anything in available_station_software + available_antag_software)
|
|
if(filename == programs.filename)
|
|
return programs
|
|
|
|
///Attempts to find a chatorom using the ID of the channel.
|
|
/datum/controller/subsystem/modular_computers/proc/get_chat_channel_by_id(id)
|
|
for(var/datum/ntnet_conversation/chan as anything in chat_channels)
|
|
if(chan.id == id)
|
|
return chan
|