Files
Bubberstation/code/modules/modular_computers/file_system/programs/wirecarp.dm
SkyratBot cb3b675bae [MIRROR] Tablets don't close their UI when changing program (and some fixes) [MDB IGNORE] (#19600)
* Tablets don't close their UI when changing program (and some fixes) (#73635)

## About The Pull Request

- Tablets now refresh their page when changing programs, this means the
UI will no longer close and reopen itself several times (or even have
several UIs open if shit broke hard enough).
- Removed tablet's attack self because interact already does everything
it had to do.
- Header programs now close when minimized (as there's no button to
close them in the main menu.
- Removed a lot of program UI stuff, it's now handled by the PC itself,
such as header data and ui host.
- Cut off asset sending from TGUI into it's own proc so I can re-send
assets when changing programs
- Added an ejection button for machine computers
- Fixed ID not ejecting into the user's hand when using 'Eject ID'
- Fixes a minor runtime when opening the MODsuit application without a
MODsuit already connected.

## Why It's Good For The Game

Fixes some bugs that I found with tablets

UIS now won't be flickering as bad in front of them, or have
inconsistent placement (like when you move your main menu UI, go to
Messenger, then it's back to the center of the screen).

Video of it in action

https://user-images.githubusercontent.com/53777086/221301417-78321149-0c10-475e-bd29-79f5a4ba0597.mp4

## Changelog

🆑
fix: Being in an application now properly uses the tablet's battery.
fix: Messenger and Themify apps now close when minimized, so don't count
towards the running app limit.
fix: Tablet UIs will now no longer spam open/close the UI when changing
applications
fix: Using the Eject ID button on tablets now ejects into your hand.
fix: Computers now have an Eject ID button
refactor: Cut down a lot of copy paste in tablet & program code, now
it's mostly done by the tablet.
/🆑

* Tablets don't close their UI when changing program (and some fixes)

* Update contractor_tablet.dm

* wew

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-03-10 06:09:10 +00:00

78 lines
2.7 KiB
Plaintext

/datum/computer_file/program/ntnetmonitor
filename = "wirecarp"
filedesc = "WireCarp"
category = PROGRAM_CATEGORY_MISC
program_icon_state = "comm_monitor"
extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes"
size = 12
requires_ntnet = TRUE
required_access = list(ACCESS_NETWORK) //NETWORK CONTROL IS A MORE SECURE PROGRAM.
available_on_ntnet = TRUE
tgui_id = "NtosNetMonitor"
program_icon = "network-wired"
/datum/computer_file/program/ntnetmonitor/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
switch(action)
if("resetIDS")
SSmodular_computers.intrusion_detection_alarm = FALSE
return TRUE
if("toggleIDS")
SSmodular_computers.intrusion_detection_enabled = !SSmodular_computers.intrusion_detection_enabled
return TRUE
if("purgelogs")
SSnetworks.purge_logs()
return TRUE
if("updatemaxlogs")
var/logcount = params["new_number"]
SSnetworks.update_max_log_count(logcount)
return TRUE
if("toggle_function")
SSmodular_computers.toggle_function(text2num(params["id"]))
return TRUE
if("toggle_mass_pda")
var/obj/item/modular_computer/target_tablet = locate(params["ref"]) in GLOB.TabletMessengers
if(!istype(target_tablet))
return
for(var/datum/computer_file/program/messenger/messenger_app in target_tablet.stored_files)
messenger_app.spam_mode = !messenger_app.spam_mode
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
var/list/data = list()
data["ntnetstatus"] = SSmodular_computers.check_function()
data["ntnetrelays"] = SSmodular_computers.ntnet_relays.len
data["config_softwaredownload"] = SSmodular_computers.setting_softwaredownload
data["config_communication"] = SSmodular_computers.setting_communication
data["idsstatus"] = SSmodular_computers.intrusion_detection_enabled
data["idsalarm"] = SSmodular_computers.intrusion_detection_alarm
data["ntnetlogs"] = list()
for(var/i in SSnetworks.logs)
data["ntnetlogs"] += list(list("entry" = i))
data["ntnetmaxlogs"] = SSnetworks.setting_maxlogcount
data["tablets"] = list()
for(var/obj/item/modular_computer/messenger as anything in GetViewableDevices())
var/list/tablet_data = list()
if(messenger.saved_identification)
for(var/datum/computer_file/program/messenger/messenger_app in computer.stored_files)
tablet_data["enabled_spam"] += messenger_app.spam_mode
tablet_data["name"] += messenger.saved_identification
tablet_data["ref"] += REF(messenger)
data["tablets"] += list(tablet_data)
return data
/datum/computer_file/program/ntnetmonitor/ui_static_data(mob/user)
var/list/data = ..()
data["minlogs"] = MIN_NTNET_LOGS
data["maxlogs"] = MAX_NTNET_LOGS
return data