Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/computer4_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define WIRELESS_FILTER_MODEMAX 2 //! Max of WIRELESS_FILTER_* Defines.

// ThinkDOS //
// Well-Known Directories
#define THINKDOS_BIN_DIRECTORY "/bin"
// Constants
#define THINKDOS_MAX_COMMANDS 3 //! The maximum amount of commands
// Symbols
Expand Down
4 changes: 2 additions & 2 deletions code/modules/computer4/computer4.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ TYPEINFO_DEF(/obj/machinery/computer4)
/// List of peripheral typepaths to install by default.
var/list/default_peripherals

/// The directory to install them in
var/default_program_dir = "/bin"
/// The directory to install them in.
var/default_program_dir = THINKDOS_BIN_DIRECTORY

/// Soundloop. Self explanatory.
var/datum/looping_sound/computer/soundloop
Expand Down
6 changes: 3 additions & 3 deletions code/modules/computer4/data/terminal/_terminal_program.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

return TRUE

/// Called when a program is run.
/datum/c4_file/terminal_program/proc/execute(datum/c4_file/terminal_program/operating_system/thinkdos/system)
system.clear_screen(TRUE)
/// Called when a program is run. cmdline can be either a string or a parsed /datum/shell_stdin
/datum/c4_file/terminal_program/proc/execute(datum/c4_file/terminal_program/operating_system/thinkdos/system, cmdline)
return

/// Called when a program is no longer running
/datum/c4_file/terminal_program/proc/on_close(datum/c4_file/terminal_program/operating_system/thinkdos/system)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
if(!system.get_computer().get_peripheral(PERIPHERAL_TYPE_WIRELESS_CARD))
system.println("<b>Error:</b> Unable to locate wireless adapter.")

system.clear_screen(TRUE)
view_home()

/datum/c4_file/terminal_program/directman/std_in(text)
Expand Down
1 change: 1 addition & 0 deletions code/modules/computer4/data/terminal/medtrak/medtrak.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

write_log("[system.current_user.registered_name] accessed the records database.")

system.clear_screen(TRUE)
home_text()

/// Getter for the log file. This isn't kept as a ref because I don't want to manage the ref. :)
Expand Down
1 change: 1 addition & 0 deletions code/modules/computer4/data/terminal/netpage/netpage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
if(.)
return

system.clear_screen(TRUE)
var/title_text = list(
@"<pre style='margin: 0px'> ___ ___ __ __ ___</pre>",
@"<pre style='margin: 0px'>|\ | |__ | |__) /\ / _` |__ </pre>",
Expand Down
1 change: 1 addition & 0 deletions code/modules/computer4/data/terminal/notepad/notepad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@"<pre style='margin: 0px'> / / / ) / ' / / / ) / ' /( </pre>",
@"<pre style='margin: 0px'>_/____/___(___/_(___ _/____/___(___/_(___ _/___\__</pre>",
).Join("")
system.clear_screen(TRUE)
system.println(title_text)
system.println("Welcome to DocDock, type !help to get started.")

Expand Down
7 changes: 3 additions & 4 deletions code/modules/computer4/data/terminal/operating_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
get_computer()?.text_buffer = ""
get_computer()?.operating_system = null

/// Run a program.
/datum/c4_file/terminal_program/operating_system/proc/execute_program(datum/c4_file/terminal_program/program)
/// Run a program. cmdline can be either a string or a fully parsed datum/shell_stdin
/datum/c4_file/terminal_program/operating_system/proc/execute_program(datum/c4_file/terminal_program/program, cmdline)
if(!program)
return FALSE

Expand All @@ -155,9 +155,8 @@

if(!(program in processing_programs))
add_processing_program(program)

set_active_program(program)
program.execute(src)
program.execute(src, cmdline)
return TRUE

/// Close a program.
Expand Down
4 changes: 3 additions & 1 deletion code/modules/computer4/data/terminal/probe/probe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
for(var/path as anything in subtypesof(/datum/shell_command/probe_cmd))
commands += new path

/datum/c4_file/terminal_program/probe/execute(datum/c4_file/terminal_program/operating_system/thinkdos/system)
/datum/c4_file/terminal_program/probe/execute(datum/c4_file/terminal_program/operating_system/thinkdos/system, cmdline)
. = ..()
if(!.)
return

