mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-22 06:35:12 +01:00
79bb4facfc
* Removes networks from the game (#74142) ## About The Pull Request This is a continuation of https://github.com/tgstation/tgstation/pull/74085 - I announced in the comments there that this would be my next PR, and this is it. Removes SSnetwork, ``/datum/ntnet``, ``/datum/component/ntnet_interface``, ``var/network_root_id``, the network unit test, and a lot of other things related to networks. - NTNet circuits now check for an Ntnet relay, and uses signals to operate. - Logs in Wirecarp is now only for PDA and Ntnet Relay things, so you can no longer see what ruins exist using it (why should Wirecarp know that Oldstation spawned? The flavor is that they dont know its there). - Removed it from MULEbots entirely, I don't think it even did anything for them? Botkeeper seems to work without it, so it's possibly there from pre-tgui PDAs. - Moves assigning random names to a base proc instead of being tied to network, this is things like random-naming scrubbers/vents. The behavior hasn't changed at all. - Makes Ntos work for consoles when relays are down, as the comments said they're supposed to (because they're wired). I think this was an accidental change on my part, so this is a revert of that. ## Why It's Good For The Game Ntnet is ancient code that hasn't given us much that we can't do with already existing alternatives, we've been slowly moving away from it for init times, and though a large portion of that was limited to airlocks, I still don't think this is a system worth keeping around. It's way too complex to expect feature coders to do anything with it, and too old with better alternatives for anyone to want to improve any of it. ## Changelog 🆑 fix: Computers are now properly connected to Ethernet, and can use Ntos when Relays are down. refactor: Removes Ntnet and Ntnet interfaces, which was only used by Ntnet circuits (which now directly checks for a Relay to work) and MULEbots, which did nothing with it. balance: Wirecarp no longer tells you what ruins spawned in a round, instead it's limited to PDA logs, and tells you the source too. This means the RD can catch someone running illegal programs if they don't make any attempt at hiding it. qol: Wirecarp logs is now set to save 300 at once, instead of 100 and being increased to 300 by the RD during the round. This is pretty insignificant, since there's no reason to NOT want as many logs as possible. /🆑 --------- Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com> * Removes networks from the game --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>
139 lines
5.0 KiB
Plaintext
139 lines
5.0 KiB
Plaintext
GLOBAL_LIST_EMPTY(ntnet_relays)
|
|
|
|
///Checks whether NTNet is available by ensuring at least one relay exists and is operational.
|
|
/proc/find_functional_ntnet_relay()
|
|
// Check all relays. If we have at least one working relay, ntos is up.
|
|
for(var/obj/machinery/ntnet_relay/relays as anything in GLOB.ntnet_relays)
|
|
if(!relays.is_operational)
|
|
continue
|
|
return TRUE
|
|
return FALSE
|
|
|
|
// Relays don't handle any actual communication. Global NTNet datum does that, relays only tell the datum if it should or shouldn't work.
|
|
/obj/machinery/ntnet_relay
|
|
name = "NTNet Quantum Relay"
|
|
desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile."
|
|
use_power = ACTIVE_POWER_USE
|
|
active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 10 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round
|
|
icon = 'icons/obj/machines/telecomms.dmi'
|
|
icon_state = "bus"
|
|
density = TRUE
|
|
circuit = /obj/item/circuitboard/machine/ntnet_relay
|
|
|
|
///On / off status for the relay machine, toggleable by the user.
|
|
var/relay_enabled = TRUE
|
|
///(D)DoS-attack-related failure causing it not to be operational any longer.
|
|
var/dos_failure = FALSE
|
|
var/list/dos_sources = list() // Backwards reference for qdel() stuff
|
|
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
|
|
var/dos_dissipate = 0.5 // Amount of DoS "packets" dissipated over time.
|
|
|
|
|
|
///Proc called to change the value of the `relay_enabled` variable and append behavior related to its change.
|
|
/obj/machinery/ntnet_relay/proc/set_relay_enabled(new_value)
|
|
if(new_value == relay_enabled)
|
|
return
|
|
. = relay_enabled
|
|
relay_enabled = new_value
|
|
if(.) //Turned off
|
|
set_is_operational(FALSE)
|
|
else if(!dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //Turned on
|
|
set_is_operational(TRUE)
|
|
|
|
///Proc called to change the value of the `dos_failure` variable and append behavior related to its change.
|
|
/obj/machinery/ntnet_relay/proc/set_dos_failure(new_value)
|
|
if(new_value == dos_failure)
|
|
return
|
|
. = dos_failure
|
|
dos_failure = new_value
|
|
if(.) //Failure ended
|
|
if(relay_enabled && !(machine_stat & (NOPOWER|BROKEN|MAINT)))
|
|
set_is_operational(TRUE)
|
|
else //Failure started
|
|
set_is_operational(FALSE)
|
|
|
|
/obj/machinery/ntnet_relay/on_set_machine_stat(old_value)
|
|
if(old_value & (NOPOWER|BROKEN|MAINT))
|
|
if(relay_enabled && !dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //From off to on.
|
|
set_is_operational(TRUE)
|
|
else if(machine_stat & (NOPOWER|BROKEN|MAINT)) //From on to off.
|
|
set_is_operational(FALSE)
|
|
|
|
/obj/machinery/ntnet_relay/update_icon_state()
|
|
icon_state = "bus[is_operational ? null : "_off"]"
|
|
return ..()
|
|
|
|
/obj/machinery/ntnet_relay/process(delta_time)
|
|
update_use_power(is_operational ? ACTIVE_POWER_USE : IDLE_POWER_USE)
|
|
|
|
update_appearance()
|
|
|
|
if(dos_overload > 0)
|
|
dos_overload = max(0, dos_overload - dos_dissipate * delta_time)
|
|
|
|
// If DoS traffic exceeded capacity, crash.
|
|
if((dos_overload > dos_capacity) && !dos_failure)
|
|
set_dos_failure(TRUE)
|
|
update_appearance()
|
|
SSmodular_computers.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)
|
|
set_dos_failure(FALSE)
|
|
update_appearance()
|
|
SSmodular_computers.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
|
return ..()
|
|
|
|
/obj/machinery/ntnet_relay/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "NtnetRelay")
|
|
ui.open()
|
|
|
|
/obj/machinery/ntnet_relay/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["enabled"] = relay_enabled
|
|
data["dos_capacity"] = dos_capacity
|
|
data["dos_overload"] = dos_overload
|
|
data["dos_crashed"] = dos_failure
|
|
return data
|
|
|
|
/obj/machinery/ntnet_relay/ui_act(action, params)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
switch(action)
|
|
if("restart")
|
|
dos_overload = 0
|
|
set_dos_failure(FALSE)
|
|
update_appearance()
|
|
SSmodular_computers.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
|
return TRUE
|
|
if("toggle")
|
|
set_relay_enabled(!relay_enabled)
|
|
SSmodular_computers.add_log("Quantum relay manually [relay_enabled ? "enabled" : "disabled"].")
|
|
update_appearance()
|
|
return TRUE
|
|
|
|
/obj/machinery/ntnet_relay/Initialize(mapload)
|
|
uid = gl_uid++
|
|
component_parts = list()
|
|
|
|
GLOB.ntnet_relays += src
|
|
SSmodular_computers.add_log("New quantum relay activated. Current amount of linked relays: [GLOB.ntnet_relays.len]")
|
|
return ..()
|
|
|
|
/obj/machinery/ntnet_relay/Destroy()
|
|
GLOB.ntnet_relays -= src
|
|
SSmodular_computers.add_log("Quantum relay connection severed. Current amount of linked relays: [GLOB.ntnet_relays.len]")
|
|
|
|
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
|
|
D.target = null
|
|
D.error = "Connection to quantum relay severed"
|
|
|
|
return ..()
|