diff --git a/code/modules/asset_cache/asset_list.dm b/code/modules/asset_cache/asset_list.dm index 221febbe14..3f9e8c3fcc 100644 --- a/code/modules/asset_cache/asset_list.dm +++ b/code/modules/asset_cache/asset_list.dm @@ -11,6 +11,7 @@ GLOBAL_LIST_EMPTY(asset_datums) /datum/asset var/_abstract = /datum/asset + var/cached_url_mappings /datum/asset/New() GLOB.asset_datums[type] = src @@ -19,6 +20,13 @@ GLOBAL_LIST_EMPTY(asset_datums) /datum/asset/proc/get_url_mappings() return list() +/// Returns a cached tgui message of URL mappings +/datum/asset/proc/get_serialized_url_mappings() + if (isnull(cached_url_mappings)) + cached_url_mappings = TGUI_CREATE_MESSAGE("asset/mappings", get_url_mappings()) + + return cached_url_mappings + /datum/asset/proc/register() return diff --git a/code/modules/tgui/tgui_window.dm b/code/modules/tgui/tgui_window.dm index b4a509c6da..08f0ad704b 100644 --- a/code/modules/tgui/tgui_window.dm +++ b/code/modules/tgui/tgui_window.dm @@ -251,7 +251,7 @@ if(istype(asset, /datum/asset/spritesheet)) var/datum/asset/spritesheet/spritesheet = asset send_message("asset/stylesheet", spritesheet.css_filename()) - send_message("asset/mappings", asset.get_url_mappings()) + send_raw_message(asset.get_serialized_url_mappings()) /** * private