From 8ef2e1023722882956d86ccb8734b7f2ae579815 Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Sat, 22 Feb 2014 03:43:37 -0600 Subject: [PATCH] This reverts commit all the say code changes over the last couple of days. Except for the removal of the redundant get_mobs_in_view used for bolding ghosts text. --- code/__HELPERS/game.dm | 57 +++++------------------- code/modules/admin/verbs/mapping.dm | 67 ----------------------------- code/modules/mob/emote.dm | 6 +-- code/modules/mob/living/say.dm | 27 ++++++------ 4 files changed, 26 insertions(+), 131 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index e5a4ab8de94..e2c04299f1c 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -35,17 +35,12 @@ // Like view but bypasses luminosity check -/proc/hear(var/range, var/turf/source) +/proc/hear(var/range, var/atom/source) - var/Alum = source.loc.luminosity var/lum = source.luminosity - source.loc.luminosity = 6 source.luminosity = 6 - var/list/heard = hearers(range, source) //Only lists mobs, but does a better job then view of getting the mobs. - heard |= view(range, source) - - source.loc.luminosity = Alum + var/list/heard = view(range, source) source.luminosity = lum return heard @@ -166,8 +161,6 @@ // The old system would loop through lists for a total of 5000 per function call, in an empty server. // This new system will loop at around 1000 in an empty server. -// SCREW THAT SHIT, we're not recursing. - /proc/get_mobs_in_view(var/R, var/atom/source) // Returns a list of mobs in range of R from source. Used in radio and say code. @@ -178,46 +171,18 @@ return hear var/list/range = hear(R, T) - var/list/objects = list() - var/list/clients_minus_checked = list() - clients_minus_checked |= clients - - for(var/I in range) - if(istype(I, /mob)) - var/mob/M = I - if(istype(M, /mob/living)) - hear += M - else if(istype(M, /mob/dead)) - hear += M - else - objects += M //We still need to check if they contain entities that can hear - continue + for(var/atom/A in range) + if(ismob(A)) + var/mob/M = A if(M.client) - clients_minus_checked -= M.client + hear += M + //world.log << "Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])" + else if(istype(A, /obj/item/device/radio)) + hear += A - else - objects += I - - var/list/hear_and_objects = (hear|objects) - - for(var/client/C in clients_minus_checked) - if(!istype(C) || !C.eye || istype(C.mob, /mob/dead) || istype(C.eye, /mob/aiEye)) - continue - - if(istype(C.eye, /obj/machinery/camera)) - continue //No microphones in cameras. - - if(C.eye in hear_and_objects) - hear += C.mob - hear_and_objects += C.mob - else if(C.mob.loc in hear_and_objects) - hear += C.mob - hear_and_objects += C.mob - - else if(C.mob.loc.loc in hear_and_objects) - hear += C.mob - hear_and_objects += C.mob + if(isobj(A) || ismob(A)) + hear |= recursive_mob_check(A, hear, 3, 1, 0, 1) return hear diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 6108ebd7749..00b9f15ca53 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -161,9 +161,6 @@ var/list/debug_verbs = list ( ,/client/proc/hide_debug_verbs ,/client/proc/testZAScolors ,/client/proc/testZAScolors_remove - ,/client/proc/test_viewers - ,/client/proc/test_view - ,/client/proc/test_hear ) @@ -188,70 +185,6 @@ var/list/debug_verbs = list ( feedback_add_details("admin_verb","hDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - -/client/proc/test_viewers() - set category = "Debug" - set name = "Test Viewers" - - var/turf/T = get_turf(usr) - var/lum = T.loc.luminosity - T.loc.luminosity = 1 - - - var/list/inviewers = viewers(7, usr) - T.loc.luminosity = lum - var/list/M = list() - var/list/O = list() - - for(var/obj/OBJ in inviewers) - O += OBJ - for(var/mob/MOB in inviewers) - M += MOB - - usr << "VIEWERS MOB: [list2text(M,", ")]" - usr << "VIEWERS OBJ: [list2text(O,", ")]" - - - -/client/proc/test_view() - set category = "Debug" - set name = "Test View" - - var/list/inview = view(7, usr) - var/list/M = list() - var/list/O = list() - - for(var/obj/OBJ in inview) - O += OBJ - for(var/mob/MOB in inview) - M += MOB - - usr << "VIEW MOB: [list2text(M,", ")]" - usr << "VIEW OBJ: [list2text(O,", ")]" - -/client/proc/test_hear() - set category = "Debug" - set name = "Test Hear" - - var/turf/T = get_turf(usr) - var/list/hearers = hear(7, T) - var/list/M = list() - var/list/O = list() - - for(var/obj/OBJ in hearers) - O += OBJ - for(var/mob/MOB in hearers) - M += MOB - - - usr << "HEAR MOB: [list2text(M,", ")]" - usr << "HEAR OBJ: [list2text(O,", ")]" - - - - - - /client/var/list/testZAScolors_turfs = list() /client/var/list/testZAScolors_zones = list() /client/var/usedZAScolors = 0 diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index c33732ed133..e2125ada66c 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -38,15 +38,13 @@ // Type 1 (Visual) emotes are sent to anyone in view of the item if (m_type & 1) - var/list/can_see = get_mobs_in_view(1,src) //Allows silicon & mmi mobs carried around to see the emotes of the person carrying them around. - can_see |= viewers(src,null) - for (var/mob/O in can_see) + for (var/mob/O in viewers(src, null)) O.show_message(message, m_type) // Type 2 (Audible) emotes are sent to anyone in hear range // of the *LOCATION* -- this is important for pAIs to be heard else if (m_type & 2) - for (var/mob/O in get_mobs_in_view(7,src)) + for (var/mob/O in hearers(get_turf(src), null)) O.show_message(message, m_type) /mob/proc/emote_dead(var/message) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 554ec38afae..93369793586 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -384,20 +384,19 @@ var/list/department_radio_keys = list( rendered = "[GetVoice()][alt_name] [message_a]" var/rendered_ghost = "[GetVoice()][alt_name] [message_ghost]" for (var/mob/M in heard_a) - if(M.client) //Runtime fix. - if(hascall(M,"show_message")) - var/deaf_message = "" - var/deaf_type = 1 - if(M != src) - deaf_message = "[name][alt_name] talks but you cannot hear them." - else - deaf_message = "You cannot hear yourself!" - deaf_type = 2 // Since you should be able to hear yourself without looking - if (M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTEARS) && M in onscreen) - M.show_message(rendered_ghost, 2, deaf_message, deaf_type) - else - M.show_message(rendered, 2, deaf_message, deaf_type) - M << speech_bubble + if(hascall(M,"show_message")) + var/deaf_message = "" + var/deaf_type = 1 + if(M != src) + deaf_message = "[name][alt_name] talks but you cannot hear them." + else + deaf_message = "You cannot hear yourself!" + deaf_type = 2 // Since you should be able to hear yourself without looking + if (M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTEARS) && M in onscreen) + M:show_message(rendered_ghost, 2, deaf_message, deaf_type) + else + M:show_message(rendered, 2, deaf_message, deaf_type) + M << speech_bubble if (length(heard_b))