mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 22:18:27 +01:00
Chaplain, multiline stuff and decimals
This commit is contained in:
@@ -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 = -10000, timeout = 0, round_value = FALSE)
|
||||
/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value = INFINITY, min_value = -INFINITY, timeout = 0, round_value = FALSE)
|
||||
if (!user)
|
||||
user = usr
|
||||
if (!istype(user))
|
||||
@@ -135,7 +135,8 @@
|
||||
if("submit")
|
||||
if(!isnum(params["entry"]))
|
||||
CRASH("A non number was input into tgui input number by [usr]")
|
||||
var/choice = round_value ? round(params["entry"]) : params["entry"]
|
||||
//var/choice = round_value ? round(params["entry"]) : params["entry"]
|
||||
var/choice = params["entry"]
|
||||
if(choice > max_value)
|
||||
CRASH("A number greater than the max value was input into tgui input number by [usr]")
|
||||
if(choice < min_value)
|
||||
@@ -163,8 +164,9 @@
|
||||
* * default - The default value pre-populated in the input box.
|
||||
* * callback - The callback to be invoked when a choice is made.
|
||||
* * timeout - The timeout of the input box, after which the menu 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_async(mob/user, message, title, default, datum/callback/callback, timeout = 60 SECONDS)
|
||||
/proc/tgui_input_number_async(mob/user, message, title, default, datum/callback/callback, timeout = 60 SECONDS, round_value = FALSE)
|
||||
if (istext(user))
|
||||
stack_trace("tgui_input_num_async() received text for user instead of mob")
|
||||
return
|
||||
@@ -176,7 +178,7 @@
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
var/datum/tgui_input_number/async/input = new(user, message, title, default, callback, timeout)
|
||||
var/datum/tgui_input_number/async/input = new(user, message, title, default, callback, timeout, round_value)
|
||||
input.tgui_interact(user)
|
||||
|
||||
/**
|
||||
@@ -188,8 +190,8 @@
|
||||
/// The callback to be invoked by the tgui_text_input upon having a choice made.
|
||||
var/datum/callback/callback
|
||||
|
||||
/datum/tgui_input_number/async/New(mob/user, message, title, default, callback, timeout)
|
||||
..(user, title, message, default, timeout)
|
||||
/datum/tgui_input_number/async/New(mob/user, message, title, default, callback, timeout, round_value)
|
||||
..(user, title, message, default, timeout, round_value)
|
||||
src.callback = callback
|
||||
|
||||
/datum/tgui_input_number/async/Destroy(force, ...)
|
||||
|
||||
@@ -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, enter_submit = FALSE)
|
||||
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = FALSE, timeout = 0, prevent_enter = 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, enter_submit)
|
||||
var/datum/tgui_input_text/text_input = new(user, message, title, default, max_length, multiline, encode, timeout, prevent_enter)
|
||||
text_input.tgui_interact(user)
|
||||
text_input.wait()
|
||||
if (text_input)
|
||||
@@ -74,9 +74,9 @@
|
||||
/// The title of the TGUI window
|
||||
var/title
|
||||
|
||||
var/enter_submit
|
||||
var/prevent_enter
|
||||
|
||||
/datum/tgui_input_text/New(mob/user, message, title, default, max_length, multiline, encode, timeout, enter_submit)
|
||||
/datum/tgui_input_text/New(mob/user, message, title, default, max_length, multiline, encode, timeout, prevent_enter)
|
||||
src.default = default
|
||||
src.encode = encode
|
||||
src.max_length = max_length
|
||||
@@ -87,7 +87,7 @@
|
||||
src.timeout = timeout
|
||||
start_time = world.time
|
||||
QDEL_IN(src, timeout)
|
||||
src.enter_submit = enter_submit
|
||||
src.prevent_enter = prevent_enter
|
||||
|
||||
/datum/tgui_input_text/Destroy(force, ...)
|
||||
SStgui.close_uis(src)
|
||||
@@ -123,7 +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
|
||||
data["prevent_enter"] = prevent_enter
|
||||
return data
|
||||
|
||||
/datum/tgui_input_text/tgui_data(mob/user)
|
||||
|
||||
Reference in New Issue
Block a user