Files
Bubberstation/code/modules/modular_computers/file_system/programs/statusdisplay.dm
magatsuchi cd1b891d79 Modular Tablets: Converting PDAs to the NtOS System (#65755)
Converts PDA functions and applications over to modular tablets and devices, namely the messaging function. HREF data code is quite honestly clunky and difficult to work with, as I've definitely experienced whilst working on this. By moving from this system over the easier to read (and frankly, easier to add to) TGUI system, you get cleaner looking and more user friendly UIs and a greater degree of standardization amongst other UIs.

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2022-04-20 03:08:41 +03:00

56 lines
1.4 KiB
Plaintext

/datum/computer_file/program/status
filename = "statusdisplay"
filedesc = "Status Display"
program_icon = "signal"
program_icon_state = "generic"
requires_ntnet = TRUE
size = 4
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
/datum/computer_file/program/status/proc/SendSignal()
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
if(!frequency)
return
var/datum/signal/status_signal = new(list("command" = "message"))
status_signal.data["msg1"] = reject_bad_text(upper_text || "", MAX_STATUS_LINE_LENGTH)
status_signal.data["msg2"] = reject_bad_text(lower_text || "", MAX_STATUS_LINE_LENGTH)
frequency.post_signal(computer, status_signal)
/datum/computer_file/program/status/proc/SetText(position, text)
switch(position)
if("upper")
upper_text = text
if("lower")
lower_text = text
/datum/computer_file/program/status/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
switch(action)
if("stat_send")
SendSignal()
if("stat_update")
SetText(params["position"], params["text"]) // i hate the player i hate the player
/datum/computer_file/program/status/ui_data(mob/user)
var/list/data = get_header_data()
data["upper"] = upper_text
data["lower"] = lower_text
return data