diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 6a86522e0bc..1785e22aded 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -64,6 +64,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/allow_emojis = FALSE //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
@@ -270,6 +271,8 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += "
[PDAIMG(medbot)]Bots Access"
if (cartridge.access & CART_JANITOR)
dat += "[PDAIMG(bucket)]Custodial Locator"
+ if(cartridge.access & CART_MIME)
+ dat += "[PDAIMG(emoji)]Emoji Guidebook"
if (istype(cartridge.radio))
dat += "[PDAIMG(signaler)]Signaler System"
if (cartridge.access & CART_NEWSCASTER)
@@ -634,7 +637,8 @@ GLOBAL_LIST_EMPTY(PDAs)
"name" = "[owner]",
"job" = "[ownjob]",
"message" = message,
- "targets" = string_targets
+ "targets" = string_targets,
+ "emojis" = allow_emojis,
))
if (picture)
signal.data["photo"] = picture
@@ -646,6 +650,10 @@ GLOBAL_LIST_EMPTY(PDAs)
return
var/target_text = signal.format_target()
+ if(allow_emojis)
+ message = emoji_parse(message)//already sent- this just shows the sent emoji as one to the sender in the to_chat
+ signal.data["message"] = emoji_parse(signal.data["message"])
+
// Log it in our logs
tnote += "→ To [target_text]:
[signal.format_message()]
"
// Show it to ghosts
@@ -687,7 +695,11 @@ GLOBAL_LIST_EMPTY(PDAs)
if(signal.data["automated"])
reply = "\[Automated Message\]"
- to_chat(L, "[icon2html(src)] Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], [signal.format_message()] [reply]")
+ var/inbound_message = signal.format_message()
+ if(signal.data["emojis"] == TRUE)//so will not parse emojis as such from pdas that don't send emojis
+ inbound_message = emoji_parse(inbound_message)
+
+ to_chat(L, "[icon2html(src)] Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], [inbound_message] [reply]")
update_icon()
add_overlay(icon_alert)
diff --git a/code/game/objects/items/devices/PDA/PDA_types.dm b/code/game/objects/items/devices/PDA/PDA_types.dm
index 2b3d8b94c33..8c7c3115fbf 100644
--- a/code/game/objects/items/devices/PDA/PDA_types.dm
+++ b/code/game/objects/items/devices/PDA/PDA_types.dm
@@ -17,6 +17,27 @@
if(istype(cart) && cart.charges < 5)
cart.charges++
+//Mime PDA sends "silent" messages.
+/obj/item/pda/mime
+ name = "mime PDA"
+ default_cartridge = /obj/item/cartridge/virus/mime
+ inserted_item = /obj/item/toy/crayon/mime
+ icon_state = "pda-mime"
+ desc = "A portable microcomputer by Thinktronic Systems, LTD. The hardware has been modified for compliance with the vows of silence."
+ allow_emojis = TRUE
+ silent = TRUE
+ ttone = "silence"
+
+/obj/item/pda/mime/msg_input(mob/living/U = usr)
+ if(emped || toff)
+ return
+ var/emojis = emoji_sanitize(stripped_input(U, "Please enter emojis", name))
+ if(!emojis)
+ return
+ if(!U.canUseTopic(src, BE_CLOSE))
+ return
+ return emojis
+
// Special AI/pAI PDAs that cannot explode.
/obj/item/pda/ai
icon = null
@@ -78,13 +99,6 @@
icon_state = "pda-science"
ttone = "boom"
-/obj/item/pda/mime
- name = "mime PDA"
- default_cartridge = /obj/item/cartridge/virus/mime
- inserted_item = /obj/item/toy/crayon/mime
- icon_state = "pda-mime"
- silent = TRUE
- ttone = "silence"
/obj/item/pda/heads
default_cartridge = /obj/item/cartridge/head
diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm
index c23e8445635..57061bc07ae 100644
--- a/code/game/objects/items/devices/PDA/cart.dm
+++ b/code/game/objects/items/devices/PDA/cart.dm
@@ -1,3 +1,4 @@
+
#define CART_SECURITY (1<<0)
#define CART_ENGINE (1<<1)
#define CART_ATMOS (1<<2)
@@ -43,6 +44,7 @@
var/list/powermonitors = list()
var/message1 // used for status_displays
var/message2
+ var/emoji_preview = "" //which emoji will be sent to chat in a preview
var/list/stored_data = list()
var/current_channel
@@ -559,6 +561,17 @@ Code:
if (54) // Beepsky, Medibot, Floorbot, and Cleanbot access
menu = "[PDAIMG(medbot)] Bots Interlink
"
bot_control()
+ if (55) // Emoji Guidebook for mimes
+ menu = "[PDAIMG(emoji)] Emoji Guidebook
"
+ var/static/list/emoji_icon_states
+ var/breakcounter = FALSE
+ if(!emoji_icon_states)
+ emoji_icon_states = icon_states(icon('icons/emoji.dmi'))
+ menu += "
To use an emoji in a pda message, refer to the guide and add \":\" around the emoji. Click on any of the emojis to preview it.
"
+ for(var/emoji in emoji_icon_states)
+ var/preview_link = "[emoji]" //broken, on opening the menu it sends every single emoji because it is executing the proc to find the choice as soon as it is loaded
+ menu += "[breakcounter ? "
" : ""][preview_link][breakcounter ? " || " : "" ]"
+ breakcounter = !breakcounter
if (99) //Newscaster message permission error
menu = " ERROR : NOT AUTHORIZED [host_pda.id ? "" : "- ID SLOT EMPTY"]
"
@@ -647,6 +660,11 @@ Code:
host_pda.Topic(null,list("choice"=num2text(host_pda.mode)))
return
+ //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 0d983098476..ff1eac08238 100644
--- a/code/modules/client/asset_cache.dm
+++ b/code/modules/client/asset_cache.dm
@@ -468,7 +468,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 2f4a84c6463..8e399d8ca18 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,22 @@
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)
+ final += lowertext(copytext(text, pos, search+1))
+ pos = search + 1
+ continue
+ break
+ return final
diff --git a/icons/pda_icons/pda_emoji.png b/icons/pda_icons/pda_emoji.png
new file mode 100644
index 00000000000..39f789f5207
Binary files /dev/null and b/icons/pda_icons/pda_emoji.png differ