[MIRROR] Fixes issues with closing apps on tablets [MDB IGNORE] (#20969)

* Fixes issues with closing apps on tablets (#75117)

## About The Pull Request

- Fixes background apps not reloading the UI
- Standardizes opening/closing/backgrounding apps
- Simplifies the way apps are closed instead of having 2 procs, one on
the PC and one on the program, being named the same thing (wtf)
- Removes program states. They existed so computers can know to update
their UI every process tick, but since we now do this event based, this
is no longer needed, which is good.
- Replaces the 'forced' arg from kill_program as it was completely
unused, with ``reload_ui``, which is now used to open the UI on close,
and not to when we don't want it to.
- Closing background apps no longer reloads the entire UI
- Responding to an NT Message will no longer open the UI on your face.

## Why It's Good For The Game

Closes https://github.com/tgstation/tgstation/issues/75046
Closes https://github.com/tgstation/tgstation/issues/75108

Makes tablet UIs more responsive and lag less, not checking if a program
is closed every process to close it, and makes responding to messages
not a hassle every time.
Also makes the code easier to understand/read,

## Changelog

🆑
fix: Tablets' minimize apps feature works again.
/🆑

* Fixes issues with closing apps on tablets

* Update tablet.dm

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-05-08 23:02:51 +01:00
committed by GitHub
parent f1b1e8b109
commit c50e7c03b6
21 changed files with 88 additions and 99 deletions
@@ -23,7 +23,10 @@
/datum/computer_file/Destroy(force)
if(computer)
computer.remove_file(src)
if(src == computer.active_program)
computer.active_program = null
if(src in computer.idle_threads)
computer.idle_threads.Remove(src)
computer = null
if(disk_host)
disk_host.remove_file(src)
@@ -87,8 +90,8 @@
* Arguments:
* * background - Whether the app is running in the background.
*/
/datum/computer_file/program/proc/event_powerfailure(background)
kill_program(forced = TRUE)
/datum/computer_file/program/proc/event_powerfailure()
kill_program()
/**
* Called when a computer program is crashing due to any required connection being shut off.
@@ -96,7 +99,7 @@
* * background - Whether the app is running in the background.
*/
/datum/computer_file/program/proc/event_networkfailure(background)
kill_program(forced = TRUE)
kill_program()
if(background)
computer.visible_message(span_danger("\The [computer]'s screen displays a \"Process [filename].[filetype] (PID [rand(100,999)]) terminated - Network Error\" error"))
else