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.
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
// Returns the atom sitting on the turf.
|
|
// For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
|
|
/proc/get_atom_on_turf(var/atom/movable/M)
|
|
var/atom/mloc = M
|
|
while(mloc && mloc.loc && !istype(mloc.loc, /turf/))
|
|
mloc = mloc.loc
|
|
return mloc
|
|
|
|
/proc/iswall(turf/T)
|
|
return (istype(T, /turf/simulated/wall) || istype(T, /turf/unsimulated/wall) || istype(T, /turf/simulated/shuttle/wall))
|
|
|
|
/proc/isfloor(turf/T)
|
|
return (istype(T, /turf/simulated/floor) || istype(T, /turf/unsimulated/floor) || istype(T, /turf/simulated/shuttle/floor))
|
|
|
|
/proc/turf_clear(turf/T)
|
|
for(var/atom/A in T)
|
|
if(A.simulated)
|
|
return 0
|
|
return 1
|
|
|
|
// Picks a turf without a mob from the given list of turfs, if one exists.
|
|
// If no such turf exists, picks any random turf from the given list of turfs.
|
|
/proc/pick_mobless_turf_if_exists(var/list/start_turfs)
|
|
if(!start_turfs.len)
|
|
return null
|
|
|
|
var/list/available_turfs = list()
|
|
for(var/start_turf in start_turfs)
|
|
var/mob/M = locate() in start_turf
|
|
if(!M)
|
|
available_turfs += start_turf
|
|
if(!available_turfs.len)
|
|
available_turfs = start_turfs
|
|
return pick(available_turfs)
|
|
|
|
/proc/turf_contains_dense_objects(var/turf/T)
|
|
return T.contains_dense_objects()
|
|
|
|
/proc/not_turf_contains_dense_objects(var/turf/T)
|
|
return !turf_contains_dense_objects(T)
|
|
|
|
/proc/is_station_turf(var/turf/T)
|
|
return T && isStationLevel(T.z)
|