Locating pawns near building and locating tiles near building, setting fires.

Started by fenix849, February 23, 2015, 05:08:29 AM

Previous topic - Next topic

fenix849

Im having an issue while trying to expand the functionality of my mod.

My first issue is that im trying to locate pawns within a set range of my building.
I currently have something like this:
         
foreach (Pawn p in Find.ListerPawns.FreeColonists)
            {
                Log.Message(p.ToString());
                Log.Message(p.Position.ToString());
               
                if(p.Position.WithinHorizontalDistanceOf(this.Position, 2))
                {
                   Log.Message("isNearby");
                   
                }


I get an error about missing method WithinHorizontalDistanceOf, but thats code i've seen on the forum, does anyone have a functional example of finding pawns within a specific range (working in alpha 9 perferably).

Secondly, I'm also looking for a way to create fire on nearby tiles, so first, locate nearby tiles, select randomly from them and set them on fire. Working examples are appreciated.