mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Rewrites LOOC and emote to use new proc
And to be more simple and sane
This commit is contained in:
@@ -106,7 +106,13 @@
|
||||
log_ooc("(LOCAL) [mob.name]/[key] : [msg]")
|
||||
|
||||
var/mob/source = mob.get_looc_source()
|
||||
var/list/heard = get_mobs_or_objects_in_view(7, get_turf(source), 1, 0)
|
||||
var/turf/T = get_turf(source)
|
||||
if(!T) return
|
||||
var/list/in_range = get_mobs_and_objs_in_view_fast(T,world.view,0)
|
||||
var/list/m_viewers = in_range["mobs"]
|
||||
|
||||
var/list/receivers = list() // Clients, not mobs.
|
||||
var/list/r_receivers = list()
|
||||
|
||||
var/display_name = key
|
||||
if(holder && holder.fakekey)
|
||||
@@ -114,34 +120,69 @@
|
||||
if(mob.stat != DEAD)
|
||||
display_name = mob.name
|
||||
|
||||
// Everyone in normal viewing range of the LOOC
|
||||
for(var/mob/viewer in m_viewers)
|
||||
if(viewer.client && viewer.client.is_preference_enabled(/datum/client_preference/show_looc))
|
||||
receivers |= viewer.client
|
||||
else if(istype(viewer,/mob/observer/eye)) // For AI eyes and the like
|
||||
var/mob/observer/eye/E = viewer
|
||||
if(E.owner && E.owner.client)
|
||||
receivers |= E.owner.client
|
||||
|
||||
// Admins with RLOOC displayed who weren't already in
|
||||
for(var/client/admin in admins)
|
||||
if(!(admin in receivers) && admin.is_preference_enabled(/datum/client_preference/holder/show_rlooc))
|
||||
r_receivers |= admin
|
||||
|
||||
// Send a message
|
||||
for(var/client/target in receivers)
|
||||
var/admin_stuff = ""
|
||||
|
||||
if(target in admins)
|
||||
admin_stuff += "/([key])"
|
||||
|
||||
target << "<span class='ooc'><span class='looc'>" + create_text_tag("looc", "LOOC:", target) + " <EM>[display_name][admin_stuff]:</EM> <span class='message'>[msg]</span></span></span>"
|
||||
|
||||
for(var/client/target in r_receivers)
|
||||
var/admin_stuff = "/([key])([admin_jump_link(mob, target.holder)])"
|
||||
|
||||
target << "<span class='ooc'><span class='looc'>" + create_text_tag("looc", "LOOC:", target) + " <span class='prefix'>(R)</span><EM>[display_name][admin_stuff]:</EM> <span class='message'>[msg]</span></span></span>"
|
||||
/*
|
||||
for(var/client/target in clients)
|
||||
if(target.is_preference_enabled(/datum/client_preference/show_looc))
|
||||
var/prefix = ""
|
||||
var/admin_stuff = ""
|
||||
var/send = 0
|
||||
|
||||
// Admins get extra data.
|
||||
if(target in admins)
|
||||
admin_stuff += "/([key])"
|
||||
if(target != src)
|
||||
admin_stuff += "([admin_jump_link(mob, target.holder)])"
|
||||
|
||||
if(target.mob in heard)
|
||||
send = 1
|
||||
// For AIs, needs work done to see if the eye is in range as we're going over clients not mobs.
|
||||
if(isAI(target.mob))
|
||||
var/mob/living/silicon/ai/A = target.mob
|
||||
if(A.eyeobj in m_viewers)
|
||||
send = 1
|
||||
prefix = "(Eye) " // Prefer the (Eye) prefix if they are in range of core and eye.
|
||||
else if (A in m_viewers)
|
||||
send = 1
|
||||
prefix = "(Core) "
|
||||
|
||||
else if(isAI(target.mob)) // Special case
|
||||
var/mob/living/silicon/ai/A = target.mob
|
||||
if(A.eyeobj in hearers(7, source))
|
||||
// If you're in range, you get the LOOC.
|
||||
else if(target.mob in m_viewers)
|
||||
send = 1
|
||||
prefix = "(Eye) "
|
||||
|
||||
// If you weren't going to otherwise get it, but can see (R)LOOC.
|
||||
if(!send && (target in admins) && target.is_preference_enabled(/datum/client_preference/holder/show_rlooc))
|
||||
send = 1
|
||||
prefix = "(R)"
|
||||
|
||||
// Deliver message directly to the client with stream operator, not another proc. LOOC is important.
|
||||
if(send)
|
||||
target << "<span class='ooc'><span class='looc'>" + create_text_tag("looc", "LOOC:", target) + " <span class='prefix'>[prefix]</span><EM>[display_name][admin_stuff]:</EM> <span class='message'>[msg]</span></span></span>"
|
||||
*/
|
||||
|
||||
/mob/proc/get_looc_source()
|
||||
return src
|
||||
|
||||
@@ -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)))
|
||||
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"]
|
||||
|
||||
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)
|
||||
|
||||
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))
|
||||
for(var/obj/O in o_viewers)
|
||||
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)
|
||||
if(O)
|
||||
O.see_emote(src, message, m_type)
|
||||
|
||||
/mob/proc/emote_dead(var/message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user