Files
Bubberstation/code/modules/modular_computers/file_system/programs/signalcommander.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

74 lines
2.4 KiB
Plaintext

/datum/computer_file/program/signal_commander
filename = "signaler"
filedesc = "SignalCommander"
category = PROGRAM_CATEGORY_MISC
program_icon_state = "signal"
extended_desc = "A small built-in frequency app that sends out signaller signals with the appropriate hardware."
size = 2
tgui_id = "NtosSignaler"
program_icon = "satellite-dish"
usage_flags = PROGRAM_TABLET | PROGRAM_LAPTOP
///What is the saved signal frequency?
var/signal_frequency = FREQ_SIGNALER
/// What is the saved signal code?
var/signal_code = DEFAULT_SIGNALER_CODE
/// Radio connection datum used by signalers.
var/datum/radio_frequency/radio_connection
/datum/computer_file/program/signal_commander/on_start(mob/living/user)
. = ..()
set_frequency(signal_frequency)
/datum/computer_file/program/signal_commander/kill_program(forced)
. = ..()
SSradio.remove_object(computer, signal_frequency)
/datum/computer_file/program/signal_commander/ui_data(mob/user)
var/list/data = list()
data["frequency"] = signal_frequency
data["code"] = signal_code
data["minFrequency"] = MIN_FREE_FREQ
data["maxFrequency"] = MAX_FREE_FREQ
return data
/datum/computer_file/program/signal_commander/ui_act(action, list/params)
switch(action)
if("signal")
INVOKE_ASYNC(src, PROC_REF(signal))
. = TRUE
if("freq")
var/new_signal_frequency = sanitize_frequency(unformat_frequency(params["freq"]), TRUE)
set_frequency(new_signal_frequency)
. = TRUE
if("code")
signal_code = text2num(params["code"])
signal_code = round(signal_code)
. = TRUE
if("reset")
if(params["reset"] == "freq")
signal_frequency = initial(signal_frequency)
else
signal_code = initial(signal_code)
. = TRUE
/datum/computer_file/program/signal_commander/proc/signal()
if(!radio_connection)
return
var/time = time2text(world.realtime,"hh:mm:ss")
var/turf/T = get_turf(computer)
var/logging_data
if(usr)
logging_data = "[time] <B>:</B> [usr.key] used [computer] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(signal_frequency)]/[signal_code]"
GLOB.lastsignalers.Add(logging_data)
var/datum/signal/signal = new(list("code" = signal_code), logging_data = logging_data)
radio_connection.post_signal(computer, signal)
/datum/computer_file/program/signal_commander/proc/set_frequency(new_frequency)
SSradio.remove_object(computer, signal_frequency)
signal_frequency = new_frequency
radio_connection = SSradio.add_object(computer, signal_frequency, RADIO_SIGNALER)
return