Make sure punched node has actually been got

master
Cy 2013-10-12 14:47:07 -07:00
parent 5878a255c3
commit 59ff757c80
1 changed files with 11 additions and 7 deletions

View File

@ -34,6 +34,8 @@ end
sorters = {
wise = function(a,b)
-- XXX: this needs to have stricter ordering!
-- (why is air scoring higher than the end?)
if(a == nil) then
if b == nil then
return true
@ -117,13 +119,10 @@ function registerWand(method,sorter)
max_drop_level=0
},
on_use = function(self,user,punched)
local pos = minetest.get_pointed_thing_position(punched)
local pos = minetest.get_pointed_thing_position(punched)
if pos==nil then
return
end
if punched == nil then
punched = minetest.get_node(pos)
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if(inv == nil) then
@ -137,9 +136,14 @@ function registerWand(method,sorter)
return
end
-- Sokomine's shared chest locks
if locks ~= nil and punched and punched.name:starts('locks:') and not locks:lock_allow_use(pos,user) then
-- the error has already been reported (yay side effects)
return
if locks ~= nil then
if punched == nil or punched.name == nil then
punched = minetest.get_node(pos)
end
if punched and punched.name:starts('locks:') and not locks:lock_allow_use(pos,user) then
-- the error has already been reported (yay side effects)
return
end
end
if(sortInventory(inv,sorter)) then