handling exceptions when quarry digs (eg. when player is nil)

issues 172, 231, for example with item bones:bones
This commit is contained in:
Peter Maloney 2015-07-10 20:33:49 +02:00
parent a793747d92
commit 1f111c55e5

View File

@ -147,6 +147,8 @@ local function quarry_run(pos, node)
can_dig = false
end
local dignode
if not pcall(
function ()
if can_dig then
dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos)
local dignodedef = minetest.registered_nodes[dignode.name] or {diggable=false}
@ -165,6 +167,16 @@ local function quarry_run(pos, node)
end
end
end
end)
then
-- handle exception caused by nil player - issue 172 & 231
dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos)
message = "ERROR: technic/machines/HV/quarry.lua: unhandled exception digging... skipping block: "
message = message .. "digpos = (" .. digpos.x .. "," .. digpos.y .. "," .. digpos.z .. ")"
message = message .. ", name = " .. dignode.name
print(message)
can_dig = false
end
nd = nd + 1
if can_dig then
minetest.remove_node(digpos)