Make sure that pointed thing is node when using treetap

This commit is contained in:
mrkubax10 2025-04-28 12:53:19 +02:00
parent 8d48b3f9f5
commit 62246bf91b

View File

@ -19,6 +19,9 @@ if industrialtest.mods.mclRubber then
end
local function onTreetapUse(user,pointed)
if pointed.type~="node" or not user or not user:is_player() then
return false
end
local node=minetest.get_node_or_nil(pointed.under)
if not node then
return false
@ -47,7 +50,7 @@ industrialtest.internal.unpackTableInto(industrialtest.Treetap,{
})
function industrialtest.Treetap.use(self,itemstack,user,pointed)
return pointed.type=="node" and user and user:is_player() and onTreetapUse(user,pointed)
return onTreetapUse(user,pointed)
end
industrialtest.Treetap:register()
@ -73,7 +76,7 @@ industrialtest.internal.unpackTableInto(industrialtest.ElectricTreetap,{
})
function industrialtest.ElectricTreetap.use(self,itemstack,user,pointed)
return user and user:is_player() and onTreetapUse(user,pointed)
return onTreetapUse(user,pointed)
end
function industrialtest.ElectricTreetap.getOpPower(self,itemstack)