Makes the modular computers refresh after Topic() calls.

This commit is contained in:
PsiOmegaDelta
2016-01-02 13:54:13 +01:00
parent 983109faf4
commit 27729a290b
8 changed files with 63 additions and 53 deletions

View File

@@ -45,4 +45,4 @@
network_destination = "RCON remote control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
size = 19
size = 19

View File

@@ -7,4 +7,4 @@
required_access = access_medical
requires_ntnet = 1
network_destination = "crew lifesigns monitoring system"
size = 11
size = 11

View File

@@ -107,7 +107,10 @@
/datum/computer_file/program/card_mod/Topic(href, href_list)
var/mob/living/user = usr
if(..())
return 1
var/mob/user = usr
var/obj/item/weapon/card/id/user_id_card = user.GetIdCard()
var/obj/item/weapon/card/id/id_card = computer.card_slot.stored_card
var/datum/nano_module/card_mod/module = NM
@@ -214,5 +217,4 @@
id_card.name = text("[id_card.registered_name]'s ID Card ([id_card.assignment])")
nanomanager.update_uis(NM)
..(href, href_list)
return 1
return 1

View File

@@ -12,15 +12,18 @@
var/error
/datum/computer_file/program/filemanager/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_openfile"])
open_file = href_list["PRG_openfile"]
if(href_list["PRG_newtextfile"])
var/newname = sanitize(input(usr, "Enter file name or leave blank to cancel:", "File rename"))
if(!newname)
return
return 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/data/F = new/datum/computer_file/data()
F.filename = newname
F.filetype = "TXT"
@@ -28,18 +31,18 @@
if(href_list["PRG_deletefile"])
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/file = HDD.find_file_by_name(href_list["PRG_deletefile"])
if(!file || file.undeletable)
return
return 1
HDD.remove_file(file)
if(href_list["PRG_usbdeletefile"])
var/obj/item/weapon/computer_hardware/hard_drive/RHDD = computer.portable_drive
if(!RHDD)
return
return 1
var/datum/computer_file/file = RHDD.find_file_by_name(href_list["PRG_usbdeletefile"])
if(!file || file.undeletable)
return
return 1
RHDD.remove_file(file)
if(href_list["PRG_closefile"])
open_file = null
@@ -47,31 +50,31 @@
if(href_list["PRG_clone"])
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/F = HDD.find_file_by_name(href_list["PRG_clone"])
if(!F || !istype(F))
return
return 1
var/datum/computer_file/C = F.clone(1)
HDD.store_file(C)
if(href_list["PRG_rename"])
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/file = HDD.find_file_by_name(href_list["PRG_rename"])
if(!file || !istype(file))
return
return 1
var/newname = sanitize(input(usr, "Enter new file name:", "File rename", file.filename))
if(file && newname)
file.filename = newname
if(href_list["PRG_edit"])
if(!open_file)
return
return 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/data/F = HDD.find_file_by_name(open_file)
if(!F || !istype(F))
return
return 1
// 16384 is the limit for file length in characters. Currently, papers have value of 2048 so this is 8 times as long, since we can't edit parts of the file independently.
var/newtext = sanitize(html_decode(input(usr, "Editing file [open_file]. You may use most tags used in paper formatting:", "Text Editor", F.stored_data) as message), 16384)
if(F)
@@ -87,40 +90,41 @@
HDD.store_file(backup)
if(href_list["PRG_printfile"])
if(!open_file)
return
return 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)
return
return 1
var/datum/computer_file/data/F = HDD.find_file_by_name(open_file)
if(!F || !istype(F))
return
return 1
if(!computer.nano_printer)
error = "Missing Hardware: Your computer does not have required hardware to complete this operation."
return
return 1
if(!computer.nano_printer.print_text(parse_tags(F.stored_data)))
error = "Hardware error: Printer was unable to print the file. It may be out of paper."
return
return 1
if(href_list["PRG_copytousb"])
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD)
return
return 1
var/datum/computer_file/F = HDD.find_file_by_name(href_list["PRG_copytousb"])
if(!F || !istype(F))
return
return 1
var/datum/computer_file/C = F.clone(0)
RHDD.store_file(C)
if(href_list["PRG_copyfromusb"])
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD)
return
return 1
var/datum/computer_file/F = RHDD.find_file_by_name(href_list["PRG_copyfromusb"])
if(!F || !istype(F))
return
return 1
var/datum/computer_file/C = F.clone(0)
HDD.store_file(C)
..(href, href_list)
return 1
/datum/computer_file/program/filemanager/proc/parse_tags(var/t)
t = replacetext(t, "\[center\]", "<center>")

View File

