Subtle emote fix (#350)

* The Worst Kind of Fix

Doesn't actually fix, instead completely replaces the previous verb that
was named as an EMOTE without being one for real.
Now we use a real emote, shamelessly cribbed together from what I
understood from the custom emote and the base emote procs.
Testing seems to indicate success, now even for simple_mobs, since this
is implemented on the mob/living level. (Should it be on the mob level?
I honestly don't know if basic mobs should have this emote?)

* Removed uneeded prompt

This looks like the same problem the "me" emote has, fixed now. Maybe I
should do the same to the "me" emote later...

* Adds changelog

For players to notice.
This commit is contained in:
ktccd
2017-04-13 06:37:36 +02:00
committed by Poojawa
parent 40cf3e9642
commit 5bca6c759b
2 changed files with 118 additions and 69 deletions
+83 -69
View File
@@ -2,76 +2,8 @@
////////////////////SUBTLE COMMAND////////////////////
//////////////////////////////////////////////////////
/mob
var/use_me = 1
var/flavor_text = "" //tired of fucking double checking this
/mob/verb/me_verb_subtle(message as text) //This would normally go in say.dm
set name = "Subtle"
set category = "IC"
set desc = "Emote to nearby people (and your pred/prey)"
if(say_disabled) //This is here to try to identify lag problems
usr << "Speech is currently admin-disabled."
return
message = sanitize(message)
if(use_me)
usr.emote_vr("me",4,message)
else
usr.emote_vr(message)
/mob/proc/custom_emote_vr(var/m_type=1,var/message = null) //This would normally go in emote.dm
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(input(src,"Choose an emote to display.") as text|null)
else
input = message
if(input)
message = "<B>[src]</B> <I>[input]</I>"
else
return
if (message)
log_emote("[name]/[key] : [message]")
for(var/mob/M in player_list)
if (!M.client)
continue //skip monkeys and leavers
if (istype(M, /mob/dead/new_player))
continue
if(findtext(message," snores.")) //Because we have so many sleeping people.
break
if(M.stat == DEAD && !(M in viewers(src,null)))
M.show_message(message, m_type)
var/list/subtle = hearers(1,src)
for(var/I in subtle)
/*if(isobj(I)) //micros in hand
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
I.show_message(src, message, 2) */
if(ismob(I))
var/mob/M = I
M.show_message(message, 2)
/mob/proc/emote_vr(var/act, var/type, var/message) //This would normally go in say.dm
if(act == "me")
return custom_emote_vr(type, message)
/mob/proc/update_flavor_text()
set src in usr
if(usr != src)
@@ -107,4 +39,86 @@ proc/get_top_level_mob(var/mob/S)
if(istype(S.loc,/mob)&&S.loc!=S)
var/mob/M=S.loc
return M.get_top_level_mob()
return S
return S
///////////////// EMOTE CODE
// Maybe making this as an emote is less messy?
// It was - ktccd
/datum/emote/living/subtle
key = "subtle"
key_third_person = "subtle"
message = null
mob_type_blacklist_typecache = list(/mob/living/brain)
/datum/emote/living/subtle/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
/datum/emote/living/subtle/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
to_chat(user, "You cannot send subtle emotes (banned).")
return FALSE
else if(user.client && user.client.prefs.muted & MUTE_IC)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/subtle_emote = copytext(sanitize(input("Choose an emote to display.") as text|null), 1, MAX_MESSAGE_LEN)
if(subtle_emote && !check_invalid(user, subtle_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)
if("Visible")
emote_type = EMOTE_VISIBLE
if("Hearable")
emote_type = EMOTE_AUDIBLE
else
alert("Unable to use this emote, must be either hearable or visible.")
return
message = subtle_emote
else
message = params
if(type_override)
emote_type = type_override
. = TRUE
if(!can_run_emote(user))
return FALSE
user.log_message(message, INDIVIDUAL_EMOTE_LOG)
message = "<b>[user]</b> " + message
for(var/mob/M in dead_mob_list)
if(!M.client || isnewplayer(M))
continue
var/T = get_turf(src)
if(M.stat == DEAD && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T, null)))
M.show_message(message)
if(emote_type == EMOTE_AUDIBLE)
user.audible_message(message=message,hearing_distance=1)
else
user.visible_message(message=message,self_message=message,vision_distance=1)
log_emote("[key_name(user)] : [message]")
message = null
emote_type = EMOTE_VISIBLE
///////////////// VERB CODE
/mob/living/verb/subtle()
set name = "Subtle"
set category = "IC"
if(say_disabled) //This is here to try to identify lag problems
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
return
usr.emote("subtle")