From e2ffae0b88fe561618f20b8f78e72c2223988b19 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 21 Feb 2015 03:56:40 +0100 Subject: [PATCH] Fix minor sickle issues fixes two minor issues: -sickle didn't respect protection for grass or wheat -sickle added wear even though the item wasn't diggable --- dryplants/init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dryplants/init.lua b/dryplants/init.lua index a0b6d5d..3ad57f4 100644 --- a/dryplants/init.lua +++ b/dryplants/init.lua @@ -75,6 +75,9 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses) return end + if not sickle_can_break(pt.under, under, user) then + return + end -- check if something that can be cut using fine tools if minetest.get_item_group(under.name, "snappy") > 0 then -- check if flora but no flower @@ -82,7 +85,9 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses) -- turn the node into cut grass, wear out item and play sound minetest.set_node(pt.under, {name="dryplants:grass"}) else -- otherwise dig the node - minetest.dig_node(pt.under) + if not minetest.dig_node(pt.under) then + return + end end minetest.sound_play("default_dig_crumbly", { pos = pt.under, @@ -91,9 +96,6 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses) itemstack:add_wear(65535/(uses-1)) return itemstack elseif string.find(under.name, "default:dirt_with_grass") then - if not sickle_can_break(pt.under, under, user) then - return - end if minetest.is_protected(above_pos, user:get_player_name()) or above.name ~= "air" then return end