Files
Bubberstation/code/modules/modular_computers/file_system/programs/statusdisplay.dm
John Willard ddd3f53943 PDA general maintenance (NTNet downloader rework) (#79741)
## About The Pull Request

I deleted the documentation file of ModPCs because it was barebones and
had no new information to give that autodoc couldn't. Just to make sure
this isn't a net-negative, I improved on much of the autodoc and
comments in general around ModPC code to help people understand easier
what's going on around it.
I also renamed vars that were too easily confused with other var names,
and reworked the ntnet downloader a little;
- it now has a search bar
- it now has more sections to scroll through, hopefully making it more
accurate and easy to find what you need.
- also organized the apps that were previously shoved in 'other'.
- i also upgraded it to a .tsx because why not

video demonstration


https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc

## Why It's Good For The Game

Adds in a lot of comments that were previously missing, clears up some
sources of confusion within ModPC code, and improves NTNet Downloader,
something I've procrastinated on doing for a very long time now.

## Changelog

🆑
qol: NTNet Downloader now has a search bar, and programs are now better
sorted.
/🆑
2023-11-19 19:00:18 -05:00

98 lines
2.9 KiB
Plaintext

/datum/computer_file/program/status
filename = "statusdisplay"
filedesc = "Status Display"
program_icon = "signal"
program_open_overlay = "generic"
requires_ntnet = TRUE
size = 1
extended_desc = "An app used to change the message on the station status displays."
tgui_id = "NtosStatus"
usage_flags = PROGRAM_ALL
available_on_ntnet = FALSE
var/upper_text = ""
var/lower_text = ""
/**
* Post status display radio packet.
* Arguments:
* * command - the status display command
* * data1 - the data1 value, as defined by status displays
* * data2 - the data2 value, as defined by status displays
*/
/datum/computer_file/program/status/proc/post_status(command, data1, data2)
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
if(!frequency)
return
var/datum/signal/status_signal = new(list("command" = command))
switch(command)
if("message")
status_signal.data["top_text"] = data1
status_signal.data["bottom_text"] = data2
if("alert")
status_signal.data["picture_state"] = data1
frequency.post_signal(src, status_signal)
/**
* Post a message to status displays
* Arguments:
* * upper - Top text
* * lower - Bottom text
*/
/datum/computer_file/program/status/proc/post_message(upper, lower)
post_status("message", upper, lower)
log_game("[key_name(usr)] has changed the station status display message to \"[upper] [lower]\" [loc_name(usr)]")
/**
* Post a picture to status displays
* Arguments:
* * picture - The picture name
*/
/datum/computer_file/program/status/proc/post_picture(picture)
if (!(picture in GLOB.status_display_approved_pictures))
return
if(picture in GLOB.status_display_state_pictures)
post_status(picture)
else
if(picture == "currentalert") // You cannot set Code Blue display during Code Red and similiar
switch(SSsecurity_level.get_current_level_as_number())
if(SEC_LEVEL_DELTA)
post_status("alert", "deltaalert")
if(SEC_LEVEL_RED)
post_status("alert", "redalert")
if(SEC_LEVEL_BLUE)
post_status("alert", "bluealert")
if(SEC_LEVEL_GREEN)
post_status("alert", "greenalert")
else
post_status("alert", picture)
log_game("[key_name(usr)] has changed the station status display message to \"[picture]\" [loc_name(usr)]")
/datum/computer_file/program/status/ui_act(action, list/params, datum/tgui/ui)
switch(action)
if("setStatusMessage")
upper_text = reject_bad_text(params["upperText"] || "", MAX_STATUS_LINE_LENGTH)
lower_text = reject_bad_text(params["lowerText"] || "", MAX_STATUS_LINE_LENGTH)
post_message(upper_text, lower_text)
if("setStatusPicture")
post_picture(params["picture"])
/datum/computer_file/program/status/ui_static_data(mob/user)
var/list/data = list()
data["maxStatusLineLength"] = MAX_STATUS_LINE_LENGTH
return data
/datum/computer_file/program/status/ui_data(mob/user)
var/list/data = list()
data["upperText"] = upper_text
data["lowerText"] = lower_text
return data