mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
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  (spammed grime spawner, nothing spawned behind glass) ## Why It's Good For The Game bug ## Changelog not player facing
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user