Reworked PDA menu & NtOS themes (#73070)

## About The Pull Request

This is a port/rework of
https://github.com/yogstation13/Yogstation/pull/15735 - I changed a lot
of how it acted (some themes are locked behind maintenance apps).

The original author allowed this port to happen, and I really liked how
it looked there so I'd like to add it here.

### Applications

Removes the hardware configurator application, as all it did was show
you your space and battery now that all hardware was removed. These are
things your PC does by default, so it was just a waste of space.
Adds a Theme manager application instead, which allows you to change
your PDA's theme at will.
Adds a new Maintenance application that will give a new theme, however
it will also increase the size of the theme manager app itself as it's
bloatware.

### Menu

There's now a bar at the top of the menu showing 'special' tablet apps
which, for one reason or another, should stand out from the rest of the
apps. Currently this is PDA messenger and the Theme manager

Flashlight and Flashlight color is now only an icon, and is shown on the
same line as Updating you ID


https://cdn.discordapp.com/attachments/961874788706574386/1069621173693972551/2023-01-30_09-10-52.mov


![image](https://user-images.githubusercontent.com/53777086/215501361-5ea3086e-2ff5-4ab1-bde4-8a3d14014fce.png)

### Themes

Adds a lot of themes to choose from, although SOME are hidden behind
Maintenance applications, which will give you a random theme. These are
bloatware however, so they come with some extra cost to the app's
required space storage.

Themes are now supported on ALL APPLICATIONS! If you have a computer
theme, you will have that theme in EVERY app you enter, rather than just
a select few.
ALSO also, emagging the tablet will automatically set & unlock the
Syndicate theme, which makes your PDA obvious but you can disguise it if
you wish through just re-painting it to something else.


https://cdn.discordapp.com/attachments/828923843829432340/1069565383155122266/2023-01-30_05-29-53.mov

### Preferences

This also adds a pref for theme, reworking the ringtone code to work
with it as well. I also removed 2 entirely unused PDA prefs just 'cause.

Screenshot not up-to-date, they now have proper names.

![image](https://user-images.githubusercontent.com/53777086/215463669-0fe9951a-71f8-4b71-a97d-b79b5a2f945a.png)

### Other stuff

Made defines for device_themes
Added support for special app-side checks to download files
Fixed programs downloading themselves TWICE because defines all had the
same definition
Removes the Chemistry computer disk as it was empty due to chemistry
app's removal
Removes the 'run_emag' proc, since apps can directly refer to the
computer to check for emag status instead.
Moved over and added better documentation on data computer files, and
moved the ordnance ones to the same file as the others.

## Why It's Good For The Game

It makes PDAs a lot more customizable while adding more features to
maintenance applications. I think the themes look cool and it fits with
PDAs being "personal" anyways.

I also explained most of my other arguments in the about section, such
as the hardware configuration application.

## Changelog

🆑 Chubbygummibear & JohnFulpWillard
add: A ton of new NtOS themes, which are accessible by the new Themify
application that comes with all PCs.
add: Emagging a PC now defaults it to the Syndicate option (and adds it
to go back to it if you wish)
add: There's a new maintenance app that gives you rarer themes
qol: The NtOS Main menu was moved around, added "header" applications
that are shown where the Flashlight is, such as your Theme manager and
PDA messenger.
code: Made defines for device_themes
code: Added support for special app-side checks to download files
code: Removes the 'run_emag' proc, since apps can directly refer to the
computer to check for emag status instead.
fix: Programs no longer download twice.
del: Removes the Chemistry computer disk as it was empty due to
chemistry app's removal
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
John Willard
2023-02-17 01:14:24 +00:00
committed by GitHub
parent c799663605
commit c58cbb4dfb
64 changed files with 1294 additions and 351 deletions
@@ -10,7 +10,6 @@
size = 5
tgui_id = "NtosCyborgRemoteMonitor"
program_icon = "project-diagram"
var/emagged = FALSE ///Bool of if this app has already been emagged
var/list/loglist = list() ///A list to copy a borg's IC log list into
var/mob/living/silicon/robot/DL_source ///reference of a borg if we're downloading a log, or null if not.
var/DL_progress = -1 ///Progress of current download, 0 to 100, -1 for no current download
@@ -26,12 +25,6 @@
DL_progress = 0
return ..()
/datum/computer_file/program/borg_monitor/run_emag()
if(emagged)
return FALSE
emagged = TRUE
return TRUE
/datum/computer_file/program/borg_monitor/tap(atom/A, mob/living/user, params)
var/mob/living/silicon/robot/borgo = A
if(!istype(borgo) || !borgo.modularInterface)
@@ -154,7 +147,7 @@
/datum/computer_file/program/borg_monitor/proc/checkID()
var/obj/item/card/id/ID = computer.GetID()
if(!ID)
if(emagged)
if(computer.obj_flags & EMAGGED)
return "STDERR:UNDF"
return FALSE
return ID.registered_name
@@ -170,10 +163,6 @@
available_on_ntnet = FALSE
available_on_syndinet = TRUE
transfer_access = list()
tgui_id = "NtosCyborgRemoteMonitorSyndicate"
/datum/computer_file/program/borg_monitor/syndicate/run_emag()
return FALSE
/datum/computer_file/program/borg_monitor/syndicate/evaluate_borg(mob/living/silicon/robot/R)
if(!is_valid_z_level(get_turf(computer), get_turf(R)))
@@ -1,34 +0,0 @@
// This is special hardware configuration program.
// It is to be used only with modular computers.
// It allows you to toggle components of your device.
/datum/computer_file/program/computerconfig
filename = "compconfig"
filedesc = "Hardware Configuration Tool"
extended_desc = "This program allows configuration of computer's hardware"
program_icon_state = "generic"
undeletable = TRUE
size = 4
available_on_ntnet = FALSE
requires_ntnet = FALSE
tgui_id = "NtosConfiguration"
program_icon = "cog"
/datum/computer_file/program/computerconfig/ui_data(mob/user)
// No computer connection, we can't get data from that.
if(!computer)
return FALSE
var/list/data = get_header_data()
data["disk_size"] = computer.max_capacity
data["disk_used"] = computer.used_capacity
data["power_usage"] = computer.last_power_usage
data["battery"] = null
if(computer.internal_cell)
data["battery"] = list(
"max" = computer.internal_cell.maxcharge,
"charge" = round(computer.internal_cell.charge),
)
return data
@@ -70,6 +70,8 @@
var/datum/computer_file/F = computer.find_file_by_name(params["name"], computer.inserted_disk)
if(!F || !istype(F))
return
if(!computer.can_store_file(F))
return FALSE
var/datum/computer_file/C = F.clone(FALSE)
computer.store_file(C)
return TRUE
@@ -0,0 +1,44 @@
/datum/computer_file/program/maintenance/theme
filename = "theme"
filedesc = "Theme holder"
extended_desc = "Holds a theme you can add to your Modular PC to set in the Themify application. Makes the application use more space"
size = 2
///The type of theme we have
var/theme_name
/datum/computer_file/program/maintenance/theme/New()
. = ..()
filename = "[theme_name] Theme"
/datum/computer_file/program/maintenance/theme/can_store_file(obj/item/modular_computer/potential_host)
. = ..()
if(!.)
return FALSE
var/datum/computer_file/program/themeify/theme_app = locate() in potential_host.stored_files
//no theme app, no themes!
if(!theme_app)
return FALSE
//don't get the same one twice
if(theme_app.imported_themes.Find(theme_name))
return FALSE
return TRUE
///Called post-installation of an application in a computer, after 'computer' var is set.
/datum/computer_file/program/maintenance/theme/on_install()
//add the theme to the computer and increase its size to match
var/datum/computer_file/program/themeify/theme_app = locate() in computer.stored_files
if(theme_app)
theme_app.imported_themes += theme_name
theme_app.size += size
qdel(src)
return ..()
/datum/computer_file/program/maintenance/theme/cat
theme_name = CAT_THEME_NAME
/datum/computer_file/program/maintenance/theme/lightmode
theme_name = LIGHT_THEME_NAME
/datum/computer_file/program/maintenance/theme/spooky
theme_name = ELDRITCH_THEME_NAME
@@ -17,7 +17,6 @@
var/download_completion = FALSE //GQ of downloaded data.
var/download_netspeed = 0
var/downloaderror = ""
var/emagged = FALSE
var/list/main_repo
var/list/antag_repo
@@ -34,13 +33,6 @@
main_repo = SSmodular_computers.available_station_software
antag_repo = SSmodular_computers.available_antag_software
/datum/computer_file/program/ntnetdownload/run_emag()
if(emagged)
return FALSE
emagged = TRUE
return TRUE
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(filename)
if(downloaded_file)
return FALSE
@@ -51,7 +43,7 @@
return FALSE
// Attempting to download antag only program, but without having emagged/syndicate computer. No.
if(PRG.available_on_syndinet && !emagged)
if(PRG.available_on_syndinet && !(computer.obj_flags & EMAGGED))
return FALSE
if(!computer || !computer.can_store_file(PRG))
@@ -142,7 +134,7 @@
data["disk_size"] = computer.max_capacity
data["disk_used"] = computer.used_capacity
data["emagged"] = emagged
data["emagged"] = (computer.obj_flags & EMAGGED)
var/list/repo = antag_repo | main_repo
var/list/program_categories = list()
@@ -159,7 +151,7 @@
"installed" = !!computer.find_file_by_name(programs.filename),
"compatible" = check_compatibility(programs),
"size" = programs.size,
"access" = emagged && programs.available_on_syndinet ? TRUE : programs.can_run(user,transfer = TRUE, access = access),
"access" = (computer.obj_flags & EMAGGED) && programs.available_on_syndinet ? TRUE : programs.can_run(user,transfer = TRUE, access = access),
"verifiedsource" = programs.available_on_ntnet,
))
@@ -7,6 +7,7 @@
extended_desc = "This program allows old-school communication with other modular devices."
size = 0
undeletable = TRUE // It comes by default in tablets, can't be downloaded, takes no space and should obviously not be able to be deleted.
header_program = TRUE
available_on_ntnet = FALSE
usage_flags = PROGRAM_TABLET
ui_header = "ntnrc_idle.gif"
@@ -20,7 +20,7 @@
. = ..()
if(.)
var/obj/item/modular_computer/pda/silicon/tablet = computer
if(tablet.device_theme == "syndicate")
if(tablet.device_theme == PDA_THEME_SYNDICATE)
program_icon_state = "command-syndicate"
return TRUE
return FALSE
@@ -0,0 +1,38 @@
/datum/computer_file/program/themeify
filename = "themeify"
filedesc = "Themeify"
extended_desc = "This program allows configuration of your device's theme."
program_icon_state = "generic"
undeletable = TRUE
size = 0
header_program = TRUE
available_on_ntnet = TRUE
requires_ntnet = FALSE
tgui_id = "NtosThemeConfigure"
program_icon = "paint-roller"
///List of all themes imported from maintenance apps.
var/list/imported_themes = list()
/datum/computer_file/program/themeify/ui_data(mob/user)
var/list/data = get_header_data()
if(computer.obj_flags & EMAGGED)
data["themes"] += list(list("theme_name" = SYNDICATE_THEME_NAME, "theme_ref" = GLOB.pda_name_to_theme[SYNDICATE_THEME_NAME]))
for(var/theme_key in GLOB.default_pda_themes + imported_themes)
data["themes"] += list(list("theme_name" = theme_key, "theme_ref" = GLOB.pda_name_to_theme[theme_key]))
return data
/datum/computer_file/program/themeify/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("PRG_change_theme")
var/selected_theme = params["selected_theme"]
if(!GLOB.default_pda_themes.Find(selected_theme) && !imported_themes.Find(selected_theme) && !(computer.obj_flags & EMAGGED))
return FALSE
computer.device_theme = GLOB.pda_name_to_theme[selected_theme]
return TRUE