[MODULAR] NIFSofts with TGUI now match the TGUI theme of the NIF (#24036)

* wew

* Update modular_skyrat/modules/modular_implants/code/nifsofts/soulcatcher.dm

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>

* Just fixing this Prettier complaint for you

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
Pinta
2023-10-04 06:34:20 +00:00
committed by GitHub
co-authored by Bloop
parent 77759aceab
commit 1e4d745ef3
8 changed files with 33 additions and 2 deletions
@@ -121,6 +121,8 @@
return FALSE
current_theme = target_theme
for(var/datum/nifsoft/installed_nifsoft as anything in loaded_nifsofts)
installed_nifsoft.update_theme()
if("activate_nifsoft")
var/datum/nifsoft/activated_nifsoft = locate(params["activated_nifsoft"]) in loaded_nifsofts
@@ -18,6 +18,8 @@
var/buying_category = NIFSOFT_CATEGORY_GENERAL
///What font awesome icon is shown next to the name of the nifsoft?
var/ui_icon = "floppy-disk"
///What UI theme do we want to display to users if this NIFSoft has TGUI?
var/ui_theme = "default"
///Can the program be installed with other instances of itself?
var/single_install = TRUE
@@ -67,6 +69,7 @@
qdel(src)
load_persistence_data()
update_theme()
/datum/nifsoft/Destroy()
if(active)
@@ -148,6 +151,15 @@
/datum/nifsoft/ui_state(mob/user)
return GLOB.conscious_state
/// Updates the theme of the NIFSoft to match the parent NIF
/datum/nifsoft/proc/update_theme()
var/obj/item/organ/internal/cyberimp/brain/nif/target_nif = parent_nif.resolve()
if(!target_nif)
return FALSE
ui_theme = target_nif.current_theme
return TRUE
/// A disk that can upload NIFSofts to a recpient with a NIFSoft installed.
/obj/item/disk/nifsoft_uploader
name = "Generic NIFSoft datadisk"
@@ -166,6 +166,7 @@
var/list/data = list()
data["messages"] = message_list
data["theme"] = ui_theme
data["receiving_data"] = receiving_data
data["transmitting_data"] = transmitting_data
@@ -94,6 +94,17 @@
persistence.nif_soulcatcher_rooms = list2params(room_list)
return TRUE
/datum/nifsoft/soulcatcher/update_theme()
. = ..()
if(!.)
return FALSE // uhoh
var/datum/component/soulcatcher/current_soulcatcher = linked_soulcatcher.resolve()
if(!istype(current_soulcatcher))
stack_trace("[src] ([REF(src)]) tried to update its theme when it was missing a linked_soulcatcher component!")
return FALSE
current_soulcatcher.ui_theme = ui_theme
/datum/modular_persistence
///A param string containing soulcatcher rooms
var/nif_soulcatcher_rooms = ""
@@ -18,6 +18,8 @@ GLOBAL_LIST_EMPTY(soulcatchers)
var/list/soulcatcher_rooms = list()
/// What soulcatcher room are verbs sending messages to?
var/datum/soulcatcher_room/targeted_soulcatcher_room
/// What theme are we using for our soulcatcher UI?
var/ui_theme = "default"
/// Are ghosts currently able to join this soulcatcher?
var/ghost_joinable = TRUE
@@ -13,6 +13,7 @@
data["ghost_joinable"] = ghost_joinable
data["require_approval"] = require_approval
data["theme"] = ui_theme
data["communicate_as_parent"] = communicate_as_parent
data["current_soul_count"] = length(get_current_souls())
data["max_souls"] = max_souls
+2 -1
View File
@@ -10,9 +10,10 @@ export const NifSoulPoem = (props, context) => {
messages = [],
receiving_data,
transmitting_data,
theme,
} = data;
return (
<Window width={500} height={700}>
<Window width={500} height={700} theme={theme}>
<Window.Content scrollable>
<Section title="Messages">
{messages.map((message) => (
+2 -1
View File
@@ -12,10 +12,11 @@ export const Soulcatcher = (props, context) => {
max_souls,
removable,
communicate_as_parent,
theme,
} = data;
return (
<Window width={520} height={400} resizable>
<Window width={520} height={400} theme={theme} resizable>
<Window.Content scrollable>
{current_rooms.map((room) => (
<Section