a small addition

This commit is contained in:
Geevies
2020-04-15 19:58:18 +02:00
parent 21deec90c3
commit 94579a73bf
65 changed files with 1200 additions and 1223 deletions
@@ -7,13 +7,13 @@
requires_ntnet = TRUE
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/program/computer_newsbrowser/
nanomodule_path = /datum/nano_module/program/computer_newsbrowser
var/datum/computer_file/data/news_article/loaded_article
var/download_progress = 0
var/download_netspeed = 0
var/downloading = 0
var/downloading = FALSE
var/message = ""
var/show_archived = 0
var/show_archived = FALSE
color = LIGHT_COLOR_GREEN
/datum/computer_file/program/newsbrowser/process_tick()
@@ -30,56 +30,56 @@
download_netspeed = NTNETSPEED_ETHERNET
download_progress += download_netspeed
if(download_progress >= loaded_article.size)
downloading = 0
requires_ntnet = 0 // Turn off NTNet requirement as we already loaded the file into local memory.
downloading = FALSE
requires_ntnet = FALSE // Turn off NTNet requirement as we already loaded the file into local memory.
SSnanoui.update_uis(NM)
/datum/computer_file/program/newsbrowser/kill_program()
..()
requires_ntnet = 1
requires_ntnet = TRUE
loaded_article = null
download_progress = 0
downloading = 0
show_archived = 0
downloading = FALSE
show_archived = FALSE
/datum/computer_file/program/newsbrowser/Topic(href, href_list)
if(..())
return 1
return TRUE
if(href_list["PRG_openarticle"])
. = 1
. = TRUE
if(downloading || loaded_article)
return 1
return TRUE
for(var/datum/computer_file/data/news_article/N in ntnet_global.available_news)
if(N.uid == text2num(href_list["PRG_openarticle"]))
loaded_article = N.clone()
downloading = 1
downloading = TRUE
break
if(href_list["PRG_reset"])
. = 1
downloading = 0
. = TRUE
downloading = FALSE
download_progress = 0
requires_ntnet = 1
requires_ntnet = TRUE
loaded_article = null
if(href_list["PRG_clearmessage"])
. = 1
. = TRUE
message = ""
if(href_list["PRG_savearticle"])
. = 1
. = TRUE
if(downloading || !loaded_article)
return
var/savename = sanitize(input(usr, "Enter file name or leave blank to cancel:", "Save article", loaded_article.filename))
if(!savename)
return 1
return TRUE
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return 1
return TRUE
var/datum/computer_file/data/news_article/N = loaded_article.clone()
N.filename = savename
HDD.store_file(N)
if(href_list["PRG_toggle_archived"])
. = 1
. = TRUE
show_archived = !show_archived
if(.)
SSnanoui.update_uis(NM)
@@ -124,7 +124,6 @@
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "news_browser.tmpl", "NTNet/ExoNet News Browser", 575, 700, state = state)
ui.auto_update_layout = 1
ui.auto_update_layout = TRUE
ui.set_initial_data(data)
ui.open()
ui.open()
@@ -10,11 +10,11 @@
ui_header = "ntnrc_idle.gif"
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/program/computer_chatclient
var/last_message = null // Used to generate the toolbar icon
var/last_message // Used to generate the toolbar icon
var/username
var/datum/ntnet_conversation/channel = null
var/operator_mode = 0 // Channel operator mode
var/netadmin_mode = 0 // Administrator mode (invisible to other users + bypasses passwords)
var/datum/ntnet_conversation/channel
var/operator_mode = FALSE // Channel operator mode
var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords)
color = LIGHT_COLOR_GREEN
/datum/computer_file/program/chatclient/New()
@@ -51,8 +51,8 @@
if(C.password)
var/mob/living/user = usr
var/password = sanitize(input(user,"Access Denied. Enter password:"))
if(C && (password == C.password))
var/password = sanitize(input(user, "Access Denied. Enter password:"))
if(C?.password == password)
C.add_client(src)
channel = C
return TRUE
@@ -66,7 +66,7 @@
if(href_list["PRG_newchannel"])
. = TRUE
var/mob/living/user = usr
var/channel_title = sanitize(input(user,"Enter channel name or leave blank to cancel:"))
var/channel_title = sanitize(input(user, "Enter channel name or leave blank to cancel:"))
if(!channel_title)
return
var/datum/ntnet_conversation/C = new /datum/ntnet_conversation(channel_title)
@@ -95,19 +95,19 @@
if(href_list["PRG_changename"])
. = TRUE
var/mob/living/user = usr
var/newname = sanitize(input(user,"Enter new nickname or leave blank to cancel:"))
if(!newname)
return 1
var/new_name = sanitize(input(user, "Enter new nickname or leave blank to cancel:"))
if(!new_name)
return TRUE
if(channel)
channel.add_status_message("[username] is now known as [newname].")
username = newname
channel.add_status_message("[username] is now known as [new_name].")
username = new_name
if(href_list["PRG_savelog"])
. = TRUE
if(!channel)
return
var/mob/living/user = usr
var/logname = input(user,"Enter desired logfile name (.log) or leave blank to cancel:")
var/logname = input(user, "Enter desired logfile name (.log) or leave blank to cancel:")
if(!logname || !channel)
return TRUE
var/datum/computer_file/data/logfile = new /datum/computer_file/data/logfile()
@@ -170,7 +170,7 @@
else
last_message = null
return 1
if(channel && channel.messages && channel.messages.len)
if(channel?.messages?.len)
ui_header = last_message == channel.messages[channel.messages.len - 1] ? "ntnrc_idle.gif" : "ntnrc_new.gif"
else
ui_header = "ntnrc_idle.gif"
@@ -4,13 +4,12 @@
extended_desc = "This program is used to run NTSL2+ programs."
program_icon_state = "generic"
size = 2
requires_ntnet = 1
available_on_ntnet = 1
undeletable = 0
requires_ntnet = TRUE
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/program/computer_ntsl2_interpreter/
nanomodule_path = /datum/nano_module/program/computer_ntsl2_interpreter
var/datum/ntsl_program/running = null
var/datum/ntsl_program/running
color = LIGHT_COLOR_GREEN
/datum/computer_file/program/ntsl2_interpreter/process_tick()
@@ -26,10 +25,10 @@
/datum/computer_file/program/ntsl2_interpreter/Topic(href, href_list)
if(..())
return 1
return TRUE
if(href_list["PRG_execfile"])
. = 1
. = TRUE
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
var/datum/computer_file/data/F = HDD.find_file_by_name(href_list["PRG_execfile"])
if(istype(F))
@@ -40,7 +39,7 @@
running.name = href_list["PRG_execfile"]
if(href_list["PRG_closefile"])
. = 1
. = TRUE
if(istype(running))
running.kill()
running = null
@@ -49,13 +48,13 @@
if(istype(running))
var/topc = href_list["PRG_topic"]
if(copytext(topc, 1, 2) == "?")
topc = copytext(topc, 2) + "?" + input("","Enter Data")
topc = copytext(topc, 2) + "?" + input("", "Enter Data")
running.topic(topc)
running.cycle(300)
. = 1
. = TRUE
if(href_list["PRG_refresh"])
. = 1
. = TRUE
if(.)
SSnanoui.update_uis(NM)
@@ -97,5 +96,4 @@
ui = new(user, src, ui_key, "ntsl_interpreter.tmpl", "NTSL2+ Interpreter", 575, 700, state = state)
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.open()
@@ -10,20 +10,20 @@ var/global/nttransfer_uid = 0
requires_ntnet_feature = NTNET_PEERTOPEER
network_destination = "other device via P2P tunnel"
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/program/computer_nttransfer/
nanomodule_path = /datum/nano_module/program/computer_nttransfer
color = LIGHT_COLOR_GREEN
var/error = "" // Error screen
var/server_password = "" // Optional password to download the file.
var/datum/computer_file/provided_file = null // File which is provided to clients.
var/datum/computer_file/downloaded_file = null // File which is being downloaded
var/datum/computer_file/provided_file // File which is provided to clients.
var/datum/computer_file/downloaded_file // File which is being downloaded
var/list/connected_clients = list() // List of connected clients.
var/datum/computer_file/program/nttransfer/remote // Client var, specifies who are we downloading from.
var/download_completion = 0 // Download progress in GQ
var/download_netspeed = 0 // Our connectivity speed in GQ/s
var/actual_netspeed = 0 // Displayed in the UI, this is the actual transfer speed.
var/unique_token // UID of this program
var/upload_menu = 0 // Whether we show the program list and upload menu
var/unique_token // UID of this program
var/upload_menu = FALSE // Whether we show the program list and upload menu
/datum/computer_file/program/nttransfer/New()
unique_token = nttransfer_uid
@@ -71,7 +71,7 @@ var/global/nttransfer_uid = 0
// Finishes download and attempts to store the file on HDD
/datum/computer_file/program/nttransfer/proc/finish_download()
if(!computer || !computer.hard_drive || !computer.hard_drive.store_file(downloaded_file))
error = "I/O Error: Unable to save file. Check your hard drive and try again."
error = "I/O Error: Unable to save file. Check your hard drive and try again."
finalize_download()
// Crashes the download and displays specific error message
@@ -91,7 +91,7 @@ var/global/nttransfer_uid = 0
/datum/nano_module/program/computer_nttransfer
name = "NTNet P2P Transfer Client"
/datum/nano_module/program/computer_nttransfer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
/datum/nano_module/program/computer_nttransfer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = TRUE, var/datum/topic_state/state = default_state)
if(!program)
return
var/datum/computer_file/program/nttransfer/PRG = program
@@ -103,16 +103,16 @@ var/global/nttransfer_uid = 0
if(PRG.error)
data["error"] = PRG.error
else if(PRG.downloaded_file)
data["downloading"] = 1
data["downloading"] = TRUE
data["download_size"] = PRG.downloaded_file.size
data["download_progress"] = PRG.download_completion
data["download_netspeed"] = PRG.actual_netspeed
data["download_name"] = "[PRG.downloaded_file.filename].[PRG.downloaded_file.filetype]"
else if (PRG.provided_file)
data["uploading"] = 1
data["uploading"] = TRUE
data["upload_uid"] = PRG.unique_token
data["upload_clients"] = PRG.connected_clients.len
data["upload_haspassword"] = PRG.server_password ? 1 : 0
data["upload_haspassword"] = PRG.server_password ? TRUE : FALSE
data["upload_filename"] = "[PRG.provided_file.filename].[PRG.provided_file.filetype]"
else if (PRG.upload_menu)
var/list/all_files[0]
@@ -130,21 +130,21 @@ var/global/nttransfer_uid = 0
"uid" = P.unique_token,
"filename" = "[P.provided_file.filename].[P.provided_file.filetype]",
"size" = P.provided_file.size,
"haspassword" = P.server_password ? 1 : 0
"haspassword" = P.server_password ? TRUE : FALSE
)))
data["servers"] = all_servers
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_transfer.tmpl", "NTNet P2P Transfer Client", 575, 700, state = state)
ui.auto_update_layout = 1
ui.auto_update_layout = TRUE
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
ui.set_auto_update(TRUE)
/datum/computer_file/program/nttransfer/Topic(href, href_list)
if(..())
return 1
return TRUE
if(href_list["PRG_downloadfile"])
for(var/datum/computer_file/program/nttransfer/P in ntnet_global.fileservers)
if("[P.unique_token]" == href_list["PRG_downloadfile"])
@@ -162,14 +162,14 @@ var/global/nttransfer_uid = 0
return 1
if(href_list["PRG_reset"])
error = ""
upload_menu = 0
upload_menu = FALSE
finalize_download()
if(src in ntnet_global.fileservers)
ntnet_global.fileservers.Remove(src)
for(var/datum/computer_file/program/nttransfer/T in connected_clients)
T.crash_download("Remote server has forcibly closed the connection")
provided_file = null
return 1
return TRUE
if(href_list["PRG_setpassword"])
var/pass = sanitize(input(usr, "Enter new server password. Leave blank to cancel, input 'none' to disable password.", "Server security", "none"))
if(!pass)
@@ -178,7 +178,7 @@ var/global/nttransfer_uid = 0
server_password = ""
return
server_password = pass
return 1
return TRUE
if(href_list["PRG_uploadfile"])
for(var/datum/computer_file/F in computer.hard_drive.stored_files)
if("[F.uid]" == href_list["PRG_uploadfile"])
@@ -189,7 +189,7 @@ var/global/nttransfer_uid = 0
ntnet_global.fileservers.Add(src)
return
error = "I/O Error: Unable to locate file on hard drive."
return 1
return TRUE
if(href_list["PRG_uploadmenu"])
upload_menu = 1
return 0
upload_menu = TRUE
return FALSE
@@ -339,4 +339,4 @@
var/datum/computer_file/program/records/t = target
if(istype(t) && !t.isEditing)
if(t.active == r || t.active_virus == r)
SSvueui.check_uis_for_change(t)
SSvueui.check_uis_for_change(t)