From ae1db7f4fd8a1541a83d179d3c0f54e7a95e2f35 Mon Sep 17 00:00:00 2001 From: BillyS Date: Thu, 20 Dec 2018 21:53:50 +0000 Subject: [PATCH] Fixed bug with plant processor --- mods/alchemy/plant_processor.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mods/alchemy/plant_processor.lua b/mods/alchemy/plant_processor.lua index c58291d..9157b0a 100644 --- a/mods/alchemy/plant_processor.lua +++ b/mods/alchemy/plant_processor.lua @@ -1,10 +1,10 @@ -local function check_move_protection(pos, player, stack) +local function check_move_protection(pos, player) local pName = player:get_player_name() if minetest.is_protected(pos, pName) then minetest.record_protection_violation(pos, pName) - return 0 + return false end - return stack:get_count() + return true end minetest.register_node("alchemy:plant_processor", { @@ -63,13 +63,22 @@ minetest.register_node("alchemy:plant_processor", { return nil end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) - return check_move_protection(pos, player, stack) + if check_move_protection(pos, player) then + return stack:get_count() + end + return 0 end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - return check_move_protection(pos, player, stack) + if check_move_protection(pos, player) then + return count + end + return 0 end, allow_metadata_inventory_take = function(pos, listname, index, stack, player) - return check_move_protection(pos, player, stack) + if check_move_protection(pos, player) then + return stack:get_count() + end + return 0 end, on_metadata_inventory_move = function(pos) local meta = minetest.get_meta(pos)