mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
[MIRROR] tgui say update (#10323)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a4493ca5ff
commit
ab171de574
@@ -31,6 +31,8 @@
|
||||
var/datum/tgui_window/window
|
||||
/// Boolean for whether the tgui_say was opened by the user.
|
||||
var/window_open
|
||||
/// Any partial packets that we have received from TGUI, waiting to be sent
|
||||
var/partial_packets
|
||||
|
||||
/** Creates the new input window to exist in the background. */
|
||||
/datum/tgui_say/New(client/client, id)
|
||||
@@ -64,14 +66,14 @@
|
||||
/datum/tgui_say/proc/load()
|
||||
window_open = FALSE
|
||||
|
||||
var/minimum_height = client?.prefs?.read_preference(/datum/preference/numeric/tgui_say_height) || 1
|
||||
var/minimu_width = client?.prefs?.read_preference(/datum/preference/numeric/tgui_say_width) || 1
|
||||
var/minimum_width = client?.prefs?.read_preference(/datum/preference/numeric/tgui_say_width) || 1
|
||||
var/minimum_height = (client?.prefs?.read_preference(/datum/preference/numeric/tgui_say_height) || 1) * 20 + 10
|
||||
winset(client, "tgui_say", "pos=410,400;size=360,30;is-visible=0;")
|
||||
|
||||
window.send_message("props", list(
|
||||
lightMode = client?.prefs?.read_preference(/datum/preference/toggle/tgui_say_light),
|
||||
minimumWidth = minimum_width,
|
||||
minimumHeight = minimum_height,
|
||||
minimumWidth = minimu_width,
|
||||
maxLength = max_length,
|
||||
))
|
||||
|
||||
@@ -106,7 +108,7 @@
|
||||
* The equivalent of ui_act, this waits on messages from the window
|
||||
* and delegates actions.
|
||||
*/
|
||||
/datum/tgui_say/proc/on_message(type, payload)
|
||||
/datum/tgui_say/proc/on_message(type, payload, href_list)
|
||||
if(type == "ready")
|
||||
load()
|
||||
return TRUE
|
||||
@@ -128,6 +130,28 @@
|
||||
start_typing(payload["channel"])
|
||||
return TRUE
|
||||
if(type == "entry" || type == "force")
|
||||
var/id = href_list["packetId"]
|
||||
if(!isnull(id))
|
||||
id = text2num(id)
|
||||
|
||||
var/total = text2num(href_list["totalPackets"])
|
||||
if(id == 1)
|
||||
if(total > MAX_MESSAGE_CHUNKS)
|
||||
return
|
||||
|
||||
partial_packets = new /list(total)
|
||||
|
||||
partial_packets[id] = href_list["packet"]
|
||||
|
||||
if(id != total)
|
||||
return
|
||||
|
||||
var/assembled_payload = ""
|
||||
for(var/packet in partial_packets)
|
||||
assembled_payload += packet
|
||||
|
||||
payload = json_decode(assembled_payload)
|
||||
partial_packets = null
|
||||
handle_entry(type, payload)
|
||||
return TRUE
|
||||
if(type == "lenwarn")
|
||||
|
||||
@@ -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 = INFINITY, multiline = FALSE, encode = FALSE, timeout = 0, prevent_enter = FALSE)
|
||||
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = 130000, multiline = FALSE, encode = FALSE, timeout = 0, prevent_enter = FALSE) // 130k limit due to chunking limit... if we need longer that needs fixing
|
||||
if (!user)
|
||||
user = usr
|
||||
if (!istype(user))
|
||||
|
||||
Reference in New Issue
Block a user