Bugfix: People unable to hear while in certain locations. (And some debug verbs)

...hopefully
This commit is contained in:
Ccomp5950
2014-02-21 02:11:11 -06:00
parent fac3b8c580
commit 440f784c70
2 changed files with 90 additions and 13 deletions

View File

@@ -35,12 +35,17 @@
// Like view but bypasses luminosity check
/proc/hear(var/range, var/atom/source)
/proc/hear(var/range, var/turf/source)
var/Alum = source.loc.luminosity
var/lum = source.luminosity
source.loc.luminosity = 6
source.luminosity = 6
var/list/heard = view(range, source)
var/list/heard = viewers(range, source) //Only lists mobs, but does a better job then view of getting the mobs.
heard |= view(range, source)
source.loc.luminosity = Alum
source.luminosity = lum
return heard
@@ -174,33 +179,38 @@
var/list/range = hear(R, T)
for(var/mob/M in range)
var/list/clients_minus_checked = clients
for(var/mob/M in range) //Only looking for living mobs because ghosts are automatically added.
hear += M
if(M.client)
clients_minus_checked -= M.client
var/list/objects = list()
for(var/obj/O in range) //Get a list of objects in hearing range. We'll check to see if any clients have their "eye" set to the object
for(var/obj/O in range) //Get a list of objects in hearing range. We'll check to see if any clients have their "eye" set to the object
objects += O
for(var/client/C in clients)
if(!istype(C) || !C.eye)
continue //I have no idea when this client check would be needed, but if this runtimes people won't hear anything
//So kinda paranoid about runtime avoidance.
if(istype(C.eye, /obj/machinery/camera))
continue //No microphones in cameras.
var/list/hear_and_objects = (hear|objects)
if(C.mob in hear)
for(var/client/C in clients_minus_checked)
if(!istype(C) || !C.eye || istype(C.mob, /mob/dead))
continue
var/list/hear_and_objects = (hear|objects) //Combined these lists here instead of doing the combine 3 more times.
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
return hear

View File

@@ -161,6 +161,9 @@ 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
)
@@ -185,6 +188,70 @@ 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