ID:178898
 
First, if you have an area, how would you test to see if any mobs are present within the area? All it would have to do is return "true" when one or more mobs are present.

Second, if you have a terrain with icon "A" and you want to change it to icon "B", how could you do it? This is assuming the coordinates are already known. Thanks.
First, if you have an area, how would you test to see if any mobs are present within the area? All it would have to do is return "true" when one or more mobs are present.

Area.contents is all of the turfs in the area. To find mobs, you have to loop through all the turfs and check them for mobs..

for(turf/T in some_area.contents)
if(locate(/mob) in T)
return TRUE
return FALSE

Second, if you have a terrain with icon "A" and you want to change it to icon "B", how could you do it? This is assuming the coordinates are already known. Thanks.

You can use locate() to get a reference to the turf, then modify its icon variable.

var/turf/T = locate(X, Y, Z)
T.icon = 'some_icon.dmi'

-AbyssDragon
In response to AbyssDragon
I tried using

for(var/turf/T in bfield1.contents)
if(locate(/mob) in T)
return TRUE

everything works except the bfield1.contents

I have it defined elsewhere as area/bfield1; do I need to define it differently?
In response to AbyssDragon
I also tried using a code similar to the example for locate() in the reference that finds the first instance of something in a list. Everything worked except bfield1 (which I used instead of world); the compiler called it a "bad var." I have it defined as area/bfield1; should I define it differently?