0
0
Fork 0

Fix crash when pushing pumpkin by piston

This commit is contained in:
Bu-Gee 2018-03-05 12:53:16 +01:00 committed by Wuzzy
parent 34333c6b54
commit 3ae8119498
1 changed files with 8 additions and 5 deletions

View File

@ -214,12 +214,15 @@ function minetest.handle_node_drops(pos, drops, digger)
-- Check if node will yield its useful drop by the digger's tool -- Check if node will yield its useful drop by the digger's tool
local dug_node = minetest.get_node(pos) local dug_node = minetest.get_node(pos)
local toolcaps
if digger ~= nil then
local tool = digger:get_wielded_item() local tool = digger:get_wielded_item()
local toolcaps = tool:get_tool_capabilities() toolcaps = tool:get_tool_capabilities()
if not check_can_drop(dug_node.name, toolcaps) then if not check_can_drop(dug_node.name, toolcaps) then
return return
end end
end
--[[ Special node drops when dug by shears by reading _mcl_shears_drop --[[ Special node drops when dug by shears by reading _mcl_shears_drop
from the node definition. from the node definition.
@ -228,7 +231,7 @@ function minetest.handle_node_drops(pos, drops, digger)
* table: Drop every itemstring in this table when dub by shears * table: Drop every itemstring in this table when dub by shears
]] ]]
local nodedef = minetest.registered_nodes[dug_node.name] local nodedef = minetest.registered_nodes[dug_node.name]
if toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
if nodedef._mcl_shears_drop == true then if nodedef._mcl_shears_drop == true then
drops = { dug_node.name } drops = { dug_node.name }
else else