Multiple Bugfixes

This commit is contained in:
ItsSelis
2022-06-20 17:35:04 +02:00
parent 080ce72154
commit d60e0655a2
8 changed files with 29 additions and 21 deletions
+4 -4
View File
@@ -40,7 +40,7 @@
set hidden = 1
set_typing_indicator(TRUE)
var/message = tgui_input_text(usr, "Type your message:", "Say")
var/message = tgui_input_text(usr, "Type your message:", "Say", enter_submit = TRUE)
set_typing_indicator(FALSE)
if(message)
@@ -51,7 +51,7 @@
set hidden = 1
set_typing_indicator(TRUE)
var/message = tgui_input_text(usr, "Type your message:", "Emote", multiline = TRUE)
var/message = tgui_input_text(usr, "Type your message:", "Emote", multiline = TRUE, enter_submit = TRUE)
set_typing_indicator(FALSE)
if(message)
@@ -62,7 +62,7 @@
set name = ".Whisper"
set hidden = 1
var/message = tgui_input_text(usr, "Type your message:", "Whisper")
var/message = tgui_input_text(usr, "Type your message:", "Whisper", enter_submit = TRUE)
if(message)
whisper(message)
@@ -71,7 +71,7 @@
set name = ".Subtle"
set hidden = 1
var/message = tgui_input_text(usr, "Type your message:", "Subtle", multiline = TRUE)
var/message = tgui_input_text(usr, "Type your message:", "Subtle", multiline = TRUE, enter_submit = TRUE)
if(message)
me_verb_subtle(message)
+6 -6
View File
@@ -180,17 +180,17 @@
/datum/tgui/proc/send_full_update(custom_data, force)
if(!user.client || !initialized || closing)
return
if(!COOLDOWN_FINISHED(src, refresh_cooldown))
refreshing = TRUE
addtimer(CALLBACK(src, .proc/send_full_update), TGUI_REFRESH_FULL_UPDATE_COOLDOWN, TIMER_UNIQUE)
return
refreshing = FALSE
//if(!COOLDOWN_FINISHED(src, refresh_cooldown))
//refreshing = TRUE
//addtimer(CALLBACK(src, .proc/send_full_update), TGUI_REFRESH_FULL_UPDATE_COOLDOWN, TIMER_UNIQUE)
//return
//refreshing = FALSE
var/should_update_data = force || status >= STATUS_UPDATE
window.send_message("update", get_payload(
custom_data,
with_data = should_update_data,
with_static_data = TRUE))
COOLDOWN_START(src, refresh_cooldown, TGUI_REFRESH_FULL_UPDATE_COOLDOWN)
//COOLDOWN_START(src, refresh_cooldown, TGUI_REFRESH_FULL_UPDATE_COOLDOWN)
/**
* public
+2 -2
View File
@@ -10,7 +10,7 @@
* * timeout - The timeout of the alert, after which the modal will close and qdel itself. Set to zero for no timeout.
* * autofocus - The bool that controls if this alert should grab window focus.
*/
/proc/tgui_alert(mob/user, message = "", title, list/buttons = list("Ok"), timeout = 0, autofocus = TRUE)
/proc/tgui_alert(mob/user, message = "", title, list/buttons = list("Ok"), timeout = 0, autofocus = TRUE, strict_byond = FALSE)
if (istext(buttons))
stack_trace("tgui_alert() received text for buttons instead of list")
return
@@ -31,7 +31,7 @@
return tgui_input_list(user, message, title, buttons, timeout, autofocus)
// Client does NOT have tgui_input on: Returns regular input
if(!usr.client.prefs.tgui_input_mode)
if(!usr.client.prefs.tgui_input_mode || strict_byond)
if(length(buttons) == 2)
return alert(user, message, title, buttons[1], buttons[2])
if(length(buttons) == 3)
+1 -1
View File
@@ -15,7 +15,7 @@
* * timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout.
* * round_value - whether the inputted number is rounded down into an integer.
*/
/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value = 10000, min_value = 0, timeout = 0, round_value = TRUE)
/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value = 10000, min_value = -10000, timeout = 0, round_value = FALSE)
if (!user)
user = usr
if (!istype(user))
+7 -3
View File
@@ -15,7 +15,7 @@
* * encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
* * timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.
*/
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = FALSE, timeout = 0)
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = FALSE, timeout = 0, enter_submit = FALSE)
if (istext(user))
stack_trace("tgui_input_text() received text for user instead of mob")
return
@@ -39,7 +39,7 @@
return input(user, message, title, default) as message|null
else
return input(user, message, title, default) as text|null
var/datum/tgui_input_text/text_input = new(user, message, title, default, max_length, multiline, encode, timeout)
var/datum/tgui_input_text/text_input = new(user, message, title, default, max_length, multiline, encode, timeout, enter_submit)
text_input.tgui_interact(user)
text_input.wait()
if (text_input)
@@ -74,7 +74,9 @@
/// The title of the TGUI window
var/title
/datum/tgui_input_text/New(mob/user, message, title, default, max_length, multiline, encode, timeout)
var/enter_submit
/datum/tgui_input_text/New(mob/user, message, title, default, max_length, multiline, encode, timeout, enter_submit)
src.default = default
src.encode = encode
src.max_length = max_length
@@ -85,6 +87,7 @@
src.timeout = timeout
start_time = world.time
QDEL_IN(src, timeout)
src.enter_submit = enter_submit
/datum/tgui_input_text/Destroy(force, ...)
SStgui.close_uis(src)
@@ -120,6 +123,7 @@
data["placeholder"] = default // Default is a reserved keyword
data["swapped_buttons"] = !usr.client.prefs.tgui_swapped_buttons
data["title"] = title
data["enter_submit"] = enter_submit
return data
/datum/tgui_input_text/tgui_data(mob/user)
+1 -1
View File
@@ -600,7 +600,7 @@
var/list/available_options = list("Examine", "Eject", "Move")
if(ishuman(target))
available_options += "Transform"
intent = tgui_alert(user, "What would you like to do with [target]?", "Vore Pick", available_options)
intent = tgui_alert(user, "What would you like to do with [target]?", "Vore Pick", available_options, strict_byond = TRUE)
switch(intent)
if("Examine")
var/list/results = target.examine(host)
@@ -12,6 +12,7 @@ type TextInputData = {
placeholder: string;
timeout: number;
title: string;
enter_submit: boolean;
};
export const TextInputModal = (_, context) => {
@@ -24,6 +25,7 @@ export const TextInputModal = (_, context) => {
placeholder,
timeout,
title,
enter_submit,
} = data;
const [input, setInput] = useLocalState<string>(
context,
@@ -49,8 +51,10 @@ export const TextInputModal = (_, context) => {
<Window.Content
onEscape={() => act('cancel')}
onEnter={(event) => {
act('submit', { entry: input });
event.preventDefault();
if (enter_submit) {
act('submit', { entry: input });
event.preventDefault();
}
}}>
<Section fill>
<Stack fill vertical>
@@ -76,7 +80,7 @@ export const TextInputModal = (_, context) => {
/** Gets the user input and invalidates if there's a constraint. */
const InputArea = (props, context) => {
const { act, data } = useBackend<TextInputData>(context);
const { max_length, multiline } = data;
const { max_length, multiline, enter_submit } = data;
const { input, onType } = props;
return (
File diff suppressed because one or more lines are too long