mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
* Part 1: fix tgui * Fix overdark layering * Vector code rework * misc. tgui things * final DM side fixes * TGUI try to fix #1 * Nuclear option. Bring all TGUI files. Will begin UNTGification in later commits. * Untgify: callback * untgify : config flags & config datums * Fixes GLOBAL_VAR_INIT * Purge HASTRAIT * .dme cleanup * file by file: status_alert.dm * file by file : preference datums + remove unused content * file by file : tgui_input/text.dm * file by file : fixes asset_cache_client.dm * file by file : tgui_panel / external.dm * file by file : tgui / external.dm * file by file : tgui / states.dm * file by file : subsystems/assets.dm [unused return type] * file by file : subsystems/tgui.dm [tg-macro for process()] * file by file : asset_cache_item.dm [minor proc call fix] * file by file : fixes a mistype for datum/asset_cache_item * file by file : removes bugs and unimplemented features in asset_list.dm * multifile : some more work on asset manager * File deleted : spirtesheet tg_assets. Don't need them * Remove unused TG content, fix asset_list.dm * Fixes a few issues with wrong type paths. * remove tgui_panel : this is for tgchat/stat2, which we don't use * fix thing * misc changes to tgui.dm. Defining QDELETED macro * final TGui fix * TGUI file convert : camera console and religion screen * Works * GPS fixed + fontAwesome fixed * Mecha console control * Fixes blurry icons * fixes iconbase64 regression * Misc bug/runtimes fixes * Fixes runtime funtime * Add merch computer TGUI * Fixes TGUI ticking interfaces + MSGS * PCMC * Power Monitor working * Power monitor * Bugfixes + robot console * Fixes mecha messages * Spess dot TV * TEG * Syndicate Uplink * Bump defines and connection warning * fix? * Fucking highscores * Fixes mistakes --------- Co-authored-by: west3436 <66280799+west3436@users.noreply.github.com>
54 lines
2.3 KiB
Plaintext
54 lines
2.3 KiB
Plaintext
|
|
// Client tg_asset things
|
|
/client
|
|
var/last_completed_asset_job
|
|
var/list/sent_assets = list()
|
|
|
|
// Connection time
|
|
var/connection_time
|
|
|
|
/// Process asset cache client topic calls for `"asset_cache_confirm_arrival=[INT]"`
|
|
/client/proc/asset_cache_confirm_arrival(job_id)
|
|
var/asset_cache_job = round(text2num(job_id))
|
|
//because we skip the limiter, we have to make sure this is a valid arrival and not somebody tricking us into letting them append to a list without limit.
|
|
if (asset_cache_job > 0 && asset_cache_job <= last_asset_job && !(completed_asset_jobs["[asset_cache_job]"]))
|
|
completed_asset_jobs["[asset_cache_job]"] = TRUE
|
|
last_completed_asset_job = max(last_completed_asset_job, asset_cache_job)
|
|
else
|
|
return asset_cache_job || TRUE
|
|
|
|
|
|
/// Process asset cache client topic calls for `"asset_cache_preload_data=[HTML+JSON_STRING]"`
|
|
/client/proc/asset_cache_preload_data(data)
|
|
var/json = data
|
|
var/list/preloaded_assets = json_decode(json)
|
|
|
|
for (var/preloaded_asset in preloaded_assets)
|
|
if (copytext(preloaded_asset, findlasttext(preloaded_asset, ".")+1) in list("js", "jsm", "htm", "html"))
|
|
preloaded_assets -= preloaded_asset
|
|
continue
|
|
sent_assets |= preloaded_assets
|
|
|
|
|
|
/// Updates the client side stored json file used to keep track of what assets the client has between restarts/reconnects.
|
|
/client/proc/asset_cache_update_json()
|
|
if (world.time - connection_time < 10 SECONDS) //don't override the existing data file on a new connection
|
|
return
|
|
|
|
src << browse(json_encode(sent_assets), "file=asset_data.json&display=0")
|
|
|
|
/// Blocks until all currently sending browse and browse_rsc assets have been sent.
|
|
/// Due to byond limitations, this proc will sleep for 1 client round trip even if the client has no pending asset sends.
|
|
/// This proc will return an untrue value if it had to return before confirming the send, such as timeout or the client going away.
|
|
/client/proc/tg_browse_queue_flush(timeout = 50)
|
|
var/job = ++last_asset_job
|
|
var/t = 0
|
|
var/timeout_time = timeout
|
|
src << browse({"<script>window.location.href='byond://?asset_cache_confirm_arrival=[job]'</script>"}, "window=asset_cache_browser&file=asset_cache_send_verify.htm")
|
|
|
|
while(!completed_asset_jobs["[job]"] && t < timeout_time) // Reception is handled in Topic()
|
|
stoplag(1) // Lock up the caller until this is received.
|
|
t++
|
|
if (t < timeout_time)
|
|
return TRUE
|