fix tool crash

This commit is contained in:
Evert Prants 2018-10-10 18:46:20 +03:00
parent 5084213ee5
commit f826e18ad9
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
1 changed files with 3 additions and 3 deletions

View File

@ -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