diff --git a/api.lua b/api.lua index 8c181ab..bca1508 100644 --- a/api.lua +++ b/api.lua @@ -132,7 +132,7 @@ function areas:getSmallestAreaAtPos(pos) return smallest_area, smallest_id end --- Checks if the area is unprotected, open, owned by player +-- Checks if the area is unprotected, open[farming], owned by player -- or player is part of faction of [smallest] area at position. function areas:canInteract(pos, name) if minetest.check_player_privs(name, self.adminPrivs) then @@ -146,13 +146,13 @@ function areas:canInteract(pos, name) areas_list = self:getAreasAtPos(pos) end local owned = false + local player = minetest.get_player_by_name(name) + local node = minetest.get_node(pos).name for _, area in pairs(areas_list) do -- Player owns the area or area is open if area.owner == name or area.open then return true elseif area.openfarming then -- If area is openfarming - local player = minetest.get_player_by_name(name) - local node = minetest.get_node(pos).name if player and minetest.registered_nodes[node] then local wstack = player:get_wielded_item():get_name() if wstack == "" then wstack = "hand" end