Files
Bubberstation/code/modules/asset_cache/asset_cache_item.dm
SkyratBot e34017e74e [MIRROR] Fix bicon(icon2html) showing full dmis, fix asset cache hashes being incorrect. (#697)
* Fix bicon, fix asset hashes being incorrect. (#53441)

icon2html will now always show the south direction unless passed a specific direction to show. Null can be explicitly passed with an atom to use the atom's direction. This is to work around icon() returning a blank icon if passed a direction that the icon doesn't define, instead of defaulting to south like the client does. This should also cut down on the number of assets generated by shift clicks

If icon2html is given an atom with an invalid icon state, it will use the atom's compile time icon_state, so smoothed icons can show their mapper's helper icon instead of the entire dmi.

Asset cache will now copy files to disk before md5ing them, to deal with byond not always returning the correct md5 for rsc references.

* Fix bicon(icon2html) showing full dmis, fix asset cache hashes being incorrect.

Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
2020-09-09 08:13:15 +02:00

42 lines
1.2 KiB
Plaintext

/**
* # asset_cache_item
*
* An internal datum containing info on items in the asset cache. Mainly used to cache md5 info for speed.
*/
/datum/asset_cache_item
var/name
var/hash
var/resource
var/ext = ""
/// Should this file also be sent via the legacy browse_rsc system
/// when cdn transports are enabled?
var/legacy = FALSE
/// Used by the cdn system to keep legacy css assets with their parent
/// css file. (css files resolve urls relative to the css file, so the
/// legacy system can't be used if the css file itself could go out over
/// the cdn)
var/namespace = null
/// True if this is the parent css or html file for an asset's namespace
var/namespace_parent = FALSE
/// TRUE for keeping local asset names when browse_rsc backend is used
var/keep_local_name = FALSE
/datum/asset_cache_item/New(name, file)
if (!isfile(file))
file = fcopy_rsc(file)
hash = md5asfile(file) //icons sent to the rsc sometimes md5 incorrectly
if (!hash)
CRASH("invalid asset sent to asset cache")
src.name = name
var/extstart = findlasttext(name, ".")
if (extstart)
ext = ".[copytext(name, extstart+1)]"
resource = file
/datum/asset_cache_item/vv_edit_var(var_name, var_value)
return FALSE
/datum/asset_cache_item/CanProcCall(procname)
return FALSE