forked from nalc/areas
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
a8cacee8cc |
30
api.lua
30
api.lua
@ -110,25 +110,27 @@ function areas:canInteract(pos, name)
|
|||||||
for _, area in pairs(self:getAreasAtPos(pos)) do
|
for _, area in pairs(self:getAreasAtPos(pos)) do
|
||||||
if area.owner == name or area.open then
|
if area.owner == name or area.open then
|
||||||
return true
|
return true
|
||||||
elseif area.openfarming then
|
end
|
||||||
|
if area.openfarming then
|
||||||
-- if area is openfarming
|
-- if area is openfarming
|
||||||
local node = minetest.get_node(pos).name
|
|
||||||
if not minetest.registered_nodes[node] then return false end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
if not player then return false end
|
local node = minetest.get_node(pos).name
|
||||||
local wstack = player:get_wielded_item():get_name()
|
if player and minetest.registered_nodes[node] then
|
||||||
if wstack == "" then wstack = "hand" end
|
local wstack = player:get_wielded_item():get_name()
|
||||||
|
if wstack == "" then wstack = "hand" end
|
||||||
|
|
||||||
--on_dig
|
--on_dig
|
||||||
if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
|
if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--on_place
|
--on_place
|
||||||
if plants[wstack] ~= nil and plants[wstack] == node then
|
if plants[wstack] ~= nil and plants[wstack] == node then
|
||||||
return true
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif areas.factions_available and area.faction_open then
|
end
|
||||||
|
if areas.factions_available and area.faction_open then
|
||||||
if (factions.version or 0) < 2 then
|
if (factions.version or 0) < 2 then
|
||||||
local faction_name = factions.get_player_faction(name)
|
local faction_name = factions.get_player_faction(name)
|
||||||
if faction_name then
|
if faction_name then
|
||||||
|
Reference in New Issue
Block a user