1
0
mirror of https://github.com/HybridDog/builtin_item.git synced 2024-12-23 01:10:26 +01:00

use get_node more selden

This commit is contained in:
HybridDog 2014-08-31 14:44:42 +02:00
parent 13aecb026d
commit 06cfcc90fe

View File

@ -1,4 +1,16 @@
local time = tonumber(os.clock())+10
local lastpos = vector.zero or {x=0, y=0, z=0}
local last_tab
local function get_nodes(pos) local function get_nodes(pos)
local rnd_pos = vector.round(pos)
local t = tonumber(os.clock())
if vector.equals(rnd_pos, lastpos)
and t-time < 10 then
return last_tab
end
time = t
lastpos = rnd_pos
local tab,n = {},1 local tab,n = {},1
for i = -1,1,2 do for i = -1,1,2 do
for _,p in pairs({ for _,p in pairs({
@ -9,6 +21,7 @@ local function get_nodes(pos)
n = n+1 n = n+1
end end
end end
last_tab = tab
return tab return tab
end end