Add mod toolrank compatibility #13
This commit is contained in:
parent
9754ff0cf6
commit
c9352cc79a
11
init.lua
11
init.lua
@ -90,6 +90,9 @@ local function add_wear(digger, node, num_nodes)
|
|||||||
if caps.groupcaps and caps.groupcaps.choppy then
|
if caps.groupcaps and caps.groupcaps.choppy then
|
||||||
local uses = caps.groupcaps.choppy.uses or 10
|
local uses = caps.groupcaps.choppy.uses or 10
|
||||||
uses = uses * 9
|
uses = uses * 9
|
||||||
|
if minetest.global_exists("toolranks") then
|
||||||
|
toolranks.new_afteruse(tool, digger, node, {wear = uses})
|
||||||
|
end
|
||||||
tool:add_wear(65535 * num_nodes / uses)
|
tool:add_wear(65535 * num_nodes / uses)
|
||||||
digger:set_wielded_item(tool)
|
digger:set_wielded_item(tool)
|
||||||
end
|
end
|
||||||
@ -279,6 +282,10 @@ local function can_dig(pos, digger)
|
|||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.param1 ~= 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
local tree_points, sapl_points = get_points(digger)
|
local tree_points, sapl_points = get_points(digger)
|
||||||
if is_lumberjack(digger, tree_points, sapl_points) then
|
if is_lumberjack(digger, tree_points, sapl_points) then
|
||||||
if chopper_tool(digger) then
|
if chopper_tool(digger) then
|
||||||
@ -288,10 +295,6 @@ local function can_dig(pos, digger)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.param1 ~= 0 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
if is_top_tree_node(pos, node.name) then
|
if is_top_tree_node(pos, node.name) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name=lumberjack
|
name=lumberjack
|
||||||
description=Chop down the entire tree by removing the bottom piece of the tree trunk.
|
description=Chop down the entire tree by removing the bottom piece of the tree trunk.
|
||||||
depends=
|
depends=
|
||||||
optional_depends=moretrees,ethereal,default
|
optional_depends=moretrees,ethereal,default,toolranks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user