Files
Bubberstation/code/modules/modular_computers/file_system/programs/statusdisplay.dm
John Willard 1c4166c81c Tablet UI update (mostly fixes) (#74844)
## About The Pull Request

Tablet UIs are now changed when opening/closing an app, instead of
constantly checking for a UI change every ui update.

Program UI acts no longer call parent, as it was unnecessary, Computers
are the ones that should be calling it.

Fixes a ton of problems with static data not updating, such as in
Messenger, ID management, Siliconnect, and Chat client

Chat Client's Admin mode also works again, which was broken when
accesses to check was turned into a list.

Turns a few lists in Robocontrol into static ones when we aren't
changing anything, and makes it actually scan your ID's access.

Fixes budget ordering being unable to show the cart/call the cargo
shuttle.

## Why It's Good For The Game

While I can't seem to find a single issue report on any of the above,
these are still problems that should be fixed.

## Changelog

🆑
fix: SiliConnect can download borg logs again.
fix: The RD can once again enable Admin mode on Wirecarp
fix: NT IRN can once again see the shopping cart and call the cargo
shuttle.
fix: Chat Client, ID Management and Messenger should now update their
UIs properly.
code: PDAs will hopefully not lag as much when clicking on buttons (such
as in ID management).
/🆑
2023-04-26 23:29:20 -06:00

87 lines
2.5 KiB
Plaintext

/datum/computer_file/program/status
filename = "statusdisplay"
filedesc = "Status Display"
program_icon = "signal"
program_icon_state = "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
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