mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
245 lines
11 KiB
Plaintext
245 lines
11 KiB
Plaintext
// /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!
|
|
filedesc = "Unknown Program" // User-friendly name of this program.
|
|
var/program_type = PROGRAM_NORMAL // Program type, used to determine if program runs in background or not.
|
|
var/required_access_run // List of required accesses to run the program.
|
|
var/required_access_download // List of required accesses to download the program.
|
|
var/requires_access_to_run = PROGRAM_ACCESS_ONE // Whether the program checks for required_access when run. (1 = requires single access, 2 = requires single access from list, 3 = requires all access from list)
|
|
var/requires_access_to_download = PROGRAM_ACCESS_ONE // Whether the program checks for required_access when downloading. (1 = requires single access, 2 = requires single access from list, 3 = requires all access from list)
|
|
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/extended_desc = "N/A" // Short description of this program's function.
|
|
var/program_icon_state // Program-specific screen icon state
|
|
var/program_key_icon_state // Program-specific keyboard icon state (really only applies to consoles but can be used for other purposes like having mix-n-match screens)
|
|
var/requires_ntnet = FALSE // Set to TRUE for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
|
|
var/requires_ntnet_feature = FALSE // Optional, if above is set to TRUE checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
|
|
var/ntnet_status = TRUE // 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 // Optional string that describes what NTNet server/system this program connects to. Used in default logging.
|
|
var/available_on_ntnet = TRUE // Whether the program can be downloaded from NTNet. Set to 0 to disable.
|
|
var/available_on_syndinet = FALSE // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
|
|
var/computer_emagged = FALSE // Set to TRUE if computer that's running us was emagged. Computer updates this every Process() tick
|
|
var/ui_header // 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/color = "#FFFFFF" // The color of light the computer should emit when this program is open.
|
|
var/service_state = PROGRAM_STATE_DISABLED // PROGRAM_STATE_KILLED or PROGRAM_STATE_ACTIVE - specifies whether this program's service is running.
|
|
var/silent = FALSE
|
|
/// Name of the TGUI Interface
|
|
var/tgui_id
|
|
/// Theme of this TGUI interface
|
|
var/tgui_theme = "scc"
|
|
/// If this TGUI should autoupdate or not.
|
|
var/ui_auto_update = TRUE
|
|
|
|
// TO BE DEPRECATED:
|
|
var/datum/nano_module/NM // If the program uses NanoModule, put it here and it will be automagically opened. Otherwise implement ui_interact.
|
|
var/nanomodule_path // Path to nanomodule, make sure to set this if implementing new program.
|
|
|
|
/datum/computer_file/program/New(var/obj/item/modular_computer/comp)
|
|
..()
|
|
if(comp)
|
|
if(comp == "Compless") // we're software in the air, don't need a computer
|
|
return
|
|
else if(istype(comp))
|
|
computer = comp
|
|
else
|
|
crash_with("Comp was of the wrong type for [src.filename]")
|
|
else
|
|
crash_with("Comp was not sent for [src.filename]")
|
|
|
|
/datum/computer_file/program/Destroy()
|
|
computer.idle_threads -= src
|
|
computer.enabled_services -= src
|
|
computer = null
|
|
. = ..()
|
|
|
|
/datum/computer_file/program/ui_host()
|
|
return computer.ui_host()
|
|
|
|
/datum/computer_file/program/ui_interact(mob/user, datum/tgui/ui)
|
|
. = ..()
|
|
if(tgui_id) // we shouldn't use ui_interact on TGUI programs; see [code/modules/modular_computers/computers/modular_computer/ui.dm]
|
|
stack_trace("Computer program tgUI [src] with tgui_id [tgui_id] called ui_interact on program datum")
|
|
if(computer)
|
|
. = computer.ui_interact(user, ui)
|
|
|
|
/datum/computer_file/program/update_static_data(mob/user, datum/tgui/ui)
|
|
. = ..()
|
|
if(computer)
|
|
. = computer.update_static_data(user, ui)
|
|
|
|
/datum/computer_file/program/update_static_data_for_all_viewers()
|
|
. = ..()
|
|
if(computer)
|
|
. = computer.update_static_data_for_all_viewers()
|
|
|
|
/datum/computer_file/program/clone(var/rename = FALSE, var/computer)
|
|
var/datum/computer_file/program/temp = ..(rename, computer)
|
|
temp.required_access_run = required_access_run
|
|
temp.required_access_download = required_access_download
|
|
temp.nanomodule_path = nanomodule_path
|
|
temp.filedesc = filedesc
|
|
temp.program_icon_state = program_icon_state
|
|
temp.requires_ntnet = requires_ntnet
|
|
temp.requires_ntnet_feature = requires_ntnet_feature
|
|
temp.usage_flags = usage_flags
|
|
return temp
|
|
|
|
// Relays icon update to the computer.
|
|
/datum/computer_file/program/proc/update_computer_icon()
|
|
if(computer)
|
|
computer.update_icon()
|
|
|
|
// Attempts to create a log in global ntnet datum. Returns 1 on success, 0 on fail.
|
|
/datum/computer_file/program/proc/generate_network_log(var/text)
|
|
if(computer)
|
|
return computer.add_log(text)
|
|
return FALSE
|
|
|
|
/datum/computer_file/program/proc/is_supported_by_hardware(var/hardware_flag = 0, var/loud = FALSE, var/mob/user = null)
|
|
if(!(hardware_flag & usage_flags))
|
|
if(loud && computer && user)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Hardware Error - Incompatible software\"."))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/datum/computer_file/program/proc/get_signal(var/specific_action = 0)
|
|
if(computer)
|
|
return computer.get_ntnet_status(specific_action)
|
|
return FALSE
|
|
|
|
// Called by Process() on device that runs us, once every tick.
|
|
/datum/computer_file/program/proc/process_tick()
|
|
return TRUE
|
|
|
|
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
|
// User has to wear their ID or have it inhand for ID Scan to work.
|
|
// Can also be called manually, with optional parameter being access_to_check to scan the user's ID
|
|
// Check type determines how the access should be checked PROGRAM_ACCESS_ONE, PROGRAM_ACCESS_LIST_ONE, PROGRAM_ACCESS_LIST_ALL
|
|
/datum/computer_file/program/proc/can_run(var/mob/user, var/loud = FALSE, var/access_to_check, var/check_type)
|
|
// Defaults to required_access_run
|
|
if(!access_to_check)
|
|
access_to_check = required_access_run
|
|
|
|
//Default to requires_access_to_run
|
|
if(!check_type)
|
|
check_type = requires_access_to_run
|
|
|
|
// No required_access, allow it.
|
|
if(!access_to_check || !requires_access_to_run)
|
|
return TRUE
|
|
|
|
if(!istype(user))
|
|
return FALSE
|
|
|
|
var/obj/item/card/id/I = user.GetIdCard()
|
|
if(!I)
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"RFID Error - Unable to scan ID.\"."))
|
|
return FALSE
|
|
|
|
if(check_type == PROGRAM_ACCESS_ONE) //Check for single access
|
|
if(access_to_check in I.access)
|
|
return TRUE
|
|
else if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
return FALSE
|
|
else if(check_type == PROGRAM_ACCESS_LIST_ONE)
|
|
for(var/check in access_to_check) //Loop through all the accesse's to check
|
|
if(check in I.access) //Success on first match
|
|
return TRUE
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
else if(check_type == PROGRAM_ACCESS_LIST_ALL)
|
|
for(var/check in access_to_check) //Loop through all the accesse's to check
|
|
if(!(check in I.access)) //Fail on first miss
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
return FALSE
|
|
else // Should never happen - So fail silently
|
|
return FALSE
|
|
|
|
// Override to set when a program shouldn't appear in the program list
|
|
/datum/computer_file/program/proc/program_hidden()
|
|
return FALSE
|
|
|
|
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
|
// User has to wear their ID or have it inhand for ID Scan to work.
|
|
// Can also be called manually, with optional parameter being access_to_check to scan the user's ID
|
|
// Check type determines how the access should be checked PROGRAM_ACCESS_ONE, PROGRAM_ACCESS_LIST_ONE, PROGRAM_ACCESS_LIST_ALL
|
|
/datum/computer_file/program/proc/can_download(var/mob/user, var/loud = FALSE, var/access_to_check, var/check_type)
|
|
// Defaults to required_access_run
|
|
if(!access_to_check)
|
|
access_to_check = required_access_download
|
|
|
|
//Default to requires_access_to_run
|
|
if(!check_type)
|
|
check_type = requires_access_to_download
|
|
|
|
if(istype(computer, /obj/item/modular_computer/silicon/pai))
|
|
check_type = requires_access_to_run
|
|
access_to_check = required_access_run
|
|
|
|
// No required_access, allow it.
|
|
if(!access_to_check || !requires_access_to_download)
|
|
return TRUE
|
|
|
|
if(!istype(user))
|
|
return FALSE
|
|
|
|
var/obj/item/card/id/I = user.GetIdCard()
|
|
if(!I)
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"RFID Error - Unable to scan ID.\"."))
|
|
return FALSE
|
|
|
|
if(check_type == PROGRAM_ACCESS_ONE) //Check for single access
|
|
if(access_to_check in I.access)
|
|
return TRUE
|
|
else if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
return FALSE
|
|
else if(check_type == PROGRAM_ACCESS_LIST_ONE)
|
|
for(var/check in access_to_check) //Loop through all the accesse's to check
|
|
if(check in I.access) //Success on first match
|
|
return TRUE
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
return FALSE
|
|
else if(check_type == PROGRAM_ACCESS_LIST_ALL)
|
|
for(var/check in access_to_check) //Loop through all the accesse's to check
|
|
if(!(check in I.access)) //Fail on first miss
|
|
if(loud)
|
|
to_chat(user, SPAN_WARNING("\The [computer] flashes, \"Access Denied.\"."))
|
|
return FALSE
|
|
else // Should never happen - So fail silently
|
|
return FALSE
|
|
|
|
// This attempts to retrieve header data for NanoUIs. If implementing completely new device of different type than existing ones
|
|
// always include the device here in this proc. This proc basically relays the request to whatever is running the program.
|
|
/datum/computer_file/program/proc/get_header_data()
|
|
if(computer)
|
|
return computer.get_header_data()
|
|
|
|
|
|
/datum/computer_file/program/Topic(href, href_list)
|
|
if(..())
|
|
return TRUE
|
|
if(computer)
|
|
return computer.Topic(href, href_list)
|
|
|
|
// Relays the call to nano module, if we have one
|
|
/datum/computer_file/program/proc/check_eye(var/mob/user)
|
|
if(NM)
|
|
return NM.check_eye(user)
|
|
else
|
|
return -1
|
|
|
|
/datum/computer_file/program/proc/message_dead(var/message)
|
|
for(var/mob/M in player_list)
|
|
if(M.stat == DEAD && (M.client && M.client.prefs.toggles & CHAT_GHOSTEARS))
|
|
if(isnewplayer(M))
|
|
continue
|
|
to_chat(M, message)
|