mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 21:19:00 +01:00
OOC Emoji 2.0 - TG Edition (#25012)
* Didn't work * It works * Emojipedia * Some emoji sorting * lol * Remove a lot of shit emoji * Update emojipedia.dm * Observer and ghost-bar emoji * Msay emoji * Emoji sorting and updates * Make emoji centered * Clueless and trollface * Mowzers * +taa * Another rebuild * TRUE and Rebuild
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
/client/proc/cmd_admin_say(msg as text)
|
||||
set name = "Asay" //Gave this shit a shorter name so you only have to time out "asay" rather than "admin say" to use it --NeoFite
|
||||
set hidden = 1
|
||||
if(!check_rights(R_ADMIN)) return
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
|
||||
if(!msg) return
|
||||
msg = emoji_parse(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
var/datum/asays/asay = new(usr.ckey, usr.client.holder.rank, msg, world.timeofday)
|
||||
GLOB.asays += asay
|
||||
@@ -60,7 +62,7 @@
|
||||
else if(!check_rights(R_ADMIN|R_MOD)) // Catch any other non-admins trying to use this proc
|
||||
return
|
||||
|
||||
msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
|
||||
msg = emoji_parse(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
|
||||
log_mentorsay(msg, src)
|
||||
mob.create_log(OOC_LOG, "MSAY: [msg]")
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
|
||||
for(var/icon_state_name in icon_states(I))
|
||||
for(var/direction in directions)
|
||||
var/prefix2 = length(directions) ? "[dir2text(direction)]-" : ""
|
||||
var/prefix2 = length(directions) > 1 ? "[dir2text(direction)]-" : ""
|
||||
Insert("[prefix][prefix2][icon_state_name]", I, icon_state=icon_state_name, dir=direction)
|
||||
|
||||
/datum/asset/spritesheet/proc/css_tag()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/datum/asset/spritesheet/emoji
|
||||
name = "emoji"
|
||||
|
||||
/datum/asset/spritesheet/emoji/create_spritesheets()
|
||||
InsertAll("emoji", EMOJI_SET)
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/asset/simple/safe
|
||||
keep_local_name = TRUE
|
||||
assets = list(
|
||||
"safe_dial.png" = 'icons/safe_dial.png'
|
||||
"safe_dial.png" = 'icons/ui_icons/safe_dial.png'
|
||||
)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/// Turns :ai: into an emoji in text.
|
||||
/proc/emoji_parse(text)
|
||||
if(!text)
|
||||
return text
|
||||
. = text
|
||||
var/static/list/emojis = icon_states(icon(EMOJI_SET))
|
||||
var/parsed = ""
|
||||
var/pos = 1
|
||||
var/search = 0
|
||||
var/emoji = ""
|
||||
while(TRUE)
|
||||
search = findtext(text, ":", pos)
|
||||
parsed += copytext(text, pos, search)
|
||||
if(search)
|
||||
pos = search
|
||||
search = findtext(text, ":", pos + length(text[pos]))
|
||||
if(search)
|
||||
emoji = lowertext(copytext(text, pos + length(text[pos]), search))
|
||||
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/emoji)
|
||||
var/tag = sheet.icon_tag("emoji-[emoji]")
|
||||
if(tag)
|
||||
parsed += tag
|
||||
pos = search + length(text[pos])
|
||||
else
|
||||
parsed += copytext(text, pos, search)
|
||||
pos = search
|
||||
emoji = ""
|
||||
continue
|
||||
else
|
||||
parsed += copytext(text, pos, search)
|
||||
break
|
||||
return parsed
|
||||
@@ -0,0 +1,37 @@
|
||||
/client/verb/emojipedia()
|
||||
set name = "Emojipedia"
|
||||
set category = "OOC"
|
||||
set desc = "Literally an emojipedia, a list of all the emoji available for OOC use."
|
||||
|
||||
var/datum/ui_module/emojipedia/emojipedia = new()
|
||||
emojipedia.ui_interact(usr)
|
||||
|
||||
/datum/ui_module/emojipedia
|
||||
name = "Emojipedia"
|
||||
/// Store the list of potential emojis here.
|
||||
var/static/list/emoji_list = icon_states(icon(EMOJI_SET))
|
||||
|
||||
/datum/ui_module/emojipedia/ui_state(mob/user)
|
||||
return GLOB.always_state
|
||||
|
||||
/datum/ui_module/emojipedia/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Emojipedia", name)
|
||||
ui.autoupdate = FALSE
|
||||
ui.open()
|
||||
|
||||
/datum/ui_module/emojipedia/ui_static_data(mob_user)
|
||||
var/list/data = list()
|
||||
|
||||
for(var/emoji in emoji_list)
|
||||
data["emoji_list"] += list(list(
|
||||
"name" = emoji,
|
||||
))
|
||||
|
||||
return data
|
||||
|
||||
/datum/ui_module/emojipedia/ui_assets(mob/user)
|
||||
return list(
|
||||
get_asset_datum(/datum/asset/spritesheet/emoji),
|
||||
)
|
||||
@@ -4,6 +4,9 @@
|
||||
if(!message)
|
||||
return
|
||||
|
||||
if(GLOB.configuration.general.enable_ooc_emoji)
|
||||
message = emoji_parse(message)
|
||||
|
||||
return say_dead(message)
|
||||
|
||||
/mob/dead/observer/handle_track(message, verb = "says", mob/speaker = null, speaker_name, atom/follow_target, hard_to_hear)
|
||||
|
||||
@@ -113,7 +113,10 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key)
|
||||
|
||||
if(sanitize)
|
||||
if(speaks_ooc)
|
||||
message = sanitize(message)
|
||||
if(GLOB.configuration.general.enable_ooc_emoji)
|
||||
message = emoji_parse(sanitize(message))
|
||||
else
|
||||
message = sanitize(message)
|
||||
else
|
||||
message = sanitize_for_ic(message)
|
||||
|
||||
|
||||
@@ -57,6 +57,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/spritesheet/emoji))
|
||||
request_telemetry()
|
||||
addtimer(CALLBACK(src, PROC_REF(on_initialize_timed_out)), 5 SECONDS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user