tgui usr to ui.user

This commit is contained in:
Kashargul
2024-11-13 00:49:17 +01:00
parent 49d89c0059
commit 32c9f971bc
120 changed files with 1037 additions and 1061 deletions
+4 -4
View File
@@ -136,19 +136,19 @@
data["timeout"] = CLAMP01((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS))
return data
/datum/tgui_input_number/tgui_act(action, list/params)
/datum/tgui_input_number/tgui_act(action, list/params, datum/tgui/ui)
. = ..()
if (.)
return
switch(action)
if("submit")
if(!isnum(params["entry"]))
CRASH("A non number was input into tgui input number by [usr]")
CRASH("A non number was input into tgui input number by [ui.user]")
var/choice = round_value ? round(params["entry"]) : params["entry"]
if(choice > max_value)
CRASH("A number greater than the max value was input into tgui input number by [usr]")
CRASH("A number greater than the max value was input into tgui input number by [ui.user]")
if(choice < min_value)
CRASH("A number less than the min value was input into tgui input number by [usr]")
CRASH("A number less than the min value was input into tgui input number by [ui.user]")
set_entry(choice)
closed = TRUE
SStgui.close_uis(src)
+3 -3
View File
@@ -130,7 +130,7 @@
data["timeout"] = clamp((timeout - (world.time - start_time) - 1 SECONDS) / (timeout - 1 SECONDS), 0, 1)
return data
/datum/tgui_input_text/tgui_act(action, list/params)
/datum/tgui_input_text/tgui_act(action, list/params, datum/tgui/ui)
. = ..()
if (.)
return
@@ -138,9 +138,9 @@
if("submit")
if(max_length)
if(length(params["entry"]) > max_length)
CRASH("[usr] typed a text string longer than the max length")
CRASH("[ui.user] typed a text string longer than the max length")
if(encode && (length(html_encode(params["entry"])) > max_length))
to_chat(usr, span_notice("Your message was clipped due to special character usage."))
to_chat(ui.user, span_notice("Your message was clipped due to special character usage."))
set_entry(params["entry"])
closed = TRUE
SStgui.close_uis(src)