Ports some modular computer stuff from baystation

This commit is contained in:
Casey
2022-06-30 23:58:24 -04:00
committed by CHOMPStation2
parent a34b97046c
commit e1edec79c8
51 changed files with 460 additions and 111 deletions

View File

@@ -1,18 +1,35 @@
var/global/file_uid = 0
/datum/computer_file/
var/filename = "NewFile" // Placeholder. No spacebars
var/filetype = "XXX" // File full names are [filename].[filetype] so like NewFile.XXX in this case
var/size = 1 // File size in GQ. Integers only!
var/obj/item/weapon/computer_hardware/hard_drive/holder // Holder that contains this file.
var/unsendable = 0 // Whether the file may be sent to someone via NTNet transfer or other means.
var/undeletable = 0 // Whether the file may be deleted. Setting to 1 prevents deletion/renaming/etc.
var/uid // UID of this file
/// Placeholder. Whitespace and most special characters are not allowed.
var/filename = "NewFile"
/// File full names are [filename].[filetype] so like NewFile.XXX in this case
var/filetype = "XXX"
/// File size in GQ. Integers only!
var/size = 1
/// Holder that contains this file.
var/obj/item/weapon/computer_hardware/hard_drive/holder
//// Whether the file may be sent to someone via NTNet transfer, email or other means.
var/unsendable = FALSE
/// Whether the file may be deleted. Setting to TRUE prevents deletion/renaming/etc.
var/undeletable = FALSE
/// Whether the file is hidden from view in the OS
var/hidden = FALSE
/// Protects files that should never be edited by the user due to special properties.
var/read_only = FALSE
/// UID of this file
var/uid
/// Any metadata the file uses.
var/list/metadata
/// Paper type to use for printing
var/papertype = /obj/item/weapon/paper
/datum/computer_file/New()
/datum/computer_file/New(list/md = null)
..()
uid = file_uid
file_uid++
if(islist(md))
metadata = md.Copy()
/datum/computer_file/Destroy()
if(!holder)
@@ -30,10 +47,13 @@ var/global/file_uid = 0
var/datum/computer_file/temp = new type
temp.unsendable = unsendable
temp.undeletable = undeletable
temp.hidden = hidden
temp.size = size
if(metadata)
temp.metadata = metadata.Copy()
if(rename)
temp.filename = filename + "(Copy)"
else
temp.filename = filename
temp.filetype = filetype
return temp
return temp

View File

@@ -1,10 +1,11 @@
// /data/ files store data in string format.
// They don't contain other logic for now.
/datum/computer_file/data
var/stored_data = "" // Stored data in string format.
filetype = "DAT"
var/stored_data = "" // Stored data in string format.
var/block_size = 250
var/do_not_edit = 0 // Whether the user will be reminded that the file probably shouldn't be edited.
var/do_not_edit = FALSE // Whether the user will be reminded that the file probably shouldn't be edited.
/datum/computer_file/data/clone()
var/datum/computer_file/data/temp = ..()
@@ -15,5 +16,43 @@
/datum/computer_file/data/proc/calculate_size()
size = max(1, round(length(stored_data) / block_size))
/datum/computer_file/data/proc/generate_file_data(mob/user)
return digitalPencode2html(stored_data)
/datum/computer_file/data/logfile
filetype = "LOG"
/datum/computer_file/data/text
filetype = "TXT"
/// Mapping tool - creates a named modular computer file in a computer's storage on late initialize.
/// Use this to do things like automatic records and blackboxes. Alternative for paper records.
/// Values can be in the editor for each map or as a subtype.
/// This is an obj because raw atoms can't be placed in DM or third-party mapping tools.
///obj/effect/computer_file_creator
// name = "computer file creator"
// desc = "This is a mapping tool used for installing text files onto a modular device when it's mapped on top of them. If you see it, it's bugged."
// icon = 'icons/effects/landmarks.dmi'
// icon_state = "x3"
// anchored = TRUE
// unacidable = TRUE
// simulated = FALSE
// invisibility = 101
// /// The name that the file will have once it's created.
// var/file_name = "helloworld"
// /// The contents of this file. Uses paper formatting.
// var/file_info = "Hello World!"
///obj/effect/computer_file_creator/Initialize()
// . = ..()
// return INITIALIZE_HINT_LATELOAD
///obj/effect/computer_file_creator/LateInitialize()
// var/turf/T = get_turf(src)
// for (var/obj/O in T)
// if (!istype(O, /obj/machinery/computer/modular) && !istype(O, /obj/item/modular_computer))
// continue
// var/datum/extension/interactive/ntos/os = get_extension(O, /datum/extension/interactive/ntos)
// if (os)
// os.create_data_file(file_name, file_info, /datum/computer_file/data/text)
// qdel(src)

View File

@@ -1,30 +1,39 @@
// /program/ files are executable programs that do things.
/datum/computer_file/program
filetype = "PRG"
filename = "UnknownProgram" // File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
filetype = "PRG"
var/required_access = null // List of required accesses to run/download the program.
var/requires_access_to_run = 1 // Whether the program checks for required_access when run.
var/requires_access_to_download = 1 // Whether the program checks for required_access when downloading.
// TGUIModule
var/datum/tgui_module/TM = null // If the program uses TGUIModule, put it here and it will be automagically opened. Otherwise implement tgui_interact.
var/tguimodule_path = null // Path to tguimodule, make sure to set this if implementing new program.
// Etc Program stuff
var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
var/obj/item/modular_computer/computer // Device that runs this program.
var/filedesc = "Unknown Program" // User-friendly name of this program.
var/extended_desc = "N/A" // Short description of this program's function.
/// Category that this program belongs to.
var/category = PROG_MISC
var/usage_flags = PROGRAM_ALL // Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
var/program_icon_state = null // Program-specific screen icon state
var/program_key_state = "standby_key" // Program-specific keyboard icon state
var/program_menu_icon = "newwin" // Icon to use for program's link in main menu
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images!
var/requires_ntnet = 0 // Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
var/requires_ntnet_feature = 0 // Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
var/ntnet_status = 1 // NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc.
var/usage_flags = PROGRAM_ALL // Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
var/network_destination = null // Optional string that describes what NTNet server/system this program connects to. Used in default logging.
var/ntnet_status = 1 // NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc.
var/available_on_ntnet = 1 // Whether the program can be downloaded from NTNet. Set to 0 to disable.
var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
// Misc
var/computer_emagged = 0 // Set to 1 if computer that's running us was emagged. Computer updates this every Process() tick
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images!
var/ntnet_speed = 0 // GQ/s - current network connectivity transfer rate
/// Name of the tgui interface
var/tgui_id
@@ -230,4 +239,4 @@
/datum/computer_file/program/proc/relaymove(var/mob/M, direction)
if(TM)
return TM.relaymove(M, direction)
return TM.relaymove(M, direction)

View File

@@ -7,8 +7,8 @@
program_menu_icon = "zoomin"
extended_desc = "This very advanced piece of software uses adaptive programming and large database of cipherkeys to bypass most encryptions used on camera networks. Be warned that system administrator may notice this."
size = 73 // Very large, a price for bypassing ID checks completely.
available_on_ntnet = 0
available_on_syndinet = 1
available_on_ntnet = FALSE
available_on_syndinet = TRUE
/datum/computer_file/program/camera_monitor/hacked/process_tick()
..()

View File

@@ -7,5 +7,6 @@
program_menu_icon = "key"
extended_desc = "Program for programming crew ID cards."
required_access = access_change_ids
requires_ntnet = 0
requires_ntnet = FALSE
size = 8
category = PROG_COMMAND

View File

@@ -12,10 +12,11 @@
tguimodule_path = /datum/tgui_module/communications/ntos
extended_desc = "Used to command and control. Can relay long-range communications. This program can not be run on tablet computers."
required_access = access_heads
requires_ntnet = 1
requires_ntnet = TRUE
size = 12
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
network_destination = "long-range communication array"
category = PROG_COMMAND
var/datum/comm_message_listener/message_core = new
/datum/computer_file/program/comm/clone()

View File

@@ -8,9 +8,10 @@
program_menu_icon = "alert"
extended_desc = "This program provides visual interface for the engineering alarm system."
required_access = access_engine
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "alarm monitoring network"
size = 5
category = PROG_MONITOR
var/has_alert = 0
/datum/computer_file/program/alarm_monitor/process_tick()

View File

@@ -7,8 +7,9 @@
program_menu_icon = "shuffle"
extended_desc = "This program allows remote control of air alarms. This program can not be run on tablet computers."
required_access = access_atmospherics
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "atmospheric control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
category = PROG_ENG
size = 17

View File

