From f826e18ad901275323a26d88d4ac5ec87f34c9ad Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Wed, 10 Oct 2018 18:46:20 +0300 Subject: [PATCH] fix tool crash --- elepower_papi/tool.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elepower_papi/tool.lua b/elepower_papi/tool.lua index 18f5471..a71471b 100644 --- a/elepower_papi/tool.lua +++ b/elepower_papi/tool.lua @@ -115,15 +115,15 @@ function ele.register_tool(toolname, tooldef) if tooldef.on_use then local original_on_use = tooldef.on_use tooldef.on_use = function (itemstack, player, pointed_thing) - if not player or minetest.is_protected(pos, player:get_player_name()) then + local pos = pointed_thing.under + if not pos or not player or minetest.is_protected(pos, player:get_player_name()) then return itemstack end local storage = ele.tools.get_tool_property(itemstack, "storage") local usage = ele.tools.get_tool_property(itemstack, "usage") - local pos = pointed_thing.under - if not pos or (storage < usage and not creative) then + if storage < usage and not creative then return nil end