i did a thing yay me

This commit is contained in:
kevinz000
2020-01-24 03:34:53 -07:00
parent 970f6f54ad
commit 8816a8b3e4
2 changed files with 18 additions and 158 deletions

View File

@@ -152,11 +152,11 @@
/proc/recursive_hear_check(O)
var/list/processing_list = list(O)
. = list()
while(processing_list.len)
var/atom/A = processing_list[1]
var/i = 1
while(i < length(processing_list))
var/atom/A = processing_list[i++]
if(A.flags_1 & HEAR_1)
. += A
processing_list.Cut(1, 2)
processing_list += A.contents
/** recursive_organ_check
@@ -238,124 +238,7 @@
return found_mobs
/proc/get_hearers_in_view(R, atom/source)
. = get_hearers_in_view_old(R, source)
. = get_hearers_in_view_old_new(R, source)
. = get_hearers_in_view_old_new_new(R, source)
. = get_hearers_in_view_new(R, source)
. = get_hearers_in_view_new_new(R, source)
. = get_hearers_in_view_new_new_new(R, source)
/proc/get_hearers_in_view_old(R, atom/source)
// Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode.
var/turf/T = get_turf(source)
. = list()
if(!T)
return
var/list/processing = list()
if (R == 0) // if the range is zero, we know exactly where to look for, we can skip view
processing += T.contents // We can shave off one iteration by assuming turfs cannot hear
else // A variation of get_hear inlined here to take advantage of the compiler's fastpath for obj/mob in view
var/lum = T.luminosity
T.luminosity = 6 // This is the maximum luminosity
var/list/cachedview = view(R, T)
for(var/mob/M in cachedview)
processing += M
for(var/obj/O in cachedview)
processing += O
T.luminosity = lum
while(processing.len) // recursive_hear_check inlined here
var/atom/A = processing[1]
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing.Cut(1, 2)
processing += A.contents
/proc/get_hearers_in_view_old_new(R, atom/source)
// Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode.
var/turf/T = get_turf(source)
. = list()
if(!T)
return
var/list/processing = list()
if (R == 0) // if the range is zero, we know exactly where to look for, we can skip view
processing += T.contents // We can shave off one iteration by assuming turfs cannot hear
else // A variation of get_hear inlined here to take advantage of the compiler's fastpath for obj/mob in view
var/lum = T.luminosity
T.luminosity = 6 // This is the maximum luminosity
for(var/mob/M in view(R, T))
processing += M
for(var/obj/O in view(R, T))
processing += O
T.luminosity = lum
while(processing.len) // recursive_hear_check inlined here
var/atom/A = processing[1]
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing.Cut(1, 2)
processing += A.contents
/proc/get_hearers_in_view_old_new_new(R, atom/source)
// Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode.
var/turf/T = get_turf(source)
. = list()
if(!T)
return
var/list/processing = list()
if (R == 0) // if the range is zero, we know exactly where to look for, we can skip view
processing += T.contents // We can shave off one iteration by assuming turfs cannot hear
else // A variation of get_hear inlined here to take advantage of the compiler's fastpath for obj/mob in view
var/lum = T.luminosity
T.luminosity = 6 // This is the maximum luminosity
for(var/turf/T2 in view(R, T))
processing += T2
T.luminosity = lum
while(processing.len) // recursive_hear_check inlined here
var/atom/A = processing[1]
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing.Cut(1, 2)
processing += A.contents
/proc/get_hearers_in_view_new(R, atom/source)
var/turf/T = get_turf(source)
if(!T)
return
. = list()
var/list/processing = list()
if(R == 0)
processing += T.contents
else
var/lum = T.luminosity
T.luminosity = 6
var/list/cachedview = view(R, T)
for(var/mob/M in cachedview)
processing += M
for(var/obj/O in cachedview)
processing += O
T.luminosity = lum
var/i = 1
while(i < length(processing))
var/atom/A = processing[i++]
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing += A.contents
/proc/get_hearers_in_view_new_new(R, atom/source)
var/turf/T = get_turf(source)
if(!T)
return
@@ -379,28 +262,6 @@
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing += A.contents
/proc/get_hearers_in_view_new_new_new(R, atom/source)
var/turf/T = get_turf(source)
if(!T)
return
. = list()
var/list/processing = list()
if(R == 0)
processing += T.contents
else
var/lum = T.luminosity
T.luminosity = 6
for(var/turf/T2 in view(R, T))
processing += T2
T.luminosity = lum
var/i = 1
while(i < length(processing))
var/atom/A = processing[i++]
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing += A.contents
/proc/get_mobs_in_radio_ranges(list/obj/item/radio/radios)
. = list()
// Returns a list of mobs who can hear any of the radios given in @radios

View File

@@ -457,36 +457,35 @@ Turf and target are separate in case you want to teleport some distance from a t
/atom/proc/GetAllContents(var/T)
var/list/processing_list = list(src)
var/list/assembled = list()
if(T)
while(processing_list.len)
var/atom/A = processing_list[1]
processing_list.Cut(1, 2)
. = list()
var/i = 1
while(i < length(processing_list))
var/atom/A = processing_list[i++]
//Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed
//This is also why we don't need to check against assembled as we go along
processing_list += A.contents
if(istype(A,T))
assembled += A
. += A
else
while(processing_list.len)
var/atom/A = processing_list[1]
processing_list.Cut(1, 2)
var/i = 1
while(i < length(processing_list))
var/atom/A = processing_list[i++]
processing_list += A.contents
assembled += A
return assembled
return processing_list
/atom/proc/GetAllContentsIgnoring(list/ignore_typecache)
if(!length(ignore_typecache))
return GetAllContents()
var/list/processing = list(src)
var/list/assembled = list()
while(processing.len)
var/atom/A = processing[1]
processing.Cut(1,2)
. = list()
var/i = 1
while(i < length(processing))
var/atom/A = processing[i++]
if(!ignore_typecache[A.type])
processing += A.contents
assembled += A
return assembled
. += A
//Step-towards method of determining whether one atom can see another. Similar to viewers()
/proc/can_see(atom/source, atom/target, length=5) // I couldnt be arsed to do actual raycasting :I This is horribly inaccurate.