@@ -8,9 +8,10 @@
extended_desc = "This program connects to sensors to provide information about electrical systems"
ui_header = "power_norm.gif"
required_access = access_engine
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "power monitoring system"
size = 9
category = PROG_ENG
var/has_alert = 0
/datum/computer_file/program/power_monitor/process_tick()

View File

@@ -7,8 +7,9 @@
program_menu_icon = "power"
extended_desc = "This program allows remote control of power distribution systems. This program can not be run on tablet computers."
required_access = access_engine
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "RCON remote control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
size = 19
category = PROG_ENG

View File

@@ -7,7 +7,8 @@
program_menu_icon = "wrench"
extended_desc = "This program allows for remote monitoring and control of emergency shutoff valves."
required_access = access_engine
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "shutoff valve control computer"
size = 5
category = PROG_ENG
var/has_alert = 0

View File

@@ -8,9 +8,10 @@
extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines."
ui_header = "smmon_0.gif"
required_access = access_engine
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "supermatter monitoring system"
size = 5
category = PROG_ENG
var/last_status = 0
/datum/computer_file/program/supermatter_monitor/process_tick()

View File

@@ -40,6 +40,7 @@
size = 12
available_on_ntnet = 1
requires_ntnet = 1
category = PROG_MONITOR
// ERT Variant of the program
/datum/computer_file/program/camera_monitor/ert

View File

@@ -12,6 +12,8 @@
unsendable = 1
undeletable = 1
size = 4
available_on_ntnet = 0
requires_ntnet = 0
available_on_ntnet = FALSE
requires_ntnet = FALSE
tguimodule_path = /datum/tgui_module/computer_configurator
usage_flags = PROGRAM_ALL
category = PROG_UTIL

View File

@@ -6,10 +6,12 @@
program_key_state = "generic_key"
program_menu_icon = "mail-closed"
size = 7
requires_ntnet = 1
available_on_ntnet = 1
requires_ntnet = TRUE
available_on_ntnet = TRUE
var/stored_login = ""
var/stored_password = ""
usage_flags = PROGRAM_ALL
category = PROG_OFFICE
tguimodule_path = /datum/tgui_module/email_client

View File

@@ -13,6 +13,8 @@
var/open_file
var/error
usage_flags = PROGRAM_ALL
category = PROG_UTIL
/datum/computer_file/program/filemanager/tgui_act(action, list/params, datum/tgui/ui)
if(..())

View File

@@ -26,6 +26,8 @@
///Determines which boss image to use on the UI.
var/boss_id = 1
usage_flags = PROGRAM_ALL
// This is the primary game loop, which handles the logic of being defeated or winning.
/datum/computer_file/program/game/proc/game_check(mob/user)
sleep(5)

View File

@@ -8,7 +8,7 @@
size = 4
requires_ntnet = TRUE
available_on_ntnet = TRUE
usage_flags = PROGRAM_ALL
tgui_id = "NtosNewsBrowser"
var/datum/computer_file/data/news_article/loaded_article
@@ -118,4 +118,3 @@
if("PRG_toggle_archived")
. = TRUE
show_archived = !show_archived

View File

@@ -16,12 +16,19 @@
var/datum/computer_file/program/downloaded_file = null
var/hacked_download = 0
var/download_completion = 0 //GQ of downloaded data.
///GQ of downloaded data.
var/download_completion = 0
var/download_netspeed = 0
var/downloaderror = ""
var/obj/item/modular_computer/my_computer = null
var/list/downloads_queue[0]
var/file_info
var/server
usage_flags = PROGRAM_ALL
category = PROG_UTIL
var/obj/item/modular_computer/my_computer = null
/datum/computer_file/program/ntnetdownload/kill_program()
..()
abort_file_download()

View File

@@ -12,12 +12,16 @@
ui_header = "ntnrc_idle.gif"
available_on_ntnet = 1
tgui_id = "NtosNetChat"
var/last_message // Used to generate the toolbar icon
/// Used to generate the toolbar icon
var/last_message
var/username
var/active_channel
var/list/channel_history = list()
var/operator_mode = FALSE // Channel operator mode
var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords)
/// Channel operator mode
var/operator_mode = FALSE
/// Administrator mode (invisible to other users + bypasses passwords)
var/netadmin_mode = FALSE
usage_flags = PROGRAM_ALL
/datum/computer_file/program/chatclient/New()
username = "DefaultUser[rand(100, 999)]"
@@ -169,7 +173,7 @@
var/list/data = list()
data["can_admin"] = can_run(user, FALSE, access_network)
return data
/datum/computer_file/program/chatclient/tgui_data(mob/user)
if(!ntnet_global || !ntnet_global.chat_channels)
return list()
@@ -223,4 +227,4 @@
data["authed"] = FALSE
data["messages"] = list()
return data
return data

