[ready]Makes bIcon better (#29690)

Goonchat will use the asset cache, you now have to specify who to send the icons too.

Goonchat will now load icons in the background, displaying them once they load. this prevents the message from being delayed while the icons are sent.

Icons that aren't preloaded using the asset cache system will not render on ie8 clients. This is because of a ie8 bug that prevents changes on runtime created images from rendering.
This commit is contained in:
Kyle Spier-Swenson
2017-08-13 15:40:50 -07:00
committed by oranges
parent d7da0b0de4
commit f2cf4c2f5c
67 changed files with 356 additions and 220 deletions
+45
View File
@@ -138,6 +138,13 @@ You can set verify to TRUE if you want send() to sleep until the client has the
/proc/register_asset(var/asset_name, var/asset)
SSassets.cache[asset_name] = asset
//Generated names do not include file extention.
//Used mainly for code that deals with assets in a generic way
//The same asset will always lead to the same asset name
/proc/generate_asset_name(var/file)
return "asset.[md5(fcopy_rsc(file))]"
//These datums are used to populate the asset cache, the proc "register()" does this.
//all of our asset datums, used for referring to these later
@@ -170,6 +177,33 @@ GLOBAL_LIST_EMPTY(asset_datums)
send_asset_list(client,assets,verify)
//Generates assets based on iconstates of a single icon
/datum/asset/simple/icon_states
var/icon
var/direction = SOUTH
var/frame = 1
var/movement_states = FALSE
var/prefix = "default" //asset_name = "[prefix].[icon_state_name].png"
var/generic_icon_names = FALSE //generate icon filenames using generate_asset_name() instead the above format
verify = FALSE
/datum/asset/simple/icon_states/register()
for(var/icon_state_name in icon_states(icon))
var/asset = icon(icon, icon_state_name, direction, frame, movement_states)
if (!asset)
continue
asset = fcopy_rsc(asset) //dedupe
var/asset_name = sanitize_filename("[prefix].[icon_state_name].png")
if (generic_icon_names)
asset_name = "[generate_asset_name(asset)].png"
assets[asset_name] = asset
..()
//DEFINITIONS FOR ASSET DATUMS START HERE.
/datum/asset/simple/tgui
@@ -306,3 +340,14 @@ GLOBAL_LIST_EMPTY(asset_datums)
for(var/path in typesof(/datum/html_interface))
var/datum/html_interface/hi = new path()
hi.registerResources()
//this exists purely to avoid meta by pre-loading all language icons.
/datum/asset/language/register()
for(var/path in typesof(/datum/language))
set waitfor = FALSE
var/datum/language/L = new path ()
L.get_icon()
/datum/asset/simple/icon_states/emojis
icon = 'icons/emoji.dmi'
generic_icon_names = TRUE
+1 -1
View File
@@ -627,7 +627,7 @@ GLOBAL_LIST(external_rsc_urls)
)
spawn (10) //removing this spawn causes all clients to not get verbs.
//Precache the client with all other assets slowly, so as to not block other browse() calls
getFilesSlow(src, SSassets.cache, register_asset = FALSE)
getFilesSlow(src, SSassets.preload, register_asset = FALSE)
//Hook, override it to run code when dir changes
+1 -1
View File
@@ -55,7 +55,7 @@
var/keyname = key
if(prefs.unlock_content)
if(prefs.toggles & MEMBER_PUBLIC)
keyname = "<font color='[prefs.ooccolor ? prefs.ooccolor : GLOB.normal_ooc_colour]'>[bicon(icon('icons/member_content.dmi', "blag"))][keyname]</font>"
keyname = "<font color='[prefs.ooccolor ? prefs.ooccolor : GLOB.normal_ooc_colour]'>[icon2html('icons/member_content.dmi', world, "blag")][keyname]</font>"
for(var/client/C in GLOB.clients)
if(C.prefs.chat_toggles & CHAT_OOC)