diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 1c49f50..de87f3e 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1046,6 +1046,25 @@ minetest.register_node( floodable = true, groups = {snappy = 2, dig_immediate = 3, attached_node = 1, grass = 1, normal_grass = 1, green_grass = 1}, sounds = default.node_sound_leaves_defaults(), + on_rightclick = function(pos, node, player, itemstack) + -- Trim tall grass clump when rightclicked by shears + local name = itemstack:get_name() + if minetest.get_item_group(name, "shears") == 1 then + -- This turns it to a normal grass clump and drops one bonus grass clump + minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = player:get_pos(), max_hear_distance = 8}) + minetest.set_node(pos, {name = "default:grass"}) + + item_drop.drop_item(pos, "default:grass") + + -- Add wear + if not minetest.settings:get_bool("creative_mode") then + local def = itemstack:get_definition() + itemstack:add_wear(math.ceil(65536 / def.tool_capabilities.groupcaps.snappy.uses)) + end + end + + return itemstack + end, }) -- Thistle