Files
CHOMPStation2/code/modules/mob/living/silicon/robot/emote.dm
baloh.matevz@gmail.com 9a94312431 - Added spam-prevention code. If someone sends the same message 5 times in a row, they will get the message "You are nearing the spam filter limit for identical messages." If they continue to send the same message (if they send it 10 times in total) they will get an auto-mute for the channel they are sending it through. The number of identical messages which triggers a warning and automute can be configured in setup.dm
- Added channel-specific admin muting. Admins can now mute someone from IC (say, me and whisper), OOC, PRAY, ADMINHELP (adminhelp, admin pm and asay) and DEADCHAT (say while dead and dsay)
- Added a (?) to adminhelps and prayers which displays the same quick overview that all the other (?)-s show, but for the person adminhelping or praying.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3888 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-22 05:54:43 +00:00

157 lines
3.5 KiB
Plaintext

/mob/living/silicon/robot/emote(var/act,var/m_type=1,var/message = null)
var/param = null
if (findtext(act, "-", 1, null))
var/t1 = findtext(act, "-", 1, null)
param = copytext(act, t1 + 1, length(act) + 1)
act = copytext(act, 1, t1)
switch(act)
if ("salute")
if (!src.buckled)
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> salutes to [param]."
else
message = "<B>[src]</b> salutes."
m_type = 1
if ("bow")
if (!src.buckled)
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> bows to [param]."
else
message = "<B>[src]</B> bows."
m_type = 1
if ("clap")
if (!src.restrained())
message = "<B>[src]</B> claps."
m_type = 2
if ("flap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings."
m_type = 2
if ("aflap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings ANGRILY!"
m_type = 2
if ("custom")
var/input = copytext(sanitize(input("Choose an emote to display.") as text|null),1,MAX_MESSAGE_LEN)
if (!input)
return
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
if (input2 == "Visible")
m_type = 1
else if (input2 == "Hearable")
m_type = 2
else
alert("Unable to use this emote, must be either hearable or visible.")
return
message = "<B>[src]</B> [input]"
if ("me")
if(silent)
return
if (src.client)
if(client.muted_ic)
src << "You cannot send IC messages (muted by admins)."
return
if (src.client.handle_spam_prevention(message,MUTE_IC))
return
if (stat)
return
if(!(message))
return
else
message = "<B>[src]</B> [message]"
if ("twitch")
message = "<B>[src]</B> twitches violently."
m_type = 1
if ("twitch_s")
message = "<B>[src]</B> twitches."
m_type = 1
if ("nod")
message = "<B>[src]</B> nods."
m_type = 1
if ("deathgasp")
message = "<B>[src]</B> shudders violently for a moment, then becomes motionless, its eyes slowly darkening."
m_type = 1
if ("glare")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> glares at [param]."
else
message = "<B>[src]</B> glares."
if ("stare")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> stares at [param]."
else
message = "<B>[src]</B> stares."
if ("look")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> looks at [param]."
else
message = "<B>[src]</B> looks."
m_type = 1
else
src << text("Invalid Emote: []", act)
if ((message && src.stat == 0))
if (m_type & 1)
for(var/mob/O in viewers(src, null))
O.show_message(message, m_type)
else
for(var/mob/O in hearers(src, null))
O.show_message(message, m_type)
return