Make sure punched node has actually been got
parent
5878a255c3
commit
59ff757c80
18
init.lua
18
init.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue