Add stripped wood part1

This commit is contained in:
NO11 2021-06-15 16:26:32 +00:00
parent ab389e9995
commit 2de615a1f4
1 changed files with 33 additions and 0 deletions

View File

@ -351,6 +351,34 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
})
-- Axes
local function make_stripped_trunk(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node(pointed_thing.under)
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if not placer:get_player_control().sneak and noddef.on_rightclick then
return minetest.item_place(itemstack, placer, pointed_thing)
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 noddef._mcl_stripped_varient == nil then
return itemstack
else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_varient, param2=node.param2})
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
end
return itemstack
end
minetest.register_tool("mcl_tools:axe_wood", {
description = S("Wooden Axe"),
_doc_items_longdesc = axe_longdesc,
@ -364,6 +392,7 @@ minetest.register_tool("mcl_tools:axe_wood", {
damage_groups = {fleshy=7},
punch_attack_uses = 30,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
@ -383,6 +412,7 @@ minetest.register_tool("mcl_tools:axe_stone", {
damage_groups = {fleshy=9},
punch_attack_uses = 66,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
@ -403,6 +433,7 @@ minetest.register_tool("mcl_tools:axe_iron", {
damage_groups = {fleshy=9},
punch_attack_uses = 126,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
@ -422,6 +453,7 @@ minetest.register_tool("mcl_tools:axe_gold", {
damage_groups = {fleshy=7},
punch_attack_uses = 17,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
@ -441,6 +473,7 @@ minetest.register_tool("mcl_tools:axe_diamond", {
damage_groups = {fleshy=9},
punch_attack_uses = 781,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,