mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
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.
22 lines
737 B
Plaintext
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)
|