mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Cache asset/mappings results (#59914)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -258,7 +258,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
|
||||
|
||||
Reference in New Issue
Block a user