Updates Part Three

This commit is contained in:
Unknown
2019-04-03 18:20:23 -04:00
parent 05e51d5a80
commit b0c818b737
19 changed files with 164 additions and 65 deletions

View File

@@ -5,7 +5,7 @@
var/required_access = null // List of required accesses to *run* the program.
var/datum/nano_module/NM = null // If the program uses NanoModule, put it here and it will be automagically opened. Otherwise implement ui_interact.
var/nanomodule_path = null // Path to nanomodule, make sure to set this if implementing new program.
var/running = 0 // Set to 1 when the program is run and back to 0 when it's stopped.
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.
@@ -96,13 +96,13 @@
NM.program = src // Set the program reference to separate variable, instead.
if(requires_ntnet && network_destination)
generate_network_log("Connection opened to [network_destination].")
running = 1
program_state = PROGRAM_STATE_ACTIVE
return 1
return 0
// Use this proc to kill the program. Designed to be implemented by each program if it requires on-quit logic, such as the NTNRC client.
/datum/computer_file/program/proc/kill_program(var/forced = 0)
running = 0
program_state = PROGRAM_STATE_KILLED
if(network_destination)
generate_network_log("Connection to [network_destination] closed.")
if(NM)
@@ -113,7 +113,7 @@
// This is called every tick when the program is enabled. Ensure you do parent call if you override it. If parent returns 1 continue with UI initialisation.
// It returns 0 if it can't run or if NanoModule was used instead. I suggest using NanoModules where applicable.
/datum/computer_file/program/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!running) // Our program was closed. Close the ui if it exists.
if(program_state != PROGRAM_STATE_ACTIVE) // Our program was closed. Close the ui if it exists.
if(ui)
ui.close()
return computer.ui_interact(user)
@@ -129,6 +129,7 @@
// Calls beginning with "PC_" are reserved for computer handling (by whatever runs the program)
// ALWAYS INCLUDE PARENT CALL ..() OR DIE IN FIRE.
/datum/computer_file/program/Topic(href, href_list)
if(..())
return 1
if(computer)
computer.Topic(href, href_list)
..()
return computer.Topic(href, href_list)