|
发表于 2018-12-21 22:47:37
|
显示全部楼层
function path_create()
local l_set
local l_num=0
local l_cnt=1
local l_cntt=1
road.detail={}
l_sett=0
l_settt=0
l_path=path_cal()
--Note(l_path)
if type(l_path)~='string' then
if math.random(1,4)==1 then
l_path='stand;out;northeast;northwest;southeast;southwest;south;south;south;south;south'
elseif math.random(1,4)==2 then
l_path='stand;out;northeast;northwest;southeast;southwest;east;east;east;east;east;east'
elseif math.random(1,4)==3 then
l_path='stand;out;northeast;northwest;southeast;southwest;west;west;west;west;west;west'
else
l_path='stand;out;northeast;northwest;southeast;southwest;north;north;north;north;north'
end
end
l_set=utils.split(l_path,';') --一个alias里有几个命令
l_settt=table.getn(l_set)
--print(l_path)
if wdgostart==1 then
if l_settt<= wd_distance then l_settt=wd_distance end
for i=1,table.getn(l_set) do
if i<l_settt-wd_distance-2 then
if string.find(l_set[i],'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set[i]
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set[i]
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set[i]
end
l_num=l_num+1
if l_num>road.steps then
l_cnt=l_cnt+1
l_num=0
end
end
else
if string.find(l_set[i],'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set[i]
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set[i]
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set[i]
end
l_num=l_num+1
if l_num>0 then
l_cnt=l_cnt+1
l_num=0
end
end
end
end
else
for i=1,table.getn(l_set) do
if string.find(l_set[i],'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set[i]
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set[i]
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set[i]
end
l_num=l_num+1
if l_num>road.steps then
l_cnt=l_cnt+1
l_num=0
end
end
end
end
end
帮师兄转过来一起吧,这是lujing.lua里的 |
|