@@ -84,17 +84,16 @@
if(href_list["PRG_downloadfile"])
if(!downloaded_file)
begin_file_download(href_list["PRG_downloadfile"])
return
return 1
if(href_list["PRG_reseterror"])
if(downloaderror)
download_completion = 0
download_netspeed = 0
downloaded_file = null
downloaderror = ""
return
return 1
return 0
/datum/nano_module/computer_ntnetdownload
name = "Network Downloader"
var/obj/item/modular_computer/my_computer = null
@@ -157,4 +156,4 @@
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
ui.set_auto_update(1)

View File

@@ -66,7 +66,7 @@
// 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
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
@@ -81,5 +81,7 @@
ntnet_global.update_max_log_count(logcount)
if(href_list["toggle_function"])
if(!ntnet_global)
return
return 1
ntnet_global.toggle_function(href_list["toggle_function"])
return 1

View File

@@ -18,9 +18,12 @@
username = "DefaultUser[rand(100, 999)]"
/datum/computer_file/program/chatclient/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_speak"])
if(!channel)
return
return 1
var/mob/living/user = usr
var/message = sanitize(input(user, "Enter message or leave blank to cancel: "))
if(!message || !channel)
@@ -35,11 +38,11 @@
break
if(!C)
return
return 1
if(netadmin_mode)
channel = C // Bypasses normal leave/join and passwords. Technically makes the user invisible to others.
return
return 1
if(C.password)
var/mob/living/user = usr
@@ -47,7 +50,7 @@
if(C && (password == C.password))
C.add_client(src)
channel = C
return
return 1
C.add_client(src)
channel = C
if(href_list["PRG_leavechannel"])
@@ -70,7 +73,7 @@
if(channel)
channel.remove_client(src) // We shouldn't be in channel's user list, but just in case...
channel = null
return
return 1
var/mob/living/user = usr
if(can_run(usr, 1, access_network))
if(channel)
@@ -86,7 +89,7 @@
var/mob/living/user = usr
var/newname = sanitize(input(user,"Enter new nickname or leave blank to cancel:"))
if(!newname)
return
return 1
if(channel)
channel.add_status_message("[username] is now known as [newname].")
username = newname
@@ -97,7 +100,7 @@
var/mob/living/user = usr
var/logname = input(user,"Enter desired logfile name (.log) or leave blank to cancel:")
if(!logname || !channel)
return
return 1
var/datum/computer_file/data/logfile = new/datum/computer_file/data/logfile()
// Now we will generate HTML-compliant file that can actually be viewed/printed.
logfile.filename = logname
@@ -110,14 +113,14 @@
if(!computer)
// This program shouldn't even be runnable without computer.
CRASH("Var computer is null!")
return
return 1
if(!computer.hard_drive)
computer.visible_message("\The [computer] shows an \"I/O Error - Hard drive connection error\" warning.")
else // In 99.9% cases this will mean our HDD is full
computer.visible_message("\The [computer] shows an \"I/O Error - Hard drive may be full. Please free some space and try again. Required space: [logfile.size]GQ\" warning.")
if(href_list["PRG_renamechannel"])
if(!operator_mode || !channel)
return
return 1
var/mob/living/user = usr
var/newname = sanitize(input(user, "Enter new channel name or leave blank to cancel:"))
if(!newname || !channel)
@@ -126,23 +129,23 @@
channel.title = newname
if(href_list["PRG_deletechannel"])
if(channel && ((channel.operator == src) || netadmin_mode))
del(channel)
qdel(channel)
channel = null
if(href_list["PRG_setpassword"])
if(!channel || ((channel.operator != src) && !netadmin_mode))
return
return 1
var/mob/living/user = usr
var/newpassword = sanitize(input(user, "Enter new password for this channel. Leave blank to cancel, enter 'nopassword' to remove password completely:"))
if(!channel || !newpassword || ((channel.operator != src) && !netadmin_mode))
return
return 1
if(newpassword == "nopassword")
channel.password = ""
else
channel.password = newpassword
..(href, href_list)
return 1
/datum/computer_file/program/chatclient/kill_program(var/forced = 0)
if(channel)

View File

@@ -161,7 +161,7 @@ var/global/nttransfer_uid = 0
return
downloaded_file = remote.provided_file.clone()
remote.connected_clients.Add(src)
return
return 1
if(href_list["PRG_reset"])
error = ""
upload_menu = 0
@@ -171,7 +171,7 @@ var/global/nttransfer_uid = 0
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
return 1
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)
@@ -180,7 +180,7 @@ var/global/nttransfer_uid = 0
server_password = ""
return
server_password = pass
return
return 1
if(href_list["PRG_uploadfile"])
for(var/datum/computer_file/F in computer.hard_drive.stored_files)
if("[F.uid]" == href_list["PRG_uploadfile"])
@@ -191,7 +191,7 @@ var/global/nttransfer_uid = 0
ntnet_global.fileservers.Add(src)
return
error = "I/O Error: Unable to locate file on hard drive."
return
return 1
if(href_list["PRG_uploadmenu"])
upload_menu = 1
return 0
return 0