mirror of
https://github.com/minetest-mods/areas.git
synced 2025-07-01 07:30:28 +02:00
Ajoute certaines modifications venant de MFF + ajustement HUD
* Aires openfarming * Privilège megabuilder * HUD légèrement modifié pour laisser de la place à celui de factions
This commit is contained in:
27
api.lua
27
api.lua
@ -1,5 +1,14 @@
|
||||
local hudHandlers = {}
|
||||
|
||||
---plants to place in openfarming
|
||||
local plants = {
|
||||
["farming:blueberries"]="air", ["farming:carrot"]="air", ["farming:coffee_beans"]="air",
|
||||
["farming:corn"]="air", ["farming:cucumber"]="air", ["farming:melon_slice"]="air",
|
||||
["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air",
|
||||
["farming:rhubarb"]="air", ["farming:tomato"]="air", ["farming:seed_cotton"]="air",
|
||||
["farming:seed_wheat"]="air",["default:papyrus"]="air", ["farming:trellis"]="air",
|
||||
["farming:grapes"]="farming:trellis", ["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole",
|
||||
}
|
||||
|
||||
areas.registered_on_adds = {}
|
||||
areas.registered_on_removes = {}
|
||||
@ -94,6 +103,24 @@ function areas:canInteract(pos, name)
|
||||
for _, area in pairs(self:getAreasAtPos(pos)) do
|
||||
if area.owner == name or area.open then
|
||||
return true
|
||||
elseif area.openfarming then
|
||||
-- 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)
|
||||
if not player then return false end
|
||||
local wstack = player:get_wielded_item():get_name()
|
||||
if wstack == "" then wstack = "hand" end
|
||||
|
||||
--on_dig
|
||||
if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
|
||||
return true
|
||||
end
|
||||
|
||||
--on_place
|
||||
if plants[wstack] ~= nil and plants[wstack] == node then
|
||||
return true
|
||||
end
|
||||
elseif areas.factions_available and area.faction_open then
|
||||
local faction_name = factions.get_player_faction(area.owner)
|
||||
if faction_name ~= nil and faction_name == factions.get_player_faction(name) then
|
||||
|
Reference in New Issue
Block a user