[MIRROR] Reworked PDA menu & NtOS themes [MDB IGNORE] (#19390)

* 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>

* Reworked PDA menu & NtOS themes

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
This commit is contained in:
SkyratBot
2023-02-17 09:35:34 +01:00
committed by GitHub
parent 17b58cee48
commit 9e981753ca
64 changed files with 74930 additions and 73987 deletions

View File

@@ -30,6 +30,15 @@
disk_host = null
return ..()
/**
* Used for special cases where an application
* Requires special circumstances to install on a PC
* Args:
* * potential_host - the ModPC that is attempting to store this file.
*/
/datum/computer_file/proc/can_store_file(obj/item/modular_computer/potential_host)
return TRUE
// Returns independent copy of this file.
/datum/computer_file/proc/clone(rename = FALSE)
var/datum/computer_file/temp = new type
@@ -72,3 +81,23 @@
*/
/datum/computer_file/proc/try_eject(mob/living/user, forced = FALSE)
return FALSE
/**
* Called when a computer program is shut down from the tablet's charge dying
* Arguments:
* * background - Whether the app is running in the background.
*/
/datum/computer_file/program/proc/event_powerfailure(background)
kill_program(forced = TRUE)
/**
* Called when a computer program is crashing due to any required connection being shut off.
* Arguments:
* * background - Whether the app is running in the background.
*/
/datum/computer_file/program/proc/event_networkfailure(background)
kill_program(forced = TRUE)
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
computer.visible_message(span_danger("\The [computer]'s screen briefly freezes and then shows \"NETWORK ERROR - NTNet connection lost. Please retry. If problem persists contact your system administrator.\" error."))

View File

@@ -1,16 +1,21 @@
/// Data files. Doesn't really hold many important functionalities, here for organization.
///Used to calculate how large a text file is.
#define BLOCK_SIZE 250
/**
* Base DATA file type
* Doesn't do anything, mostly here for organization.
*/
/datum/computer_file/data
/// Whether the user will be reminded that the file probably shouldn't be edited.
var/do_not_edit = FALSE
filetype = "DAT"
// /data/text files store data in string format.
// They don't contain other logic for now.
/**
* Holds data in string format.
*/
/datum/computer_file/data/text
filetype = "TXT"
/// Stored data in string format.
var/stored_text = ""
var/block_size = 250
/datum/computer_file/data/text/clone()
var/datum/computer_file/data/text/temp = ..()
@@ -19,8 +24,66 @@
// Calculates file size from amount of characters in saved string
/datum/computer_file/data/text/proc/calculate_size()
size = max(1, round(length(stored_text) / block_size))
size = max(1, round(length(stored_text) / BLOCK_SIZE))
/**
* A text file with a different filetype
* Used for flavortext
*/
/datum/computer_file/data/text/logfile
filetype = "LOG"
/**
* Ordnance data
* Holds possible experiments to do
*/
/datum/computer_file/data/ordnance
filetype = "ORD"
size = 4
/// List of experiments filtered by doppler array or populated by the tank compressor. Experiment path as key, score as value.
var/list/possible_experiments
/datum/computer_file/data/ordnance/proc/return_data()
return null
/datum/computer_file/data/ordnance/clone()
var/datum/computer_file/data/ordnance/temp = ..()
temp.possible_experiments = possible_experiments
return temp
/**
* Explosive data
* Holds a specific taychon record.
*/
/datum/computer_file/data/ordnance/explosive
filetype = "DOP"
/// Tachyon record, used for an explosive experiment.
var/datum/data/tachyon_record/explosion_record
/datum/computer_file/data/ordnance/explosive/return_data()
return explosion_record
/datum/computer_file/data/ordnance/explosive/clone()
var/datum/computer_file/data/ordnance/explosive/temp = ..()
temp.explosion_record = explosion_record
return temp
/**
* Gaseous data
* Holds a specific compressor record.
*/
/datum/computer_file/data/ordnance/gaseous
filetype = "COM"
///The gas record stored in the file.
var/datum/data/compressor_record/gas_record
/datum/computer_file/data/ordnance/gaseous/return_data()
return gas_record
/datum/computer_file/data/ordnance/gaseous/clone()
var/datum/computer_file/data/ordnance/gaseous/temp = ..()
temp.gas_record = gas_record
return temp
#undef BLOCK_SIZE

View File

@@ -17,6 +17,8 @@
var/category = PROGRAM_CATEGORY_MISC
/// Program-specific screen icon state
var/program_icon_state = null
///Boolean on whether the program will appear at the top on PDA menus, or in the app list with everything else.
var/header_program = FALSE
/// Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
var/requires_ntnet = FALSE
/// Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD and NTNET_COMMUNICATION)
@@ -170,20 +172,6 @@
return TRUE
return FALSE
/**
*
*Called by the device when it is emagged.
*
*Emagging the device allows certain programs to unlock new functions. However, the program will
*need to be downloaded first, and then handle the unlock on their own in their run_emag() proc.
*The device will allow an emag to be run multiple times, so the user can re-emag to run the
*override again, should they download something new. The run_emag() proc should return TRUE if
*the emagging affected anything, and FALSE if no change was made (already emagged, or has no
*emag functions).
**/
/datum/computer_file/program/proc/run_emag()
return FALSE
/**
* Kills the running program
*

View File

@@ -1,14 +0,0 @@
// Events are sent to the program by the computer.
// Always include a parent call when overriding an event.
// Called when the computer fails due to power loss. Override when program wants to specifically react to power loss.
/datum/computer_file/program/proc/event_powerfailure(background)
kill_program(forced = TRUE)
// Called when the network connectivity fails. Computer does necessary checks and only calls this when requires_ntnet_feature and similar variables are not met.
/datum/computer_file/program/proc/event_networkfailure(background)
kill_program(forced = TRUE)
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
computer.visible_message(span_danger("\The [computer]'s screen briefly freezes and then shows \"NETWORK ERROR - NTNet connection lost. Please retry. If problem persists contact your system administrator.\" error."))

View File

@@ -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)))

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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,
))

View File

@@ -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"

View File

@@ -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

View File

@@ -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