Add silk touch shovel

This commit is contained in:
Juraj Vajda 2023-02-18 10:52:24 -05:00
parent d4d8f0f4d3
commit 32c11ac1d8
3 changed files with 50 additions and 0 deletions

View File

@ -257,6 +257,15 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'everness:shovel_silk',
recipe = {
{ 'everness:crystal_purple', 'everness:ancient_emerald_ice', 'everness:crystal_purple' },
{ '', 'everness:glowing_pillar', '' },
{ '', 'group:stick', '' }
}
})
-- --
-- Fuels -- Fuels
-- --

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

View File

@ -121,3 +121,44 @@ minetest.register_tool('everness:pick_illuminating', {
return itemstack return itemstack
end end
}) })
minetest.register_tool('everness:shovel_silk', {
description = S('Silk Shovel'),
inventory_image = 'everness_shovel_silk.png',
wield_image = 'everness_shovel_silk.png^[transformR90',
wield_scale = { x = 2, y = 2, z = 1 },
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level = 1,
groupcaps = {
crumbly = { times = { [1] = 1.10, [2] = 0.50, [3] = 0.30 }, uses = 30, maxlevel = 3 },
},
damage_groups = { fleshy = 4 },
},
sound = { breaks = 'default_tool_breaks' },
-- no `shovel` group so it cannot be enchanted
-- groups = { shovel = 1 }
})
local old_handle_node_drops = minetest.handle_node_drops
function minetest.handle_node_drops(pos, drops, digger)
if not digger
or not digger:is_player()
or digger:get_wielded_item():get_name() ~= 'everness:shovel_silk'
then
return old_handle_node_drops(pos, drops, digger)
end
local node = minetest.get_node(pos)
-- Silk Touch
if minetest.get_item_group(node.name, 'crumbly') > 0
and minetest.get_item_group(node.name, 'no_silktouch') == 0
then
-- drop raw item/node
return old_handle_node_drops(pos, { ItemStack(node.name) }, digger)
end
return old_handle_node_drops(pos, drops, digger)
end