mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
22 lines
743 B
Plaintext
22 lines
743 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(list(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)
|