Rewrites LOOC and emote to use new proc

And to be more simple and sane
This commit is contained in:
Arokha Sieyes
2016-06-11 21:53:56 -04:00
parent 1e9e55d73d
commit 40d0d75804
2 changed files with 66 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
// 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)
/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
@@ -23,42 +23,23 @@
if (message)
log_emote("[name]/[key] : [message]")
//Hearing gasp and such every five seconds is not good emotes were not global for a reason.
// Hearing gasp and such every five seconds is not good emotes were not global for a reason.
// Maybe some people are okay with that.
for(var/mob/M in player_list)
if (!M.client)
continue //skip monkeys and leavers
if (istype(M, /mob/new_player))
continue
if(findtext(message," snores.")) //Because we have so many sleeping people.
break
if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_sight) && !(M in viewers(src,null)))
M.show_message(message, m_type)
var/turf/T = get_turf(src)
if(!T) return
var/list/in_range = get_mobs_and_objs_in_view_fast(T,range,2)
var/list/m_viewers = in_range["mobs"]
var/list/o_viewers = in_range["objs"]
if (m_type & 1)
var/list/see = get_mobs_or_objects_in_view(world.view,src) | viewers(get_turf(src), null)
for(var/I in see)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.see_emote(src, message, 1)
else if(ismob(I))
var/mob/M = I
M.show_message(message, 1)
else if (m_type & 2)
var/list/hear = get_mobs_or_objects_in_view(world.view,src)
for(var/I in hear)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.see_emote(src, message, 2)
else if(ismob(I))
var/mob/M = I
M.show_message(message, 2)
for(var/mob/M in m_viewers)
spawn(0) // It's possible that it could be deleted in the meantime, or that it runtimes.
if(M)
M.show_message(message, m_type)
for(var/obj/O in o_viewers)
spawn(0)
if(O)
O.see_emote(src, message, m_type)
/mob/proc/emote_dead(var/message)