Add files via upload
parent
5e0b9a83ae
commit
f1de271715
10
init.lua
10
init.lua
|
@ -1365,10 +1365,6 @@ end
|
||||||
local function aqua_radar_dumb(pos,yaw,range,reverse)
|
local function aqua_radar_dumb(pos,yaw,range,reverse)
|
||||||
range = range or 4
|
range = range or 4
|
||||||
|
|
||||||
local function newpos(p,y,r)
|
|
||||||
return mobkit.pos_shift(p,vector.multiply(minetest.yaw_to_dir(y),r))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function okpos(p)
|
local function okpos(p)
|
||||||
local node = mobkit.nodeatpos(p)
|
local node = mobkit.nodeatpos(p)
|
||||||
if node then
|
if node then
|
||||||
|
@ -1394,7 +1390,7 @@ local function aqua_radar_dumb(pos,yaw,range,reverse)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local fpos = newpos(pos,yaw,range)
|
local fpos = mobkit.pos_translate2d(pos,yaw,range)
|
||||||
local ok,h = okpos(fpos)
|
local ok,h = okpos(fpos)
|
||||||
if not ok then
|
if not ok then
|
||||||
local ffrom, fto, fstep
|
local ffrom, fto, fstep
|
||||||
|
@ -1404,9 +1400,9 @@ local function aqua_radar_dumb(pos,yaw,range,reverse)
|
||||||
ffrom, fto, fstep = 1,3,1
|
ffrom, fto, fstep = 1,3,1
|
||||||
end
|
end
|
||||||
for i=ffrom, fto, fstep do
|
for i=ffrom, fto, fstep do
|
||||||
local ok,h = okpos(newpos(pos,yaw+i,range))
|
local ok,h = okpos(mobkit.pos_translate2d(pos,yaw+i,range))
|
||||||
if ok then return yaw+i,h end
|
if ok then return yaw+i,h end
|
||||||
ok,h = okpos(newpos(pos,yaw-i,range))
|
ok,h = okpos(mobkit.pos_translate2d(pos,yaw-i,range))
|
||||||
if ok then return yaw-i,h end
|
if ok then return yaw-i,h end
|
||||||
end
|
end
|
||||||
return yaw+pi,h
|
return yaw+pi,h
|
||||||
|
|
Loading…
Reference in New Issue