diff --git a/code/game/machinery/telecomms/computers/message.dm b/code/game/machinery/telecomms/computers/message.dm
index 64f4cc7835..3dad2d057a 100644
--- a/code/game/machinery/telecomms/computers/message.dm
+++ b/code/game/machinery/telecomms/computers/message.dm
@@ -421,7 +421,7 @@
"name" = "[customsender]",
"job" = "[customjob]",
"message" = custommessage,
- "emoji_message" = emoji_parse(custommessage),
+ "emojis" = TRUE,
"targets" = list("[customrecepient.owner] ([customrecepient.ownjob])")
))
// this will log the signal and transmit it to the target
diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm
index 56870c5198..a7b2beb709 100644
--- a/code/game/machinery/telecomms/machines/message_server.dm
+++ b/code/game/machinery/telecomms/machines/message_server.dm
@@ -109,8 +109,8 @@
/datum/signal/subspace/pda/proc/format_message(emojify = FALSE)
var/message = emojify ? data["emoji_message"] : data["message"]
if (logged && data["photo"])
- return "\"[message]\" (Photo)"
- return "\"[message]\""
+ return "\"[data["message"]]\" (Photo)"
+ return "\"[data["message"]]\""
/datum/signal/subspace/pda/broadcast()
if (!logged) // Can only go through if a message server logs it
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 0c9ac4bb60..73c0cdb1b2 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -77,6 +77,7 @@ GLOBAL_LIST_EMPTY(PDAs)
var/hidden = FALSE // Is the PDA hidden from the PDA list?
var/emped = FALSE
var/equipped = FALSE //used here to determine if this is the first time its been picked up
+ var/enforce_emojis = TRUE //if the pda can send emojis and actually have them parsed as such
var/obj/item/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both.
var/ownjob = null //related to above
@@ -252,10 +253,14 @@ GLOBAL_LIST_EMPTY(PDAs)
var/datum/asset/spritesheet/assets = get_asset_datum(/datum/asset/spritesheet/simple/pda)
assets.send(user)
+ var/datum/asset/spritesheet/emoji_s = get_asset_datum(/datum/asset/spritesheet/goonchat)
+ emoji_s.send(user) //Already sent by chat but no harm doing this
+
user.set_machine(src)
var/dat = "
Personal Data Assistant"
dat += assets.css_tag()
+ dat += emoji_s.css_tag()
dat += "[PDAIMG(refresh)]Refresh"
@@ -335,6 +340,8 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += "
"
+ emoji_table = collate.Join()
+
+ menu += " To use an emoji in a pda message, refer to the guide and add \":\" around the emoji. Your PDA supports the following emoji: "
+ menu += emoji_table
+
if (99) //Newscaster message permission error
menu = "
ERROR : NOT AUTHORIZED [host_pda.id ? "" : "- ID SLOT EMPTY"]
"
@@ -678,6 +694,11 @@ Code:
return
playsound(src, 'sound/machines/terminal_select.ogg', 50, 1)
+ //emoji previews
+ if(href_list["emoji"])
+ var/parse = emoji_parse(":[href_list["emoji"]]:")
+ to_chat(usr, parse)
+
//Bot control section! Viciously ripped from radios for being laggy and terrible.
if(href_list["op"])
switch(href_list["op"])
diff --git a/code/modules/client/asset_cache.dm b/code/modules/client/asset_cache.dm
index 643d072469..ecb7a699ee 100644
--- a/code/modules/client/asset_cache.dm
+++ b/code/modules/client/asset_cache.dm
@@ -448,7 +448,8 @@ GLOBAL_LIST_EMPTY(asset_datums)
"scanner" = 'icons/pda_icons/pda_scanner.png',
"signaler" = 'icons/pda_icons/pda_signaler.png',
"status" = 'icons/pda_icons/pda_status.png',
- "dronephone" = 'icons/pda_icons/pda_dronephone.png'
+ "dronephone" = 'icons/pda_icons/pda_dronephone.png',
+ "emoji" = 'icons/pda_icons/pda_emoji.png'
)
/datum/asset/spritesheet/simple/paper
diff --git a/code/modules/emoji/emoji_parse.dm b/code/modules/emoji/emoji_parse.dm
index 2f4a84c646..db46ca09ca 100644
--- a/code/modules/emoji/emoji_parse.dm
+++ b/code/modules/emoji/emoji_parse.dm
@@ -1,4 +1,4 @@
-/proc/emoji_parse(text)
+/proc/emoji_parse(text) //turns :ai: into an emoji in text.
. = text
if(!CONFIG_GET(flag/emojis))
return
@@ -30,3 +30,24 @@
break
return parsed
+/proc/emoji_sanitize(text) //cuts any text that would not be parsed as an emoji
+ . = text
+ if(!CONFIG_GET(flag/emojis))
+ return
+ var/static/list/emojis = icon_states(icon('icons/emoji.dmi'))
+ var/final = "" //only tags are added to this
+ var/pos = 1
+ var/search = 0
+ while(1)
+ search = findtext(text, ":", pos)
+ if(search)
+ pos = search
+ search = findtext(text, ":", pos+1)
+ if(search)
+ var/word = lowertext(copytext(text, pos+1, search))
+ if(word in emojis)
+ final += lowertext(copytext(text, pos, search+1))
+ pos = search + 1
+ continue
+ break
+ return final
diff --git a/icons/emoji.dmi b/icons/emoji.dmi
index 925b072a5f..931cb7a916 100644
Binary files a/icons/emoji.dmi and b/icons/emoji.dmi differ
diff --git a/icons/pda_icons/pda_emoji.png b/icons/pda_icons/pda_emoji.png
new file mode 100644
index 0000000000..39f789f520
Binary files /dev/null and b/icons/pda_icons/pda_emoji.png differ