mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +01:00
Debark wood with an axe
This commit is contained in:
parent
988f298375
commit
652f8d48ed
1 changed files with 55 additions and 0 deletions
|
@ -352,6 +352,56 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Axes
|
-- Axes
|
||||||
|
|
||||||
|
local make_stripped_trunk = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type == "node" then
|
||||||
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local node_name = node.name
|
||||||
|
if placer and not placer:get_player_control().sneak then
|
||||||
|
if minetest.registered_nodes[node_name] and minetest.registered_nodes[node_name].on_rightclick then
|
||||||
|
return minetest.registered_nodes[node_name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
-- Add wear (as if digging a axey node)
|
||||||
|
local toolname = itemstack:get_name()
|
||||||
|
local wear = mcl_autogroup.get_wear(toolname, "axey")
|
||||||
|
itemstack:add_wear(wear)
|
||||||
|
end
|
||||||
|
if node_name == "mcl_core:tree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"})
|
||||||
|
elseif node_name == "mcl_core:darktree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"})
|
||||||
|
elseif node_name == "mcl_core:acaciatree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"})
|
||||||
|
elseif node_name == "mcl_core:birchtree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"})
|
||||||
|
elseif node_name == "mcl_core:sprucetree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"})
|
||||||
|
elseif node_name == "mcl_core:jungletree" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"})
|
||||||
|
elseif node_name == "mcl_core:tree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"})
|
||||||
|
elseif node_name == "mcl_core:darktree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"})
|
||||||
|
elseif node_name == "mcl_core:acaciatree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"})
|
||||||
|
elseif node_name == "mcl_core:birchtree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"})
|
||||||
|
elseif node_name == "mcl_core:sprucetree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"})
|
||||||
|
elseif node_name == "mcl_core:jungletree_bark" then
|
||||||
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_tool("mcl_tools:axe_wood", {
|
minetest.register_tool("mcl_tools:axe_wood", {
|
||||||
description = S("Wooden Axe"),
|
description = S("Wooden Axe"),
|
||||||
_doc_items_longdesc = axe_longdesc,
|
_doc_items_longdesc = axe_longdesc,
|
||||||
|
@ -365,6 +415,7 @@ minetest.register_tool("mcl_tools:axe_wood", {
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
punch_attack_uses = 30,
|
punch_attack_uses = 30,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "group:wood",
|
_repair_material = "group:wood",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -384,6 +435,7 @@ minetest.register_tool("mcl_tools:axe_stone", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 66,
|
punch_attack_uses = 66,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:cobble",
|
_repair_material = "mcl_core:cobble",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -404,6 +456,7 @@ minetest.register_tool("mcl_tools:axe_iron", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 126,
|
punch_attack_uses = 126,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:iron_ingot",
|
_repair_material = "mcl_core:iron_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -423,6 +476,7 @@ minetest.register_tool("mcl_tools:axe_gold", {
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
punch_attack_uses = 17,
|
punch_attack_uses = 17,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:gold_ingot",
|
_repair_material = "mcl_core:gold_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -442,6 +496,7 @@ minetest.register_tool("mcl_tools:axe_diamond", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 781,
|
punch_attack_uses = 781,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:diamond",
|
_repair_material = "mcl_core:diamond",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
|
Loading…
Reference in a new issue