Skip to content

Commit

Permalink
Add more debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Haase committed Dec 17, 2017
1 parent 7d5b5e8 commit aa1408a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ end
function areas:getNodeOwners(pos)
local owners = {}
for _, area in pairs(self:getAreasAtPos(pos)) do
if area.owner then
if area.owner and (area.owner ~= "") then
table.insert(owners, area.owner)
end
end
Expand Down
18 changes: 15 additions & 3 deletions interact.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end

local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
Expand All @@ -11,13 +23,13 @@ minetest.register_on_protection_violation(function(pos, name)
if not areas:canInteract(pos, name) then
local owners = areas:getNodeOwners(pos)

print(owners)
print(dump(owners))

if not owners then
if not owners[1] then
owners = areas:getNodeOwnerGroups(pos)
end

print(owners)
print(dump(owners))

if not owners then
owners = {}
Expand Down

0 comments on commit aa1408a

Please sign in to comment.