mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-09 16:09:15 +00:00
* Unicode support Part 2 -- copytext() This is the transition of all copytext() calls to be unicode aware and also some nearby calls in the same functions. Most things are just replacing copytext() with copytext_char() as a terrible character limiter but a few others were slightly more involved. I replaced a ton of ```` var/something = sanitize(input()) something = copytext(something, 1, MAX_MESSAGE_LEN) ```` with a single stripped_input() call. stripped_input() already calls html_encode(), trim(), and some other sanitization so there shouldn't be any major issues there. This is still VERY rough btw; DNA is a mess, the status displays are complete ass, there's a copytext() in code\datums\shuttles.dm that I'm not sure what to do with, and I didn't touch anything in the tools folder. I haven't tested this much at all yet, I only got it to compile earlier this morning. There's also likely to be weird bugs until I get around to fixing length(), findtext(), and the rest of the string procs. * Makes the code functional * Assume color hex strings are always # followed by ascii. Properly encodes and decodes the stuff in mob_helpers.dm which fixes some issues there. * Removes ninjaspeak since it's unused
44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
/client/proc/dsay(msg as text)
|
|
set category = "Special Verbs"
|
|
set name = "Dsay"
|
|
set hidden = 1
|
|
if(!holder)
|
|
to_chat(src, "Only administrators may use this command.")
|
|
return
|
|
if(!mob)
|
|
return
|
|
if(prefs.muted & MUTE_DEADCHAT)
|
|
to_chat(src, "<span class='danger'>You cannot send DSAY messages (muted).</span>")
|
|
return
|
|
|
|
if (handle_spam_prevention(msg,MUTE_DEADCHAT))
|
|
return
|
|
|
|
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
|
|
mob.log_talk(msg, LOG_DSAY)
|
|
|
|
if (!msg)
|
|
return
|
|
var/rank_name = holder.rank
|
|
var/admin_name = key
|
|
if(holder.fakekey)
|
|
rank_name = pick(strings("admin_nicknames.json", "ranks", "config"))
|
|
admin_name = pick(strings("admin_nicknames.json", "names", "config"))
|
|
var/rendered = "<span class='game deadsay'><span class='prefix'>DEAD:</span> <span class='name'>[rank_name]([admin_name])</span> says, <span class='message'>\"[emoji_parse(msg)]\"</span></span>"
|
|
|
|
for (var/mob/M in GLOB.player_list)
|
|
if(isnewplayer(M))
|
|
continue
|
|
if (M.stat == DEAD || (M.client.holder && (M.client.prefs.chat_toggles & CHAT_DEAD))) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above
|
|
to_chat(M, rendered)
|
|
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Dsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
|
|
/client/proc/get_dead_say()
|
|
var/msg = input(src, null, "dsay \"text\"") as text|null
|
|
|
|
if (isnull(msg))
|
|
return
|
|
|
|
dsay(msg)
|