mirror of
https://github.com/HybridDog/nether-pack.git
synced 2024-11-05 01:40:38 +01:00
short digging allowed function
This commit is contained in:
parent
8797de8748
commit
8dabe8667a
|
@ -19,27 +19,33 @@ local function add_stair_and_slab(name)
|
|||
)
|
||||
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)
|
||||
if not player then
|
||||
return false
|
||||
end
|
||||
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
|
||||
end
|
||||
local capabilities = tool.tool_capabilities
|
||||
if not capabilities then
|
||||
return false
|
||||
end
|
||||
local groups = capabilities.groupcaps
|
||||
local groups = tool.tool_capabilities.groupcaps
|
||||
if not groups then
|
||||
return false
|
||||
end
|
||||
local nether = groups.nether
|
||||
if not nether then
|
||||
return false
|
||||
end
|
||||
if nether.times[v] then
|
||||
if groups.nether
|
||||
and groups.nether.times[v] then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@ -990,4 +996,3 @@ minetest.register_tool("nether:sword_white", {
|
|||
damage_groups = {fleshy=11},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user