From ed3cd54f34bdfa1a01d25143f0aaf57b565340ff Mon Sep 17 00:00:00 2001 From: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Date: Fri, 20 Sep 2024 07:33:54 -0700 Subject: [PATCH] Add tgfont namespace (#3343) chat icons --- code/__DEFINES/fonts.dm | 2 ++ code/game/objects/items/devices/PDA/cart.dm | 2 +- code/modules/asset_cache/asset_list_items.dm | 14 +++++++++++--- code/modules/emoji/emoji_parse.dm | 4 ++-- code/modules/tgui_panel/tgui_panel.dm | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/fonts.dm b/code/__DEFINES/fonts.dm index 32a08f38861b..8ffecbbe20d5 100644 --- a/code/__DEFINES/fonts.dm +++ b/code/__DEFINES/fonts.dm @@ -19,3 +19,5 @@ #define SHARE "Share Tech Mono" GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE))) + +#define EMOJI_SET 'icons/emoji.dmi' diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 65bda2aa1f54..5df5e96dd0ac 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -446,7 +446,7 @@ Code: if(!emoji_table) var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat) var/list/collate = list("
") - for(var/emoji in sortList(icon_states(icon('icons/emoji.dmi')))) + for(var/emoji in sortList(icon_states(icon(EMOJI_SET)))) var/tag = sheet.icon_tag("emoji-[emoji]") collate += "" collate += "
[emoji][tag]

" diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index f252e6a2c207..635e589ecd36 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -167,6 +167,15 @@ ) parents = list("font-awesome.css" = 'html/font-awesome/css/all.min.css') +/datum/asset/simple/namespaced/tgfont + assets = list( + "tgfont.eot" = file("tgui/packages/tgfont/static/tgfont.eot"), + "tgfont.woff2" = file("tgui/packages/tgfont/static/tgfont.woff2"), + ) + parents = list( + "tgfont.css" = file("tgui/packages/tgfont/static/tgfont.css"), + ) + /datum/asset/simple/fonts assets = list( "sga.ttf" = 'html/sga.ttf' @@ -181,8 +190,8 @@ /datum/asset/spritesheet/chat name = "chat" -/datum/asset/spritesheet/chat/register() - InsertAll("emoji", 'icons/emoji.dmi') +/datum/asset/spritesheet/chat/create_spritesheets() + InsertAll("emoji", EMOJI_SET) // pre-loading all lanugage icons also helps to avoid meta InsertAll("language", 'icons/misc/language.dmi') // catch languages which are pulling icons from another file @@ -192,7 +201,6 @@ if (icon != 'icons/misc/language.dmi') var/icon_state = initial(L.icon_state) Insert("language-[icon_state]", icon, icon_state=icon_state) - ..() /datum/asset/simple/lobby assets = list( diff --git a/code/modules/emoji/emoji_parse.dm b/code/modules/emoji/emoji_parse.dm index 185341d294c2..16e1eeef6c95 100644 --- a/code/modules/emoji/emoji_parse.dm +++ b/code/modules/emoji/emoji_parse.dm @@ -2,7 +2,7 @@ . = text if(!CONFIG_GET(flag/emojis)) return - var/static/list/emojis = icon_states(icon('icons/emoji.dmi')) + var/static/list/emojis = icon_states(icon(EMOJI_SET)) var/parsed = "" var/pos = 1 var/search = 0 @@ -34,7 +34,7 @@ . = text if(!CONFIG_GET(flag/emojis)) return - var/static/list/emojis = icon_states(icon('icons/emoji.dmi')) + var/static/list/emojis = icon_states(icon(EMOJI_SET)) var/final = "" //only tags are added to this var/pos = 1 var/search = 0 diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm index 44fbffd917ce..1a6fcb37e429 100644 --- a/code/modules/tgui_panel/tgui_panel.dm +++ b/code/modules/tgui_panel/tgui_panel.dm @@ -49,6 +49,7 @@ get_asset_datum(/datum/asset/simple/tgui_panel), )) window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome)) + window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/tgfont)) window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat)) request_telemetry() addtimer(CALLBACK(src, PROC_REF(on_initialize_timed_out)), 5 SECONDS)