mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-17 05:03:28 +00:00
* Add the system for managed global variables * Travis ban old globals * So you CAN inline proccall, that's neat * Fix that * master.dm * Remove the hack procs * Move InitGlobals to the proper spot * configuration.dm * Fix the missing pre-slash * clockcult.dm * This is probably for the best * Doy * Fix shit * Rest of the DEFINES tree * Fix * Use global. for access * Update find_references_in_globals Always hated that proc Whoever made it must've bee a r e a l idiot... * __HELPERS tree * Move global initialization to master. Fix the declaration * database.dm * Dat newline * I said DECLARATIVE order! * Here's something you can chew on @Iamgoofball * game_modes.dm * Fix this * genetics.dm * flavor_misc.dm * More stuff * Do it mso's way. Keep the controllers as global * Make master actually see it * Fix * Finish _globalvars/lists * Finish the rest of the _globalvars tree * This is weird * Migrate the controllers * SLOTH -> GLOB * Lighting globals * round_start_time -> ticker * PAI card list -> pai SS * record_id_num -> static * Diseases list -> SSdisease * More disease globals to the SS * More disease stuff * Emote list * Better and better * Bluh * So much stuff * Ahh * Wires * dview * station_areas * Teleportlocs * blood_splatter_icons * Stuff and such * More stuff * RAD IO * More stuff and such * Blob shit * Changeling stuff * Add "Balance" to changelogs * Balance for changelog compiler + Auto Tagging * Update the PR template * hivemind_bank * Bip * sacrificed * Good shit * Better define * More cult shit * Devil shit * Gang shit * > borers Fix shit * Rename the define * Nuke * Objectives * Sandbox * Multiverse sword * Announce systems * Stuff and such * TC con * Airlock * doppllllerrrrrr * holopads * Shut up byond you inconsistent fuck * Sneaky fuck * Burp * Bip * Fixnshit * Port without regard * askdlfjs; * asdfjasoidojfi * Protected globals and more * SO MANY * ajsimkvahsaoisd * akfdsiaopwimfeoiwafaw * gsdfigjosidjfgiosdg * AHHHHHHHHHHHHHHHHHHHHHHH!!!!! * facerolll * ASDFASDFASDF * Removes the unused parts of dmm_suite * WIP * Fix quote * asdfjauwfnkjs * afwlunhskjfda * asfjlaiwuefhaf * SO CLOSE * wwwweeeeeewwwww * agdgmoewranwg * HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!? * Fix syntax errors * 100 errors * Another 100 * So many... * Ugh * More shit * kilme * Stuuuuuufffff * ajrgmrlshio;djfa;sdkl * jkbhkhjbmjvjmh * soi soi soi * butt * TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING * lllllllllllllllllllllllllllllllllllllllllll * afsdijfiawhnflnjhnwsdfs * yugykihlugk,kj * time to go * STUFFF!!! * AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!! * ngoaijdjlfkamsdlkf * Break time * aufjsdklfalsjfi * CONTROL KAY AND PRAY * IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Goteem * Fix testing mode * This does not belong in this PR * Convert it to a controller * Eh, fuck this option * Revert controllerization Ill do it some other time * Fix * Working controllerization * FOR THE LOVE OF CHRIST PROTECT THE LOGS * Protect admins and deadmins * Use the inbuilt proc
146 lines
5.6 KiB
Plaintext
146 lines
5.6 KiB
Plaintext
GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, 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/list/logs = list()
|
|
var/list/available_station_software = list()
|
|
var/list/available_antag_software = list()
|
|
var/list/chat_channels = list()
|
|
var/list/fileservers = list()
|
|
// 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
|
|
|
|
// These only affect wireless. LAN (consoles) are unaffected since it would be possible to create scenario where someone turns off NTNet, and is unable to turn it back on since it refuses connections
|
|
var/setting_softwaredownload = 1
|
|
var/setting_peertopeer = 1
|
|
var/setting_communication = 1
|
|
var/setting_systemcontrol = 1
|
|
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status.
|
|
|
|
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled
|
|
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software.
|
|
|
|
|
|
// If new NTNet datum is spawned, it replaces the old one.
|
|
/datum/ntnet/New()
|
|
if(GLOB.ntnet_global && (GLOB.ntnet_global != src))
|
|
GLOB.ntnet_global = src // There can be only one.
|
|
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
|
relays.Add(R)
|
|
R.NTNet = src
|
|
build_software_lists()
|
|
add_log("NTNet logging system activated.")
|
|
|
|
// Simplified logging: Adds a log. log_string is mandatory parameter, source is optional.
|
|
/datum/ntnet/proc/add_log(log_string, obj/item/weapon/computer_hardware/network_card/source = null)
|
|
var/log_text = "[worldtime2text()] - "
|
|
if(source)
|
|
log_text += "[source.get_network_tag()] - "
|
|
else
|
|
log_text += "*SYSTEM* - "
|
|
log_text += log_string
|
|
logs.Add(log_text)
|
|
|
|
|
|
// 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)
|
|
|
|
|
|
// Checks whether NTNet operates. If parameter is passed checks whether specific function is enabled.
|
|
/datum/ntnet/proc/check_function(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/M in relays)
|
|
var/obj/machinery/ntnet_relay/R = M
|
|
if(R.is_operational())
|
|
operating = 1
|
|
break
|
|
|
|
if(setting_disabled)
|
|
return 0
|
|
|
|
switch(specific_action)
|
|
if(NTNET_SOFTWAREDOWNLOAD)
|
|
return (operating && setting_softwaredownload)
|
|
if(NTNET_PEERTOPEER)
|
|
return (operating && setting_peertopeer)
|
|
if(NTNET_COMMUNICATION)
|
|
return (operating && setting_communication)
|
|
if(NTNET_SYSTEMCONTROL)
|
|
return (operating && setting_systemcontrol)
|
|
return operating
|
|
|
|
// Builds lists that contain downloadable software.
|
|
/datum/ntnet/proc/build_software_lists()
|
|
available_station_software = list()
|
|
available_antag_software = list()
|
|
for(var/F in typesof(/datum/computer_file/program))
|
|
var/datum/computer_file/program/prog = new F
|
|
// Invalid type (shouldn't be possible but just in case), invalid filetype (not executable program) or invalid filename (unset program)
|
|
if(!prog || prog.filename == "UnknownProgram" || prog.filetype != "PRG")
|
|
continue
|
|
// Check whether the program should be available for station/antag download, if yes, add it to lists.
|
|
if(prog.available_on_ntnet)
|
|
available_station_software.Add(prog)
|
|
if(prog.available_on_syndinet)
|
|
available_antag_software.Add(prog)
|
|
|
|
// Attempts to find a downloadable file according to filename var
|
|
/datum/ntnet/proc/find_ntnet_file_by_name(filename)
|
|
for(var/N in available_station_software)
|
|
var/datum/computer_file/program/P = N
|
|
if(filename == P.filename)
|
|
return P
|
|
for(var/N in available_antag_software)
|
|
var/datum/computer_file/program/P = N
|
|
if(filename == P.filename)
|
|
return P
|
|
|
|
// Resets the IDS alarm
|
|
/datum/ntnet/proc/resetIDS()
|
|
intrusion_detection_alarm = 0
|
|
|
|
/datum/ntnet/proc/toggleIDS()
|
|
resetIDS()
|
|
intrusion_detection_enabled = !intrusion_detection_enabled
|
|
|
|
// Removes all logs
|
|
/datum/ntnet/proc/purge_logs()
|
|
logs = list()
|
|
add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-")
|
|
|
|
// Updates maximal amount of stored logs. Use this instead of setting the number, it performs required checks.
|
|
/datum/ntnet/proc/update_max_log_count(lognumber)
|
|
if(!lognumber)
|
|
return 0
|
|
// 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.")
|
|
|
|
/datum/ntnet/proc/toggle_function(function)
|
|
if(!function)
|
|
return
|
|
function = text2num(function)
|
|
switch(function)
|
|
if(NTNET_SOFTWAREDOWNLOAD)
|
|
setting_softwaredownload = !setting_softwaredownload
|
|
add_log("Configuration Updated. Wireless network firewall now [setting_softwaredownload ? "allows" : "disallows"] connection to software repositories.")
|
|
if(NTNET_PEERTOPEER)
|
|
setting_peertopeer = !setting_peertopeer
|
|
add_log("Configuration Updated. Wireless network firewall now [setting_peertopeer ? "allows" : "disallows"] peer to peer network traffic.")
|
|
if(NTNET_COMMUNICATION)
|
|
setting_communication = !setting_communication
|
|
add_log("Configuration Updated. Wireless network firewall now [setting_communication ? "allows" : "disallows"] instant messaging and similar communication services.")
|
|
if(NTNET_SYSTEMCONTROL)
|
|
setting_systemcontrol = !setting_systemcontrol
|
|
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|