mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-30 13:17:00 +01:00
reworks game preferences (characters v2 staging) (#6310)
Co-authored-by: silicons <no@you.cat> Co-authored-by: LordME <58342752+TheLordME@users.noreply.github.com>
This commit is contained in:
co-authored by
silicons
LordME
parent
9f1b911556
commit
39bc14bb4a
@@ -8,8 +8,7 @@
|
||||
* without having to deal with copypaste code
|
||||
*
|
||||
* todo: for now, we just use expected_type and typecast. we want to use pointers in the future.
|
||||
*
|
||||
* todo: there's no way to push custom data at the moment, which makes modules not too advantageous in certain cases.
|
||||
* todo: maybe hold off on that pointer idea
|
||||
*
|
||||
* todo: /datum/tgui_module/push_ui_data() should route to host automatically if host registers modules.
|
||||
* todo: rework module registration system. /datum procs: register_ui_module(), unregister_ui_module() hooked to model del, for automatic inclusion in ui.
|
||||
|
||||
@@ -409,7 +409,6 @@
|
||||
expected_type = /datum/computer_file/program/card_mod
|
||||
var/datum/computer_file/program/program
|
||||
|
||||
|
||||
/datum/tgui_module/card_mod/standard/id_computer/ntos/New(datum/host)
|
||||
. = ..()
|
||||
program = host
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
*/
|
||||
/datum/tgui/New(mob/user, datum/src_object, interface, title, datum/tgui/parent_ui)
|
||||
log_tgui(user,
|
||||
"new [interface] fancy [user?.client?.prefs.tgui_fancy]",
|
||||
// "new [interface] fancy [user?.client?.prefs.tgui_fancy]",
|
||||
"new [interface] fancy 1",
|
||||
src_object = src_object)
|
||||
src.user = user
|
||||
src.src_object = src_object
|
||||
@@ -112,7 +113,9 @@
|
||||
if(!window.is_ready())
|
||||
window.initialize(
|
||||
strict_mode = TRUE,
|
||||
fancy = user.client.prefs.tgui_fancy,
|
||||
// todo: do we need that lmao
|
||||
// fancy = user.client.prefs.tgui_fancy,
|
||||
fancy = TRUE,
|
||||
assets = list(
|
||||
get_asset_datum(/datum/asset/simple/tgui),
|
||||
))
|
||||
@@ -275,8 +278,10 @@
|
||||
"refreshing" = refreshing,
|
||||
"window" = list(
|
||||
"key" = window_key,
|
||||
"fancy" = user.client.prefs.tgui_fancy,
|
||||
"locked" = user.client.prefs.tgui_lock,
|
||||
// "fancy" = user.client.prefs.tgui_fancy,
|
||||
// "locked" = user.client.prefs.tgui_lock,
|
||||
"fancy" = TRUE,
|
||||
"locked" = TRUE,
|
||||
),
|
||||
"client" = list(
|
||||
"ckey" = user.client.ckey,
|
||||
@@ -291,12 +296,12 @@
|
||||
var/list/modules = list()
|
||||
// static first
|
||||
if(with_static_data)
|
||||
json_data["static"] = src_object.ui_static_data(user, src, state)
|
||||
json_data["static"] = src_object.ui_static_data(user, src)
|
||||
for(var/datum/module as anything in modules_registered)
|
||||
var/id = modules_registered[module]
|
||||
modules[id] = module.ui_static_data(user, src, TRUE)
|
||||
if(with_data)
|
||||
json_data["data"] = src_object.ui_data(user, src, state)
|
||||
json_data["data"] = src_object.ui_data(user, src)
|
||||
for(var/datum/module as anything in (with_static_data? modules_registered : modules_processed))
|
||||
var/id = modules_registered[module]
|
||||
modules[id] = modules[id] | module.ui_data(user, src, TRUE)
|
||||
@@ -459,6 +464,8 @@
|
||||
/**
|
||||
* Registers a datum as a module into this UI.
|
||||
*
|
||||
* todo: why is 'interface' a param again..?
|
||||
*
|
||||
* @params
|
||||
* * module - the module in question
|
||||
* * id - the id to use for the module
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//* This file is explicitly licensed under the MIT license. *//
|
||||
//* Copyright (c) 2023 Citadel Station developers. *//
|
||||
|
||||
/**
|
||||
* holds the context of a module's embedding into an UI
|
||||
*/
|
||||
/datum/tgui_module_context
|
||||
/// thing being controlled
|
||||
var/datum/delegate
|
||||
/// person doing the controlling
|
||||
var/datum/event_args/actor/actor
|
||||
/// the host ui
|
||||
var/datum/tgui/ui
|
||||
|
||||
#warn /datum/tgui/proc/register_functional_module(datum/target = src)
|
||||
|
||||
/datum/tgui_module_context/New(datum/host, datum/delegate, datum/event_args/actor/actor, datum/tgui/ui)
|
||||
src.delegate = delegate
|
||||
src.host = host
|
||||
src.actor = actor
|
||||
src.ui = ui
|
||||
|
||||
|
||||
/datum/tgui_module_context/proc/tgui_context()
|
||||
return list(
|
||||
"host" = ui.src_object,
|
||||
)
|
||||
|
||||
// todo: this file is unticked and is basically a placeholder for modules v3
|
||||
// more in tgui_module_function.dm
|
||||
@@ -0,0 +1,31 @@
|
||||
//* This file is explicitly licensed under the MIT license. *//
|
||||
//* Copyright (c) 2023 Citadel Station developers. *//
|
||||
|
||||
/**
|
||||
* holds the behavior of a module's embedding into an UI
|
||||
*/
|
||||
/datum/tgui_module_function
|
||||
/// tgui interface
|
||||
var/tgui_interface
|
||||
|
||||
// todo: this file is unticked and is basically a placeholder for modules v3
|
||||
// tl;dr
|
||||
// instead of the overhead of modules-per-datum
|
||||
// why not singleton datum with context datums made and destroyde when uis are opened/closed?
|
||||
|
||||
/datum/tgui_module_function/proc/static_data(datum/tgui_module_context/context)
|
||||
return list(
|
||||
"$tgui" = tgui_interface,
|
||||
"$context" = context.tgui_context(),
|
||||
)
|
||||
|
||||
/datum/tgui_module_function/proc/data(datum/tgui_module_context/context)
|
||||
return list()
|
||||
|
||||
/**
|
||||
* remember to stop propagation if ..() is truthy.
|
||||
*
|
||||
* @return TRUE if handled
|
||||
*/
|
||||
/datum/tgui_module_function/proc/act(datum/tgui_module_context/context, action, list/params)
|
||||
return FALSE
|
||||
Reference in New Issue
Block a user