Exosuit program, tracking, and downloader improvements (#1264)

A minor project focusing on Modular computers and exosuits. Changelog is small, since most of this is changes to unreleased content
In brief:
Adds an exosuit monitor program
Fixes many visual issues with the downloader program
Tweaks Exosuit killswitch and EMP mechanics
This commit is contained in:
NanakoAC
2016-12-22 22:52:54 +00:00
committed by skull132
parent d2b49ab1cb
commit c7e56daaa6
15 changed files with 434 additions and 158 deletions
@@ -44,7 +44,7 @@
// ===== RESEARCH CONSOLE =====
/obj/machinery/modular_computer/console/preset/research
console_department = "Medbay"
console_department = "Research"
desc = "A stationary computer. This one comes preloaded with research programs."
/obj/machinery/modular_computer/console/preset/research/install_programs()
@@ -0,0 +1,9 @@
/datum/computer_file/program/exosuit_monitor
filename = "exosuitmonitor"
filedesc = "Exosuit monitoring and control"
nanomodule_path = /datum/nano_module/exosuit_control
program_icon_state = "mecha"
extended_desc = "This program allows remote monitoring and administration of exosuits with tracking beacons installed."
required_access = access_robotics
requires_ntnet = 1
size = 8
@@ -16,8 +16,9 @@
var/download_completion = 0 //GQ of downloaded data.
var/download_netspeed = 0
var/downloaderror = ""
var/downstream_variance = 0.1
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(var/filename)
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(var/filename, var/user = null)
if(downloaded_file)
return 0
@@ -46,6 +47,9 @@
hacked_download = 0
downloaded_file = PRG.clone()
if (user)
spawn()
ui_interact(user)
/datum/computer_file/program/ntnetdownload/proc/abort_file_download()
if(!downloaded_file)
@@ -71,6 +75,7 @@
return
if(download_completion >= downloaded_file.size)
complete_file_download()
return
// Download speed according to connectivity state. NTNet server is assumed to be on unlimited speed so we're limited by our local connectivity
download_netspeed = 0
// Speed defines are found in misc.dm
@@ -81,14 +86,20 @@
download_netspeed = NTNETSPEED_HIGHSIGNAL
if(3)
download_netspeed = NTNETSPEED_ETHERNET
download_completion += download_netspeed
var/delta = ((rand()-0.5)*2)*downstream_variance*download_netspeed
//Download speed varies +/- 10% each proc. Adds a more realistic feel
download_netspeed += delta
download_netspeed = round(download_netspeed, 0.002)//3 decimal places
download_completion = min(download_completion + download_netspeed, downloaded_file.size)
/datum/computer_file/program/ntnetdownload/Topic(href, href_list)
if(..())
return 1
if(href_list["PRG_downloadfile"])
if(!downloaded_file)
begin_file_download(href_list["PRG_downloadfile"])
begin_file_download(href_list["PRG_downloadfile"], usr)
return 1
if(href_list["PRG_reseterror"])
if(downloaderror)
@@ -125,8 +136,8 @@
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)
data["downloadspeed"] = (prog.download_netspeed * 0.5)//It updates every two seconds
data["downloadcompletion"] = round(prog.download_completion, 0.01)
else // No download running, pick file.
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
@@ -0,0 +1,62 @@
/datum/nano_module/exosuit_control
name = "Exosuit Monitoring and Control"
var/stored_data
var/screen = 0
// If PC is not null header template is loaded. Use PC.get_header_data() to get relevant nanoui data from it. All data entries begin with "PC_...."
// In future it may be expanded to other modular computer devices.
/datum/nano_module/exosuit_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
var/list/data = list()
if(program)
data = program.get_header_data()
data["screen"] = screen
switch (screen)
if (0)
var/list/beacons = list()
for(var/obj/item/mecha_parts/mecha_tracking/TR in exo_beacons)
beacons.len++
beacons[beacons.len] = TR.get_mecha_info_nano()
data["beacons"] = beacons
if (1)
data["log"] = stored_data
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "exosuit_control.tmpl", "Exosuit Control and Monitoring", 800, 500, state = state)
if(program) // This is necessary to ensure the status bar remains updated along with rest of the UI.
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/nano_module/exosuit_control/Topic(href, href_list)
if(..())
return
var/datum/topic_input/filter = new /datum/topic_input(href,href_list)
if(href_list["send_message"])
var/obj/item/mecha_parts/mecha_tracking/MT = filter.getObj("send_message")
var/message = sanitize(input(usr,"Input message","Transmit message") as text)
var/obj/mecha/M = MT.in_mecha()
if(message && M)
M.occupant_message(message)
return
if(href_list["shock"])
var/obj/item/mecha_parts/mecha_tracking/MT = filter.getObj("shock")
var/response = alert(usr,"Are you certain you wish to terminate this exosuit? Executing this procedure will render it inoperable, and should only be used in extreme circumstances. Improper use will result in your being held liable for damage to Nanotrasen property","Confirm shutdown","Destroy","Cancel")
if (response == "Destroy")
MT.shock(usr)
if(href_list["get_log"])
var/obj/item/mecha_parts/mecha_tracking/MT = filter.getObj("get_log")
stored_data = MT.get_mecha_log()
screen = 1
if(href_list["return"])
screen = 0
if (usr)
spawn()
program.ui_interact(usr)
return
+8
View File
@@ -387,12 +387,20 @@
/datum/design/item/mecha_tracking
name = "Exosuit tracking beacon"
id = "exotrack"
build_type = MECHFAB
time = 5
materials = list(DEFAULT_WALL_MATERIAL = 500)
build_path = /obj/item/mecha_parts/mecha_tracking
category = "Misc"
/datum/design/item/mecha_tracking/control
name = "Exosuit control beacon"
id = "exocontrol"
time = 30
materials = list(DEFAULT_WALL_MATERIAL = 3000)
build_path = /obj/item/mecha_parts/mecha_tracking/control
/datum/design/item/mecha
build_type = MECHFAB
category = "Exosuit Equipment"