Majority of base systems done.
This commit is contained in:
Shadowlight213
2016-08-05 01:00:51 -07:00
parent 83e5d98440
commit 5d9bc548a2
16 changed files with 609 additions and 358 deletions
@@ -7,7 +7,7 @@
var/enabled = 0 // Whether the computer is turned on.
var/screen_on = 1 // Whether the computer is active/opened/it's screen is on.
var/datum/computer_file/program/active_program = new /datum/computer_file/program/computerconfig // A currently active program running on the computer.
var/datum/computer_file/program/active_program = null // A currently active program running on the computer.
var/hardware_flag = 0 // A flag that describes this device type
var/last_power_usage = 0
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
@@ -46,6 +46,7 @@
var/obj/item/weapon/computer_hardware/hard_drive/portable/portable_drive // Portable data storage
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/activetemplate = "computer_main"
// Eject ID card from computer, if it has ID slot with card inside.
@@ -171,7 +172,7 @@
return 0
// Operates NanoUI
/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 1, datum/tgui/master_ui = null, datum/ui_state/state = contained_state)
/obj/item/modular_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
// if(!screen_on || !enabled)
// if(ui)
// ui.close()
@@ -180,50 +181,50 @@
// if(ui)
// ui.close()
// return 0
/*
// If we have an active program switch to it now.
if(active_program)
if(ui) // This is the main laptop screen. Since we are switching to program's UI close it for now.
ui.close()
active_program.ui_interact(user)
return
*/
// We are still here, that means there is no program loaded. Load the BIOS/ROM/OS/whatever you want to call it.
// This screen simply lists available programs and user may select them.
if(!hard_drive || !hard_drive.stored_files || !hard_drive.stored_files.len)
visible_message("\The [src] beeps three times, it's screen displaying \"DISK ERROR\" warning.")
// return // No HDD, No HDD files list or no stored files. Something is very broken.
return // No HDD, No HDD files list or no stored files. Something is very broken.
// data["programs"] = programs
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
// ui = new(user, src, ui_key, "laptop_mainscreen", "NTOS Main Menu", 400, 500)
ui = new(user, src, ui_key, "computer_main", "Main menu", 475, 340, master_ui, state)
ui = new(user, src, ui_key, activetemplate, "Main menu", 400, 500, master_ui, state)
// ui.set_initial_data(data)
ui.open()
ui.set_autoupdate(state = 1)
/obj/item/modular_computer/ui_data(mob/user)
var/list/data = list()
data["active_program_template"] = active_program
// var/list/data = list()
// data["active_program_template"] = active_program
// return data
return data
/*
var/list/data = get_header_data()
var/list/programs = list()
data["programs"] = list()
// var/list/programs = list()
for(var/datum/computer_file/program/P in hard_drive.stored_files)
var/list/program = list()
program["name"] = P.filename
program["desc"] = P.filedesc
if(P in idle_threads)
program["running"] = 1
programs.Add(list(program))
*/
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc))
// var/list/program = list()
// program["name"] = P.filename
// program["desc"] = P.filedesc
// if(P in idle_threads)
// program["running"] = 1
// programs.Add(list(program))
return data
// On-click handling. Turns on the computer if it's off and opens the GUI.
@@ -388,92 +389,80 @@
return
// Handles user's GUI input
/obj/item/modular_computer/Topic(href, href_list)
/obj/item/modular_computer/ui_act(action, params)
if(..())
return 1
if( href_list["PC_exit"] )
kill_program()
return 1
if( href_list["PC_enable_component"] )
var/obj/item/weapon/computer_hardware/H = find_hardware_by_name(href_list["PC_enable_component"])
if(H && istype(H) && !H.enabled)
H.enabled = 1
. = 1
if( href_list["PC_disable_component"] )
var/obj/item/weapon/computer_hardware/H = find_hardware_by_name(href_list["PC_disable_component"])
if(H && istype(H) && H.enabled)
H.enabled = 0
. = 1
if( href_list["PC_shutdown"] )
shutdown_computer()
return 1
if( href_list["PC_minimize"] )
var/mob/user = usr
if(!active_program || !processor_unit)
return
idle_threads.Add(active_program)
active_program.program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs
// nanomanager.close_uis(active_program.NM ? active_program.NM : active_program)
active_program = null
update_icon()
if(user && istype(user))
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
if( href_list["PC_killprogram"] )
var/prog = href_list["PC_killprogram"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
if(!istype(P) || P.program_state == PROGRAM_STATE_KILLED)
return
P.kill_program(1)
// update_uis()
user << "<span class='notice'>Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed.</span>"
if( href_list["PC_runprogram"] )
var/prog = href_list["PC_runprogram"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
if(!P || !istype(P)) // Program not found or it's not executable program.
user << "<span class='danger'>\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning.</span>"
return
P.computer = src
if(!P.is_supported_by_hardware(hardware_flag, 1, user))
return
// The program is already running. Resume it.
if(P in idle_threads)
P.program_state = PROGRAM_STATE_ACTIVE
active_program = P
idle_threads.Remove(P)
update_icon()
return
if(idle_threads.len >= processor_unit.max_idle_programs+1)
user << "<span class='notice'>\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error</span>"
return
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
user << "<span class='danger'>\The [src]'s screen shows \"NETWORK ERROR - Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning.</span>"
return
if(P.run_program(user))
active_program = P
update_icon()
return 1
if(.)
return
// update_uis()
switch(action)
if("PC_exit")
kill_program()
return 1
if("PC_shutdown")
shutdown_computer()
return 1
if("PC_minimize")
var/mob/user = usr
if(!active_program || !processor_unit)
return
idle_threads.Add(active_program)
active_program.program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs
active_program = null
update_icon()
if(user && istype(user))
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
if("PC_killprogram")
var/prog = params["name"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
if(!istype(P) || P.program_state == PROGRAM_STATE_KILLED)
return
P.kill_program(1)
user << "<span class='notice'>Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed.</span>"
if("PC_runprogram")
var/prog = params["name"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
if(!P || !istype(P)) // Program not found or it's not executable program.
user << "<span class='danger'>\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning.</span>"
return
P.computer = src
if(!P.is_supported_by_hardware(hardware_flag, 1, user))
return
// The program is already running. Resume it.
if(P in idle_threads)
P.program_state = PROGRAM_STATE_ACTIVE
active_program = P
idle_threads.Remove(P)
update_icon()
return
if(idle_threads.len >= processor_unit.max_idle_programs+1)
user << "<span class='notice'>\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error</span>"
return
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
user << "<span class='danger'>\The [src]'s screen shows \"NETWORK ERROR - Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning.</span>"
return
if(P.run_program(user))
active_program = P
update_icon()
return 1
else
return
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure(var/malfunction = 0)
@@ -681,6 +670,8 @@
// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null
/obj/item/modular_computer/proc/find_hardware_by_name(var/name)
world <<"ran"
world << name
if(portable_drive && (portable_drive.name == name))
return portable_drive
if(hard_drive && (hard_drive.name == name))
@@ -7,4 +7,5 @@
hardware_flag = PROGRAM_TABLET
max_hardware_size = 1
w_class = 2
light_strength = 2 // Same as PDAs
light_strength = 2 // Same as PDAs
var/use_power = 1
@@ -125,12 +125,11 @@
// It returns 0 if it can't run or if NanoModule was used instead. I suggest using NanoModules where applicable.
/datum/computer_file/program/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 1, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
if(program_state != PROGRAM_STATE_ACTIVE) // Our program was closed. Close the ui if it exists.
if(!ui)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(ui)
ui.close()
return computer.ui_interact(user)
if(istype(NM))
NM.ui_interact(user, ui_key, null, force_open)
return 0
return 1
@@ -139,8 +138,32 @@
// Calls beginning with "PRG_" are reserved for programs handling.
// Calls beginning with "PC_" are reserved for computer handling (by whatever runs the program)
// ALWAYS INCLUDE PARENT CALL ..() OR DIE IN FIRE.
/datum/computer_file/program/Topic(href, href_list)
/datum/computer_file/program/ui_act(action,params)
if(..())
return 1
if(computer)
return computer.Topic(href, href_list)
switch(action)
if("PC_exit")
computer.kill_program()
return 1
if("PC_shutdown")
computer.shutdown_computer()
return 1
if("PC_minimize")
var/mob/user = usr
if(!computer.active_program || !computer.processor_unit)
return
computer.idle_threads.Add(computer.active_program)
program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs
computer.active_program = null
computer.update_icon()
if(user && istype(user))
computer.ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
//if(computer)
// return computer.ui_act(action,params)
@@ -7,7 +7,6 @@
requires_ntnet = 1
available_on_ntnet = 0
available_on_syndinet = 1
nanomodule_path = /datum/nano_module/program/computer_dos/
var/obj/machinery/ntnet_relay/target = null
var/dos_speed = 0
var/error = ""
@@ -36,28 +35,61 @@
..(forced)
/datum/nano_module/program/computer_dos
name = "DoS Traffic Generator"
/datum/nano_module/program/computer_dos/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
/datum/computer_file/program/ntnet_dos/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_dos", "DoS Traffic Generator", 400, 250, state = state)
ui.set_style("syndicate")
ui.set_autoupdate(state = 1)
ui.open()
/datum/computer_file/program/ntnet_dos/ui_act(action, params)
if(..())
return 1
switch(action)
if("PRG_target_relay")
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
if("[R.uid]" == params)
target = R
return 1
if("PRG_reset")
if(target)
target.dos_sources.Remove(src)
target = null
executed = 0
error = ""
return 1
if("PRG_execute")
if(target)
executed = 1
target.dos_sources.Add(src)
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = 1
return 1
/datum/computer_file/program/ntnet_dos/ui_data(mob/user)
if(!ntnet_global)
return
var/datum/computer_file/program/ntnet_dos/PRG = program
var/list/data = list()
if(!istype(PRG))
return
data = PRG.get_header_data()
if(PRG.error)
data["error"] = PRG.error
else if(PRG.target && PRG.executed)
var/list/data = list()
data = get_header_data()
if(error)
data["error"] = error
else if(target && executed)
data["target"] = 1
data["speed"] = PRG.dos_speed
data["speed"] = dos_speed
// This is mostly visual, generate some strings of 1s and 0s
// Probability of 1 is equal of completion percentage of DoS attack on this relay.
// Combined with UI updates this adds quite nice effect to the UI
var/percentage = PRG.target.dos_overload * 100 / PRG.target.dos_capacity
var/percentage = target.dos_overload * 100 / target.dos_capacity
var/list/strings[0]
for(var/j, j<10, j++)
var/string = ""
@@ -70,36 +102,6 @@
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
relays.Add(R.uid)
data["relays"] = relays
data["focus"] = PRG.target ? PRG.target.uid : null
data["focus"] = target ? target.uid : null
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_dos.tmpl", "DoS Traffic Generator", 400, 250, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/computer_file/program/ntnet_dos/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_target_relay"])
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
if("[R.uid]" == href_list["PRG_target_relay"])
target = R
return 1
if(href_list["PRG_reset"])
if(target)
target.dos_sources.Remove(src)
target = null
executed = 0
error = ""
return 1
if(href_list["PRG_execute"])
if(target)
executed = 1
target.dos_sources.Add(src)
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = 1
return 1
return data
@@ -12,27 +12,22 @@
size = 4
available_on_ntnet = 0
requires_ntnet = 0
// nanomodule_path = /datum/nano_module/program/computer_configurator/
//datum/nano_module/program/computer_configurator
// name = "NTOS Computer Configuration Tool"
var/obj/item/modular_computer/movable = null
//obj/machinery/vr_sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
/datum/computer_file/program/computerconfig/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
/datum/computer_file/program/computerconfig/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
ui = new(user, src, ui_key, "laptop_configuration", "NTOS Configuration Utility", 575, 700, state = state)
// ui.auto_update_layout = 1
// ui.set_initial_data(data)
ui.open()
ui.set_autoupdate(state = 1)
/datum/computer_file/program/computerconfig/ui_data(mob/user)
if(program)
movable = program.computer
movable = computer
if(!istype(movable))
movable = null
@@ -42,8 +37,8 @@
var/list/data = list()
if(program)
data = program.get_header_data()
data = program.get_header_data()
var/list/hardware = movable.get_all_components()
@@ -55,6 +50,9 @@
data["battery_rating"] = movable.battery_module.battery.maxcharge
data["battery_percent"] = round(movable.battery_module.battery.percent())
if(movable.battery_module)
data["battery"] = list("max" = movable.battery_module.battery.maxcharge, "charge" = round(movable.battery_module.battery.charge))
var/list/all_entries[0]
for(var/obj/item/weapon/computer_hardware/H in hardware)
all_entries.Add(list(list(
@@ -66,4 +64,18 @@
)))
data["hardware"] = all_entries
return data
return data
/datum/computer_file/program/computerconfig/ui_act(action,params)
world << "test"
if(..())
return
world << action
world <<params["name"]
switch(action)
if("PC_toggle_component")
var/obj/item/weapon/computer_hardware/H = movable.find_hardware_by_name(params["name"])
if(H && istype(H))
H.enabled = !H.enabled
. = TRUE
@@ -11,7 +11,7 @@
var/open_file
var/error
/datum/computer_file/program/filemanager/Topic(href, href_list)
/datum/computer_file/program/filemanager/ui_act(href, href_list)
if(..())
return 1
@@ -9,13 +9,13 @@
requires_ntnet = 1
requires_ntnet_feature = NTNET_SOFTWAREDOWNLOAD
available_on_ntnet = 0
nanomodule_path = /datum/nano_module/program/computer_ntnetdownload/
ui_header = "downloader_finished.gif"
var/datum/computer_file/program/downloaded_file = null
var/hacked_download = 0
var/download_completion = 0 //GQ of downloaded data.
var/download_netspeed = 0
var/downloaderror = ""
var/obj/item/modular_computer/my_computer = null
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(var/filename)
if(downloaded_file)
@@ -83,50 +83,57 @@
download_netspeed = NTNETSPEED_ETHERNET
download_completion += download_netspeed
/datum/computer_file/program/ntnetdownload/Topic(href, href_list)
/datum/computer_file/program/ntnetdownload/ui_act(action, params)
if(..())
return 1
if(href_list["PRG_downloadfile"])
if(!downloaded_file)
begin_file_download(href_list["PRG_downloadfile"])
return 1
if(href_list["PRG_reseterror"])
if(downloaderror)
download_completion = 0
download_netspeed = 0
downloaded_file = null
downloaderror = ""
return 1
switch(action)
if("PRG_downloadfile")
if(!downloaded_file)
begin_file_download(params["filename"])
return 1
if("PRG_reseterror")
if(downloaderror)
download_completion = 0
download_netspeed = 0
downloaded_file = null
downloaderror = ""
return 1
return 0
/datum/nano_module/program/computer_ntnetdownload
name = "Network Downloader"
var/obj/item/modular_computer/my_computer = null
//datum/nano_module/program/computer_ntnetdownload
// name = "Network Downloader"
/datum/nano_module/program/computer_ntnetdownload/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
if(program)
my_computer = program.computer
/datum/computer_file/program/ntnetdownload/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_downloader", "NTNet Download Program", 575, 700, state = state)
ui.open()
ui.set_autoupdate(state = 1)
/datum/computer_file/program/ntnetdownload/ui_data(mob/user)
my_computer = computer
if(!istype(my_computer))
return
var/list/data = list()
var/datum/computer_file/program/ntnetdownload/prog = program
// For now limited to execution by the downloader program
if(!prog || !istype(prog))
return
if(program)
data = program.get_header_data()
data = get_header_data()
// This IF cuts on data transferred to client, so i guess it's worth it.
if(prog.downloaderror) // Download errored. Wait until user resets the program.
data["error"] = prog.downloaderror
else if(prog.downloaded_file) // Download running. Wait please..
data["downloadname"] = prog.downloaded_file.filename
data["downloaddesc"] = prog.downloaded_file.filedesc
data["downloadsize"] = prog.downloaded_file.size
data["downloadspeed"] = prog.download_netspeed
data["downloadcompletion"] = round(prog.download_completion, 0.1)
if(downloaderror) // Download errored. Wait until user resets the program.
data["error"] = downloaderror
else if(downloaded_file) // Download running. Wait please..
data["downloadname"] = downloaded_file.filename
data["downloaddesc"] = downloaded_file.filedesc
data["downloadsize"] = downloaded_file.size
data["downloadspeed"] = download_netspeed
data["downloadcompletion"] = round(download_completion, 0.1)
else // No download running, pick file.
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
@@ -142,7 +149,7 @@
"size" = P.size
)))
data["hackedavailable"] = 0
if(prog.computer_emagged) // If we are running on emagged computer we have access to some "bonus" software
if(computer_emagged) // If we are running on emagged computer we have access to some "bonus" software
var/list/hacked_programs[0]
for(var/datum/computer_file/program/P in ntnet_global.available_antag_software)
data["hackedavailable"] = 1
@@ -155,10 +162,5 @@
data["hacked_programs"] = hacked_programs
data["downloadable_programs"] = all_entries
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_downloader.tmpl", "NTNet Download Program", 575, 700, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
return data
@@ -7,16 +7,72 @@
requires_ntnet = 1
required_access = access_network
available_on_ntnet = 1
nanomodule_path = /datum/nano_module/computer_ntnetmonitor/
/datum/nano_module/computer_ntnetmonitor
name = "NTNet Diagnostics and Monitoring"
available_to_ai = TRUE
//datum/nano_module/computer_ntnetmonitor
// name = "NTNet Diagnostics and Monitoring"
// available_to_ai = TRUE
/datum/nano_module/computer_ntnetmonitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
/datum/computer_file/program/ntnetmonitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = always_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_monitor", "NTNet Diagnostics and Monitoring Tool", 575, 700, state = state)
ui.open()
ui.set_autoupdate(state = 1)
/datum/computer_file/program/ntnetmonitor/ui_act(action, params)
if(..())
return 1
switch(action)
if("resetIDS")
. = 1
if(ntnet_global)
ntnet_global.resetIDS()
return 1
if("toggleIDS")
. = 1
if(ntnet_global)
ntnet_global.toggleIDS()
return 1
if("toggleWireless")
. = 1
if(!ntnet_global)
return 1
// NTNet is disabled. Enabling can be done without user prompt
if(ntnet_global.setting_disabled)
ntnet_global.setting_disabled = 0
return 1
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
var/mob/user = usr
if(!user)
return 1
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
if(response == "Yes")
ntnet_global.setting_disabled = 1
return 1
if("purgelogs")
. = 1
if(ntnet_global)
ntnet_global.purge_logs()
if("updatemaxlogs")
. = 1
var/mob/user = usr
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
if(ntnet_global)
ntnet_global.update_max_log_count(logcount)
if("toggle_function")
. = 1
if(!ntnet_global)
return 1
ntnet_global.toggle_function(params)
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
if(!ntnet_global)
return
var/list/data = host.initial_data()
var/list/data = list()
data["ntnetstatus"] = ntnet_global.check_function()
data["ntnetrelays"] = ntnet_global.relays.len
@@ -31,59 +87,4 @@
data["ntnetlogs"] = ntnet_global.logs
data["ntnetmaxlogs"] = ntnet_global.setting_maxlogcount
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_monitor.tmpl", "NTNet Diagnostics and Monitoring Tool", 575, 700, state = state)
if(host.update_layout())
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/nano_module/computer_ntnetmonitor/Topic(href, href_list)
if(..())
return 1
if(href_list["resetIDS"])
. = 1
if(ntnet_global)
ntnet_global.resetIDS()
return 1
if(href_list["toggleIDS"])
. = 1
if(ntnet_global)
ntnet_global.toggleIDS()
return 1
if(href_list["toggleWireless"])
. = 1
if(!ntnet_global)
return 1
// NTNet is disabled. Enabling can be done without user prompt
if(ntnet_global.setting_disabled)
ntnet_global.setting_disabled = 0
return 1
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
var/mob/user = usr
if(!user)
return 1
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
if(response == "Yes")
ntnet_global.setting_disabled = 1
return 1
if(href_list["purgelogs"])
. = 1
if(ntnet_global)
ntnet_global.purge_logs()
if(href_list["updatemaxlogs"])
. = 1
var/mob/user = usr
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
if(ntnet_global)
ntnet_global.update_max_log_count(logcount)
if(href_list["toggle_function"])
. = 1
if(!ntnet_global)
return 1
ntnet_global.toggle_function(href_list["toggle_function"])
return data
@@ -87,7 +87,7 @@
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/weapon/computer_hardware/hard_drive/proc/install_default_programs()
store_file(new/datum/computer_file/program/computerconfig(src)) // Computer configuration utility, allows hardware control and displays more info than status bar
// store_file(new/datum/computer_file/program/ntnetdownload(src)) // NTNet Downloader Utility, allows users to download more software from NTNet repository
store_file(new/datum/computer_file/program/ntnetdownload(src)) // NTNet Downloader Utility, allows users to download more software from NTNet repository
// store_file(new/datum/computer_file/program/filemanager(src)) // File manager, allows text editor functions and basic file manipulation.