mod - firefly - fix wrong check for object on place

This commit is contained in:
mckaygerhard 2024-04-26 17:33:24 -04:00
parent 60ac7cccc9
commit 451b2994fe

View File

@ -47,6 +47,7 @@ minetest.register_tool("fireflies:bug_net", {
minetest.is_protected(pointed_thing.under, player:get_player_name()) then minetest.is_protected(pointed_thing.under, player:get_player_name()) then
return return
end end
if not player then return itemstack end
local node_name = minetest.get_node(pointed_thing.under).name local node_name = minetest.get_node(pointed_thing.under).name
local inv = player:get_inventory() local inv = player:get_inventory()
if minetest.get_item_group(node_name, "catchable") == 1 then if minetest.get_item_group(node_name, "catchable") == 1 then
@ -102,6 +103,8 @@ minetest.register_node("fireflies:firefly_bottle", {
}, },
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if not player then return itemstack end
local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z} local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
if minetest.is_protected(pos, player:get_player_name()) or if minetest.is_protected(pos, player:get_player_name()) or
minetest.get_node(lower_pos).name ~= "air" then minetest.get_node(lower_pos).name ~= "air" then