[READY] Mime PDAs only accept emojis for messages, mime cartridge comes with an emoji guidebook (#47177)

* relic file

* Revert "Merge branch 'master' of https://github.com/tralezab/tgstation"

This reverts commit 826916d87b421dbb0ebcfce7fad96e456b6d3674, reversing
changes made to a0f476d874.

* mime pda

* hey maybe it works

* some steps forward

* IT WORKS HAHAHA YAAAAAAAAAAAAAAAAA

* logged properly in everything
This commit is contained in:
tralezab
2019-10-22 20:19:21 -07:00
committed by Rob Bailey
parent d86515fea9
commit fcf2dbfa02
6 changed files with 75 additions and 11 deletions
+14 -2
View File
@@ -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 += "<li><a href='byond://?src=[REF(src)];choice=54'>[PDAIMG(medbot)]Bots Access</a></li>"
if (cartridge.access & CART_JANITOR)
dat += "<li><a href='byond://?src=[REF(src)];choice=49'>[PDAIMG(bucket)]Custodial Locator</a></li>"
if(cartridge.access & CART_MIME)
dat += "<li><a href='byond://?src=[REF(src)];choice=55'>[PDAIMG(emoji)]Emoji Guidebook</a></li>"
if (istype(cartridge.radio))
dat += "<li><a href='byond://?src=[REF(src)];choice=40'>[PDAIMG(signaler)]Signaler System</a></li>"
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 += "<i><b>&rarr; To [target_text]:</b></i><br>[signal.format_message()]<br>"
// Show it to ghosts
@@ -687,7 +695,11 @@ GLOBAL_LIST_EMPTY(PDAs)
if(signal.data["automated"])
reply = "\[Automated Message\]"
to_chat(L, "[icon2html(src)] <b>Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[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)] <b>Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[inbound_message] [reply]")
update_icon()
add_overlay(icon_alert)
@@ -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
@@ -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 = "<h4>[PDAIMG(medbot)] Bots Interlink</h4>"
bot_control()
if (55) // Emoji Guidebook for mimes
menu = "<h4>[PDAIMG(emoji)] Emoji Guidebook</h4>"
var/static/list/emoji_icon_states
var/breakcounter = FALSE
if(!emoji_icon_states)
emoji_icon_states = icon_states(icon('icons/emoji.dmi'))
menu += "<br> 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.<br>"
for(var/emoji in emoji_icon_states)
var/preview_link = "<A href='byond://?src=[REF(src)];emoji=[emoji]'>[emoji]</a>" //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 ? "<br> " : ""][preview_link][breakcounter ? " || " : "" ]"
breakcounter = !breakcounter
if (99) //Newscaster message permission error
menu = "<h5> ERROR : NOT AUTHORIZED [host_pda.id ? "" : "- ID SLOT EMPTY"] </h5>"
@@ -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"])
+2 -1
View File
@@ -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
+20 -1
View File
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB