Chat tags use assets (#7962)

This commit is contained in:
Raeschen
2024-03-14 19:35:57 +01:00
committed by GitHub
parent 1199bdcf89
commit 72d7980e60
2 changed files with 7 additions and 7 deletions

View File

@@ -349,16 +349,17 @@
//The icon var could be local in the proc, but it's a waste of resources
// to always create it and then throw it out.
/var/icon/text_tag_icons = 'icons/chattags.dmi'
/var/list/text_tag_cache = list()
GLOBAL_LIST_EMPTY(text_tag_cache)
/proc/create_text_tag(var/tagname, var/tagdesc = tagname, var/client/C = null)
if(!(C && C.is_preference_enabled(/datum/client_preference/chat_tags)))
return tagdesc
if(!text_tag_cache[tagname])
var/icon/tag = icon(text_tag_icons, tagname)
text_tag_cache[tagname] = tag
if(!GLOB.text_tag_cache[tagname])
var/datum/asset/spritesheet/chatassets = get_asset_datum(/datum/asset/spritesheet/chat)
GLOB.text_tag_cache[tagname] = {"<span class='[chatassets.icon_class_name(tagname)] text_tag'></span>"}
if(!C.tgui_panel.is_ready() || C.tgui_panel.oldchat)
return "<IMG src='\ref[text_tag_icons]' class='text_tag' iconstate='[tagname]'" + (tagdesc ? " alt='[tagdesc]'" : "") + ">"
return icon2html(text_tag_cache[tagname], C, extra_classes = "text_tag")
return GLOB.text_tag_cache[tagname]
/proc/create_text_tag_old(var/tagname, var/tagdesc = tagname, var/client/C = null)
if(!(C && C.is_preference_enabled(/datum/client_preference/chat_tags)))

View File

@@ -2,5 +2,4 @@
name = "chat"
/datum/asset/spritesheet/chat/create_spritesheets()
//honk
//This function has to be overridden otherwise it will generate runtimes
InsertAll("", text_tag_icons) //Chomp - OOC, LOOC ect icons