mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-04 22:42:07 +00:00
Adds NTNet, more programs, improvements
- Overall improvements of code, fixes, etc. - Adds NTNet and NTNet relays. They currently miss deconstruction/construction but that's planned for later. - Adds few more programs (still preinstalled in the laptop, for debugging) - Successfully gets rid of copypaste formerly needed in templates. Now the header is in default template itself. This seems to be least problematic solution without making change to nanoui's code itself.
This commit is contained in:
40
code/modules/modular_computers/NTNet/NTNet.dm
Normal file
40
code/modules/modular_computers/NTNet/NTNet.dm
Normal file
@@ -0,0 +1,40 @@
|
||||
var/global/datum/ntnet/ntnet_global = new()
|
||||
|
||||
|
||||
// This is the NTNet datum. There can be only one NTNet datum in game at once. Modular computers read data from this.
|
||||
/datum/ntnet/
|
||||
var/list/relays = list()
|
||||
var/setting_softwaredownload = 1
|
||||
var/setting_peertopeer = 1
|
||||
var/setting_communication = 1
|
||||
var/setting_systemcontrol = 1
|
||||
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
/datum/ntnet/New()
|
||||
if(ntnet_global && (ntnet_global != src))
|
||||
ntnet_global = src // There can be only one.
|
||||
for(var/obj/machinery/ntnet_relay/R in machines)
|
||||
relays.Add(R)
|
||||
|
||||
/datum/ntnet/proc/check_function(var/specific_action = 0)
|
||||
if(!relays || !relays.len) // No relays found. NTNet is down
|
||||
return 0
|
||||
|
||||
var/operating = 0
|
||||
|
||||
// Check all relays. If we have at least one working relay, network is up.
|
||||
for(var/obj/machinery/ntnet_relay/R in relays)
|
||||
if(R.is_operational())
|
||||
operating = 1
|
||||
break
|
||||
|
||||
if(specific_action == NTNET_SOFTWAREDOWNLOAD)
|
||||
return (operating && setting_softwaredownload)
|
||||
if(specific_action == NTNET_PEERTOPEER)
|
||||
return (operating && setting_peertopeer)
|
||||
if(specific_action == NTNET_COMMUNICATION)
|
||||
return (operating && setting_communication)
|
||||
if(specific_action == NTNET_SYSTEMCONTROL)
|
||||
return (operating && setting_systemcontrol)
|
||||
return operating
|
||||
Reference in New Issue
Block a user