1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
GetTiles = function()
local gn, ch = GetNeigh, Check
GetNeigh = function(x, y)
return { {x + 1, y}, {x, y + 1}, {x - 1, y}, {x, y - 1} }
end
Check = function(x, y, list, chlist)
for _, P in pairs(GetNeigh(x, y)) do
if chlist[P[1].."x"..P[2]] == nil then
chlist[P[1].."x"..P[2]] = true
if tile(P[1], P[2], "walkable") then
table.insert(list, {P[1], P[2]})
list, chlist = Check(P[1], P[2], list, chlist)
end
end
end
return list, chlist
end
local List, CheckList = {}, {}
for _, ent in pairs({0, 1, 2}) do --// info_T, info_CT, info_VIP
for __, e in pairs(entitylist(ent)) do --// entitylist
List, CheckList = Check(e.x, e.y, List, CheckList)
end
end
GetNeigh, Check = gn, ch
return List
end
It returns all positions where player can move from spawnpoints.