random spawners now check if the destination turf is unblocked in a straight line (#82323)

## About The Pull Request
random spawners now check if the destination turf is unblocked in a
straight line


![image](https://github.com/tgstation/tgstation/assets/70376633/15fb4e23-95d1-473c-8bba-00b9497f0ca8)

(spammed grime spawner, nothing spawned behind glass)

## Why It's Good For The Game

bug

## Changelog
not player facing
This commit is contained in:
jimmyl
2024-03-31 14:32:07 +02:00
committed by GitHub
parent 1de3bb4ea4
commit ac1a70a835
@@ -94,18 +94,30 @@
/obj/effect/spawner/random/proc/make_item(spawn_loc, type_path_to_make)
return new type_path_to_make(spawn_loc)
///If the spawner has a spawn_scatter_radius set, this creates a list of nearby turfs available
///If the spawner has a spawn_scatter_radius set, this creates a list of nearby turfs available that are in view and have an unblocked line to them.
/obj/effect/spawner/random/proc/get_spawn_locations(radius)
var/list/scatter_locations = list()
if(radius >= 0)
for(var/turf/turf_in_view in view(radius, get_turf(src)))
if(isclosedturf(turf_in_view) || (isgroundlessturf(turf_in_view) && !GET_TURF_BELOW(turf_in_view)))
continue
scatter_locations += turf_in_view
if(!radius)
return scatter_locations
for(var/turf/turf_in_view in view(radius, get_turf(src)))
if(isclosedturf(turf_in_view) || (isgroundlessturf(turf_in_view) && !GET_TURF_BELOW(turf_in_view)))
continue
if(!has_unblocked_line(turf_in_view))
continue
scatter_locations += turf_in_view
return scatter_locations
/obj/effect/spawner/random/proc/has_unblocked_line(destination)
for(var/turf/potential_blockage as anything in get_line(get_turf(src), destination))
if(!potential_blockage.is_blocked_turf(exclude_mobs = TRUE))
continue
return FALSE
return TRUE
//finds the probabilities of items spawning from a loot spawner's loot pool
/obj/item/loot_table_maker
icon = 'icons/effects/landmarks_static.dmi'