You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.0 KiB

1 year ago
-- LUALOCALS < ---------------------------------------------------------
local include, nodecore, pairs, string, table
= include, nodecore, pairs, string, table
local string_lower
= string.lower
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
--nodecore.gametime
local cache = {}
local relativeNeighbors = {
vector.new(1, 0, 0),
vector.new(0, 0, 1),
vector.new(-1, 0, 0),
vector.new(0, 0, -1)
}
function check_position(pos)
local hash = minetest.hash_node_position(pos)
if cache[hash] then
return cache[hash]
end
local ret = minetest.get_node(pos)
print_r(ret)
print_r(minetest.registered_items[ret.name])
print(pos)
cache[hash] = ret
return ret
end
function check_captures(pos)
minetest.chat_send_all(tostring(pos))
nodecore.node_sound(pos, "dug")
check_position(pos + vector.new(0, -1, 0))
local neighbors = {}
for i,v in ipairs(relativeNeighbors) do
neighbors[i] = pos + v
end
end
function surrounded_group(pos)
local group = {}
local queue = {}
end
function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..pos.."] => "..tostring(t).." {")
sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
print(indent..string.rep(" ",string.len(pos)+6).."}")
else
print(indent.."["..pos.."] => "..tostring(val))
end
end
else
print(indent..tostring(t))
end
end
end
sub_print_r(t," ")
end