mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-04 14:33:58 +00:00
When a post is too long to send, reflect it back to the user in the chatbox so they can copypaste it into separate messages. Also increases the message limit from 1024 to 2048. If a message is longer than 5-messages worth, it is not reflected and a warning is sent instead to avoid easily consuming bandwidth for DDOS purposes with long messages. I'd like to add markers in the message where the posts would have been truncated but that's... complicated.
85 lines
2.5 KiB
Plaintext
85 lines
2.5 KiB
Plaintext
// All mobs should have custom emote, really..
|
|
//m_type == 1 --> visual.
|
|
//m_type == 2 --> audible
|
|
/mob/proc/custom_emote(var/m_type=1,var/message = null,var/range=world.view)
|
|
if(stat || !use_me && usr == src)
|
|
src << "You are unable to emote."
|
|
return
|
|
|
|
var/muzzled = is_muzzled()
|
|
if(m_type == 2 && muzzled) return
|
|
|
|
var/input
|
|
if(!message)
|
|
input = sanitize_or_reflect(input(src,"Choose an emote to display.") as text|null, src) //VOREStation Edit - Reflect too long messages, within reason
|
|
else
|
|
input = message
|
|
if(input)
|
|
log_emote(message,src) //Log before we add junk
|
|
message = "<B>[src]</B> [input]"
|
|
else
|
|
return
|
|
|
|
|
|
if (message)
|
|
message = say_emphasis(message)
|
|
|
|
// Hearing gasp and such every five seconds is not good emotes were not global for a reason.
|
|
// Maybe some people are okay with that.
|
|
|
|
var/turf/T = get_turf(src)
|
|
if(!T) return
|
|
var/list/in_range = get_mobs_and_objs_in_view_fast(T,range,2,remote_ghosts = client ? TRUE : FALSE)
|
|
var/list/m_viewers = in_range["mobs"]
|
|
var/list/o_viewers = in_range["objs"]
|
|
|
|
for(var/mob in m_viewers)
|
|
var/mob/M = mob
|
|
spawn(0) // It's possible that it could be deleted in the meantime, or that it runtimes.
|
|
if(M)
|
|
//VOREStation edit
|
|
if(istype(M, /mob/observer/dead/))
|
|
var/mob/observer/dead/D = M
|
|
if(ckey || (src in view(D)))
|
|
M.show_message(message, m_type)
|
|
else
|
|
M.show_message(message, m_type)
|
|
//End VOREStation edit
|
|
|
|
for(var/obj in o_viewers)
|
|
var/obj/O = obj
|
|
spawn(0)
|
|
if(O)
|
|
O.see_emote(src, message, m_type)
|
|
|
|
/mob/proc/emote_dead(var/message)
|
|
|
|
if(client.prefs.muted & MUTE_DEADCHAT)
|
|
src << "<span class='danger'>You cannot send deadchat emotes (muted).</span>"
|
|
return
|
|
|
|
if(!is_preference_enabled(/datum/client_preference/show_dsay))
|
|
src << "<span class='danger'>You have deadchat muted.</span>"
|
|
return
|
|
|
|
if(!src.client.holder)
|
|
if(!config.dsay_allowed)
|
|
src << "<span class='danger'>Deadchat is globally muted.</span>"
|
|
return
|
|
|
|
|
|
var/input
|
|
if(!message)
|
|
input = sanitize_or_reflect(input(src, "Choose an emote to display.") as text|null, src) //VOREStation Edit - Reflect too long messages, within reason
|
|
else
|
|
input = message
|
|
|
|
input = say_emphasis(input)
|
|
|
|
if(input)
|
|
log_ghostemote(input, src)
|
|
if(!invisibility) //If the ghost is made visible by admins or cult. And to see if the ghost has toggled its own visibility, as well. -Mech
|
|
visible_message("<span class='deadsay'><B>[src]</B> [input]</span>")
|
|
else
|
|
say_dead_direct(input, src)
|