Files
CHOMPStation2/code/_helpers/areas.dm
PsiOmegaDelta 3b5990121f Blobs locations are now more random.
Blobs now randomly pick a random turf without obstructions in maintenance, instead of from a pre-determined list of locations.
Blobs also now log their spawn location, which admins can use to jump to it.

Space vines and nuclear discs have been updated to use the same mechanics.
2015-10-13 18:49:55 +02:00

22 lines
737 B
Plaintext

//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all turfs in areas of that type in the world.
/proc/get_area_turfs(var/areatype, var/list/predicates)
if(!areatype) return null
if(istext(areatype)) areatype = text2path(areatype)
if(isarea(areatype))
var/area/areatemp = areatype
areatype = areatemp.type
var/list/turfs = new/list()
for(var/areapath in typesof(areatype))
var/area/A = locate(areapath)
for(var/turf/T in A.contents)
if(!predicates || all_predicates_true(T, predicates))
turfs += T
return turfs
/proc/pick_area_turf(var/areatype, var/list/predicates)
var/list/turfs = get_area_turfs(areatype, predicates)
if(turfs && turfs.len)
return pick(turfs)