Renames vars on pdas and removes ntnet_relays glob (#79595)

## About The Pull Request

- replaces the ntnet_relays global list with ``get_machines_by_type``
- renames ``transfer_access`` var on PDA to ``download_access`` &
``required_access`` to ``run_access`` to better describe what they do,
because on more than one ocassion I've confused myself with the two
terms and ended up doing something unintentional (see:
https://github.com/tgstation/tgstation/pull/74269)

## Why It's Good For The Game

Kills a useless global list and makes pda code a little less confusing.

## Changelog

Nothing player-facing.
This commit is contained in:
John Willard
2023-11-12 19:35:58 -05:00
committed by GitHub
parent 67ad491337
commit 78f04be9f8
21 changed files with 66 additions and 73 deletions
+14 -21
View File
@@ -1,9 +1,7 @@
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)
for(var/obj/machinery/ntnet_relay/relays as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay))
if(!relays.is_operational)
continue
return TRUE
@@ -33,6 +31,19 @@ GLOBAL_LIST_EMPTY(ntnet_relays)
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.
/obj/machinery/ntnet_relay/Initialize(mapload)
. = ..()
uid = gl_uid++
var/list/current_machines = SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)
SSmodular_computers.add_log("New quantum relay activated. Current amount of linked relays: [current_machines.len]")
/obj/machinery/ntnet_relay/Destroy()
. = ..()
var/list/machines_left = SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)
SSmodular_computers.add_log("Quantum relay connection severed. Current amount of linked relays: [machines_left.len]")
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
D.target = null
D.error = "Connection to quantum relay severed"
///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)
@@ -118,21 +129,3 @@ GLOBAL_LIST_EMPTY(ntnet_relays)
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 ..()