[MIRROR] tgui say update (#10323)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-03-06 18:06:09 -07:00
committed by GitHub
parent a4493ca5ff
commit ab171de574
11 changed files with 118 additions and 33 deletions

View File

@@ -45,6 +45,8 @@
var/datum/tgui/parent_ui
/// Children of this UI
var/list/children = list()
/// Any partial packets that we have received from TGUI, waiting to be sent
var/partial_packets
/**
* public
@@ -349,6 +351,28 @@
// Pass act type messages to tgui_act
if(type && copytext(type, 1, 5) == "act/")
var/act_type = copytext(type, 5)
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
#ifdef TGUI_DEBUGGING
log_tgui(user, "Action: [act_type] [href_list["payload"]], Window: [window.id], Source: [src_object]")
#endif