[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>
This commit is contained in:
SkyratBot
2020-09-09 08:13:15 +02:00
committed by GitHub
parent a1ac3a6b42
commit e34017e74e
3 changed files with 30 additions and 9 deletions

View File

@@ -1124,12 +1124,13 @@ GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of ico
var/list/partial = splittext(iconData, "{")
return replacetext(copytext_char(partial[2], 3, -5), "\n", "")
/proc/icon2html(thing, target, icon_state, dir, frame = 1, moving = FALSE, sourceonly = FALSE)
/proc/icon2html(thing, target, icon_state, dir = SOUTH, frame = 1, moving = FALSE, sourceonly = FALSE)
if (!thing)
return
var/key
var/icon/I = thing
if (!target)
return
if (target == world)
@@ -1153,11 +1154,18 @@ GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of ico
return SSassets.transport.get_asset_url(name)
return "<img class='icon icon-misc' src='[SSassets.transport.get_asset_url(name)]'>"
var/atom/A = thing
if (isnull(dir))
dir = A.dir
I = A.icon
if (isnull(icon_state))
icon_state = A.icon_state
I = A.icon
if (!(icon_state in icon_states(I, 1)))
icon_state = initial(A.icon_state)
if (isnull(dir))
dir = initial(A.dir)
if (isnull(dir))
dir = A.dir
if (ishuman(thing)) // Shitty workaround for a BYOND issue.
var/icon/temp = I
I = icon()