mirror of
https://github.com/HybridDog/builtin_item.git
synced 2024-12-22 17:00:27 +01:00
use get_node more selden
This commit is contained in:
parent
13aecb026d
commit
06cfcc90fe
13
init.lua
13
init.lua
@ -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 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
|
||||
for i = -1,1,2 do
|
||||
for _,p in pairs({
|
||||
@ -9,6 +21,7 @@ local function get_nodes(pos)
|
||||
n = n+1
|
||||
end
|
||||
end
|
||||
last_tab = tab
|
||||
return tab
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user