short digging allowed function

This commit is contained in:
HybridDog 2015-12-05 12:39:42 +01:00
parent 8797de8748
commit 8dabe8667a
1 changed files with 17 additions and 12 deletions

View File

@ -19,27 +19,33 @@ local function add_stair_and_slab(name)
) )
end end
--[[
local function add_fence(name)
local def = minetest.registered_nodes[name]
local fencedef = {}
for _,i in pairs({"walkable", "sunlike_propagates"}) do
if def[i] ~= nil then
fencedef[i] = def[i]
end
end
end
--]]
local function digging_allowed(player, v) local function digging_allowed(player, v)
if not player then if not player then
return false return false
end end
local tool = minetest.registered_tools[player:get_wielded_item():get_name()] local tool = minetest.registered_tools[player:get_wielded_item():get_name()]
if not tool then if not tool
or not tool.tool_capabilities then
return false return false
end end
local capabilities = tool.tool_capabilities local groups = tool.tool_capabilities.groupcaps
if not capabilities then
return false
end
local groups = capabilities.groupcaps
if not groups then if not groups then
return false return false
end end
local nether = groups.nether if groups.nether
if not nether then and groups.nether.times[v] then
return false
end
if nether.times[v] then
return true return true
end end
return false return false
@ -990,4 +996,3 @@ minetest.register_tool("nether:sword_white", {
damage_groups = {fleshy=11}, damage_groups = {fleshy=11},
}, },
}) })