Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function character.ValidTiles(start, mapModel, range)
- local found, following, current = {}, {[start] = 0}
- for step=1,range do
- current, following = following, {}
- for space in pairs(current) do
- if space.isTraversable then
- for neighbor in neighborsInMap(space) do
- found[neighbor.yTile] = found[neighbor.yTile] or {}
- if not found[neighbor.yTile][neighbor.xTile] then
- found[neighbor.yTile][neighbor.xTile] = neighbor
- following[neighbor] = step
- end
- end
- end
- end
- end
- return found
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement