sub TM_LocateTree
namespace push
namespace local LT
if !init = N/A
{
tile init
set !init #TRUE
}
set !radius %1
set !xmin #CHARPOSX - !radius
set !xmax #CHARPOSX + !radius
set !ymin #CHARPOSY - !radius
set !ymax #CHARPOSY + !radius
for !x !xmin !xmax
{
for !y !ymin !ymax
{
tile cnt !x !y #CURSKIND
if #TILECNT > 0
{
for !i 1 #TILECNT
{
tile get !x !y !i #CURSKIND
if tree in #TILENAME
{
set #LTARGETX !x
set #LTARGETY !y
set #LTARGETZ #TILEZ
set #LTARGETTILE #TILETYPE
set #LTARGETKIND 3
namespace pop
return #TRUE
}
}
}
}
}
namespace pop
return #FALSE