Files
Bubberstation/code/modules/client/preferences/tgui.dm
SkyratBot a06378f871 [MIRROR] TGUI input box framework [MDB IGNORE] (#9955)
* TGUI input box framework (#63190)

About The Pull Request

Creates the framework for two new TGUI input boxes that can be toggled via game prefs.
This does not convert any actual inputs to TGUI
This does not convert any tgui_list_inputs into being toggleable
Example pictures

Input on a hand labeler. This has a MAX_LENGTH set, so it can be invalidated. Cancel always returns null. Enter button submits, if valid.
text input
(OUTDATED) Multiline input on newscaster. Newer version fills the window with a section, like the others
multiline
Sheets from a stack
number input
Why It's Good For The Game

1
So I did...

    Much sleeker input boxes
    Result should be a in place swap for most occurrences of input
    Renders casting as text/num/null obsolete but still doable
    Input validation from both sides handled
    Prefs toggle if you don't like the look

Changelog

cl
add: TGUI input boxes are on the way! You can find new preferences in the menu. They will be on by default.
/cl

* TGUI input box framework

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
2021-12-08 17:36:02 -05:00

50 lines
1.9 KiB
Plaintext

/datum/preference/toggle/tgui_fancy
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_fancy"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/toggle/tgui_fancy/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.update_static_data(client.mob)
// Determines if input boxes are in tgui or old fashioned
/datum/preference/toggle/tgui_input
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input"
savefile_identifier = PREFERENCE_PLAYER
/// Large button preference. Error text is in tooltip.
/datum/preference/toggle/tgui_input_large
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input_large"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
/datum/preference/toggle/tgui_input_large/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.send_full_update(client.mob)
/// Swapped button state - sets buttons to SS13 traditional SUBMIT/CANCEL
/datum/preference/toggle/tgui_input_swapped
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input_swapped"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/toggle/tgui_input_swapped/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.send_full_update(client.mob)
/datum/preference/toggle/tgui_lock
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_lock"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
/datum/preference/toggle/tgui_lock/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.update_static_data(client.mob)