Fix errors caused by right-clicking unknown nodes
Some checks failed
Check & Release / lint (push) Has been cancelled

This commit is contained in:
SmallJoker 2023-10-18 21:57:58 +02:00
parent aca720dc0f
commit d6d43a4828
2 changed files with 20 additions and 12 deletions

View File

@ -106,9 +106,15 @@ if lavastuff.enable_tool_fire == true and lavastuff.fire_node then
function lavastuff.tool_fire_func(itemstack, user, pointed)
local name = user:get_player_name()
if pointed.type == "node" then
if pointed.type ~= "node" then
return
end
local node = minetest.get_node(pointed.under)
local def = minetest.registered_nodes[node.name]
if not def then
return -- Unknown node
end
if def.on_rightclick then
return def.on_rightclick(pointed.under, node, user, itemstack, pointed)
@ -122,7 +128,6 @@ if lavastuff.enable_tool_fire == true and lavastuff.fire_node then
COOLDOWN:set(user, 1)
end
end
end
end
function lavastuff.burn_drops(tool)

View File

@ -74,6 +74,9 @@ minetest.override_item("lavastuff:shovel", {
local node = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[node.name]
if not def then
return -- Unknown node
end
if not cooldown:get(user) and (def.groups.sand or (def.groups.silica_molten and def.liquidtype == "source")) then
cooldown:set(user, 0)