//If we have a cmdline, skip the printline.

system.println("NetProbe V2.4", FALSE)
system.println("Welcome to NetProbe, type 'help' to get started.")

Expand Down
21 changes: 21 additions & 0 deletions code/modules/computer4/data/terminal/test_progs/flagtest.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//Dumps the cmdline information it's called with.
/datum/c4_file/terminal_program/cmdline_test
name = "dbg_cmdline"
size = 1

/datum/c4_file/terminal_program/cmdline_test/execute(datum/c4_file/terminal_program/operating_system/thinkdos/system, cmdline)
var/datum/shell_stdin/lines = cmdline
//Assure that we have a parsed cmdline
if(!istype(lines))
lines = new /datum/shell_stdin(cmdline)

//Print our cmdline data
system.println(json_encode(list(
"raw" = lines.raw,
"command" = lines.command,
"args" = lines.arguments,
"opts" = lines.options
), JSON_PRETTY_PRINT))
//And exit.
system.unload_program(src)
return
24 changes: 24 additions & 0 deletions code/modules/computer4/data/terminal/thinkdos/thinkdos.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@
if(potential_command.try_exec(parsed_stdin.command, src, src, parsed_stdin.arguments, parsed_stdin.options))
recognized = TRUE
break
// Check if we executed a shell command, if so, break out of the while loop.
if(recognized)
continue //We aren't being re-called from unload_program(), so we have to loop back to the start here.
// Otherwise, Search the local directory for a matching program
// Argument passing doesn't exist for programs so we can just ignore it.
var/datum/c4_file/terminal_program/program_to_run = resolve_filepath(parsed_stdin.command)
if(!istype(program_to_run) || istype(program_to_run, /datum/c4_file/terminal_program/operating_system))
// If that one's not good, Search the bin directory for a matching program
program_to_run = resolve_filepath(parsed_stdin.command, get_bin_folder())

if(istype(program_to_run) && !istype(program_to_run, /datum/c4_file/terminal_program/operating_system))
execute_program(program_to_run, parsed_stdin) //This will block command queue execution.
recognized = TRUE
break


if(!recognized)
println("'[html_encode(parsed_stdin.raw)]' is not recognized as an internal or external command.")
Expand Down Expand Up @@ -216,6 +231,13 @@

return log_dir

/// Get the bin folder. The bin directory holds normal programs.
/datum/c4_file/terminal_program/operating_system/thinkdos/proc/get_bin_folder()
//the `/bin` part here is technically supposed to be reading the physical computer's default program dir.
//But that's dumb and /bin should always be correct.
return parse_directory(THINKDOS_BIN_DIRECTORY, drive.root, FALSE)


/// Create the log file, or append a startup log.
/datum/c4_file/terminal_program/operating_system/thinkdos/proc/initialize_logs()
if(command_log)
Expand All @@ -236,6 +258,8 @@
log_file.data += "<br><b>STARTUP:</b> [stationtime2text()], [stationdate2text()]"
return TRUE



/datum/c4_file/terminal_program/operating_system/thinkdos/proc/set_current_user(datum/c4_file/user/new_user)
if(current_user)
UnregisterSignal(current_user, list(COMSIG_COMPUTER4_FILE_RENAMED, COMSIG_COMPUTER4_FILE_ADDED, COMSIG_COMPUTER4_FILE_REMOVED))
Expand Down
1 change: 1 addition & 0 deletions daedalus.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3021,6 +3021,7 @@
#include "code\modules\computer4\data\terminal\rtos\pincode_door.dm"
#include "code\modules\computer4\data\terminal\rtos\simple_door_control.dm"
#include "code\modules\computer4\data\terminal\rtos\slave.dm"
#include "code\modules\computer4\data\terminal\test_progs\flagtest.dm"
#include "code\modules\computer4\data\terminal\thinkdos\thinkdos.dm"
#include "code\modules\computer4\data\terminal\thinkdos\thinkdos_commands.dm"
#include "code\modules\computer4\data\terminal\thinkdos\thinkdos_signals.dm"
Expand Down
Loading