|
78 | 78 | *
|
79 | 79 | * * view_radius - what radius search circle we are using, worse performance as this increases
|
80 | 80 | * * source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
|
| 81 | + * * contents_type - the type of contents we want to be looking for. defaults to hearing sensitive |
81 | 82 | */
|
82 |
| -/proc/get_hearers_in_view(view_radius, atom/source) |
| 83 | +/proc/get_hearers_in_view(view_radius, atom/source, contents_type=RECURSIVE_CONTENTS_HEARING_SENSITIVE) |
83 | 84 | var/turf/center_turf = get_turf(source)
|
84 | 85 | if(!center_turf)
|
85 | 86 | return
|
|
88 | 89 |
|
89 | 90 | if(view_radius <= 0)//special case for if only source cares
|
90 | 91 | for(var/atom/movable/target as anything in center_turf)
|
91 |
| - var/list/recursive_contents = target.important_recursive_contents?[RECURSIVE_CONTENTS_HEARING_SENSITIVE] |
| 92 | + var/list/recursive_contents = target.important_recursive_contents?[contents_type] |
92 | 93 | if(recursive_contents)
|
93 | 94 | . += recursive_contents
|
94 | 95 | return .
|
95 | 96 |
|
96 |
| - var/list/hearables_from_grid = SSspatial_grid.orthogonal_range_search(source, RECURSIVE_CONTENTS_HEARING_SENSITIVE, view_radius) |
| 97 | + var/list/hearables_from_grid = SSspatial_grid.orthogonal_range_search(source, contents_type, view_radius) |
97 | 98 |
|
98 | 99 | if(!length(hearables_from_grid))//we know that something is returned by the grid, but we dont know if we need to actually filter down the output
|
99 | 100 | return .
|
|
126 | 127 | *
|
127 | 128 | * * radius - what radius search circle we are using, worse performance as this increases
|
128 | 129 | * * source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
|
| 130 | + * * contents_type - the type of contents we want to be looking for. defaults to hearing sensitive |
129 | 131 | */
|
130 |
| -/proc/get_hearers_in_range(range, atom/source) |
| 132 | +/proc/get_hearers_in_range(range, atom/source, contents_type=RECURSIVE_CONTENTS_HEARING_SENSITIVE) |
131 | 133 | var/turf/center_turf = get_turf(source)
|
132 | 134 | if(!center_turf)
|
133 | 135 | return
|
|
136 | 138 |
|
137 | 139 | if(range <= 0)//special case for if only source cares
|
138 | 140 | for(var/atom/movable/target as anything in center_turf)
|
139 |
| - var/list/recursive_contents = target.important_recursive_contents?[RECURSIVE_CONTENTS_HEARING_SENSITIVE] |
| 141 | + var/list/recursive_contents = target.important_recursive_contents?[contents_type] |
140 | 142 | if(recursive_contents)
|
141 | 143 | . += recursive_contents
|
142 | 144 | return .
|
143 | 145 |
|
144 |
| - var/list/hearables_from_grid = SSspatial_grid.orthogonal_range_search(source, RECURSIVE_CONTENTS_HEARING_SENSITIVE, range) |
| 146 | + var/list/hearables_from_grid = SSspatial_grid.orthogonal_range_search(source, contents_type, range) |
145 | 147 |
|
146 | 148 | if(!length(hearables_from_grid))//we know that something is returned by the grid, but we dont know if we need to actually filter down the output
|
147 | 149 | return .
|
|
161 | 163 | * * view_radius - what radius search circle we are using, worse performance as this increases but not as much as it used to
|
162 | 164 | * * source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
|
163 | 165 | */
|
164 |
| -/proc/get_hearers_in_LOS(view_radius, atom/source) |
| 166 | +/proc/get_hearers_in_LOS(view_radius, atom/source, contents_type=RECURSIVE_CONTENTS_HEARING_SENSITIVE) |
165 | 167 | var/turf/center_turf = get_turf(source)
|
166 | 168 | if(!center_turf)
|
167 | 169 | return
|
168 | 170 |
|
169 | 171 | if(view_radius <= 0)//special case for if only source cares
|
170 | 172 | . = list()
|
171 | 173 | for(var/atom/movable/target as anything in center_turf)
|
172 |
| - var/list/hearing_contents = target.important_recursive_contents?[RECURSIVE_CONTENTS_HEARING_SENSITIVE] |
| 174 | + var/list/hearing_contents = target.important_recursive_contents?[contents_type] |
173 | 175 | if(hearing_contents)
|
174 | 176 | . += hearing_contents
|
175 | 177 | return
|
176 | 178 |
|
177 |
| - . = SSspatial_grid.orthogonal_range_search(source, SPATIAL_GRID_CONTENTS_TYPE_HEARING, view_radius) |
| 179 | + . = SSspatial_grid.orthogonal_range_search(source, contents_type, view_radius) |
178 | 180 |
|
179 | 181 | for(var/atom/movable/target as anything in .)
|
180 | 182 | var/turf/target_turf = get_turf(target)
|
|
209 | 211 | . = list()
|
210 | 212 | // Returns a list of mobs who can hear any of the radios given in @radios
|
211 | 213 | for(var/obj/item/radio/radio as anything in radios)
|
212 |
| - . |= get_hearers_in_LOS(radio.canhear_range, radio, FALSE) |
| 214 | + . |= get_hearers_in_LOS(radio.canhear_range, radio) |
213 | 215 |
|
214 | 216 | //Used when converting pixels to tiles to make them accurate
|
215 | 217 | #define OFFSET_X (0.5 / ICON_SIZE_X)
|
|
0 commit comments