View File

@@ -8,11 +8,12 @@ var/global/nttransfer_uid = 0
program_key_state = "generic_key"
program_menu_icon = "transferthick-e-w"
size = 7
requires_ntnet = 1
requires_ntnet = TRUE
requires_ntnet_feature = NTNET_PEERTOPEER
network_destination = "other device via P2P tunnel"
available_on_ntnet = 1
available_on_ntnet = TRUE
tgui_id = "NtosNetTransfer"
category = PROG_UTIL
var/error = "" // Error screen
var/server_password = "" // Optional password to download the file.
@@ -23,7 +24,7 @@ var/global/nttransfer_uid = 0
var/download_completion = 0 // Download progress in GQ
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/upload_menu = FALSE // Whether we show the program list and upload menu
/datum/computer_file/program/nttransfer/New()
unique_token = nttransfer_uid
@@ -86,14 +87,14 @@ var/global/nttransfer_uid = 0
data["download_progress"] = download_completion
data["download_netspeed"] = actual_netspeed
data["download_name"] = "[downloaded_file.filename].[downloaded_file.filetype]"
data["uploading"] = !!provided_file
if(provided_file)
data["upload_uid"] = unique_token
data["upload_clients"] = connected_clients.len
data["upload_haspassword"] = server_password ? 1 : 0
data["upload_filename"] = "[provided_file.filename].[provided_file.filetype]"
data["upload_filelist"] = list()
if(upload_menu)
var/list/all_files = list()
@@ -104,7 +105,7 @@ var/global/nttransfer_uid = 0
"size" = F.size
)))
data["upload_filelist"] = all_files
data["servers"] = list()
if(!(downloaded_file || provided_file || upload_menu))
var/list/all_servers = list()

View File

@@ -9,12 +9,15 @@
available_on_ntnet = TRUE
tgui_id = "NtosWordProcessor"
var/browsing
var/browsing = FALSE
var/open_file
var/loaded_data
var/error
var/is_edited
usage_flags = PROGRAM_ALL
category = PROG_OFFICE
/datum/computer_file/program/wordprocessor/proc/get_file(var/filename)
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD)

View File

@@ -7,6 +7,7 @@
program_menu_icon = "heart"
extended_desc = "This program connects to life signs monitoring system to provide basic information on crew health."
required_access = access_medical
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "crew lifesigns monitoring system"
size = 11
category = PROG_MONITOR

View File

@@ -6,10 +6,11 @@
program_key_state = "generic_key"
program_menu_icon = "mail-open"
size = 12
requires_ntnet = 1
available_on_ntnet = 1
requires_ntnet = TRUE
available_on_ntnet = TRUE
tgui_id = "NtosEmailAdministration"
required_access = access_network
category = PROG_ADMIN
var/datum/computer_file/data/email_account/current_account = null
var/datum/computer_file/data/email_message/current_message = null

View File

@@ -10,6 +10,7 @@
required_access = access_network
available_on_ntnet = TRUE
tgui_id = "NtosNetMonitor"
category = PROG_ADMIN
/datum/computer_file/program/ntnetmonitor/tgui_data(mob/user)
if(!ntnet_global)
@@ -90,4 +91,4 @@
var/nid = tgui_input_number(usr,"Enter NID of device which you want to unblock from the network:", "Enter NID")
if(nid && tgui_status(usr, state) == STATUS_INTERACTIVE)
ntnet_global.banned_nids -= nid
return TRUE
return TRUE

View File

@@ -17,11 +17,12 @@ var/warrant_uid = 0
program_icon_state = "warrant"
program_key_state = "security_key"
program_menu_icon = "star"
requires_ntnet = 1
available_on_ntnet = 1
requires_ntnet = TRUE
available_on_ntnet = TRUE
required_access = access_security
usage_flags = PROGRAM_ALL
tgui_id = "NtosDigitalWarrant"
category = PROG_SEC
var/datum/data/record/warrant/activewarrant

View File

@@ -7,6 +7,6 @@
program_menu_icon = "pin-s"
extended_desc = "Displays a ship's location in the sector."
required_access = null
requires_ntnet = 1
requires_ntnet = TRUE
network_destination = "ship position sensors"
size = 4