Fix invalid function signature for `on_place` callbacks + handling of possible nil value

This commit is contained in:
AFCMS 2022-12-04 18:36:54 +01:00 committed by Gitea
parent 4457432d32
commit 1e31e383d4
1 changed files with 10 additions and 6 deletions

View File

@ -246,9 +246,11 @@ minetest.register_node("mcl_core:realm_barrier", {
_mcl_hardness = -1, _mcl_hardness = -1,
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) on_place = function(_, placer, _)
if placer then
minetest.chat_send_player(placer:get_player_name(), minetest.chat_send_player(placer:get_player_name(),
minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!")) minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!"))
end
return return
end, end,
}) })
@ -277,9 +279,11 @@ minetest.register_node("mcl_core:void", {
on_blast = function() end, on_blast = function() end,
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) on_place = function(_, placer, _)
if placer then
minetest.chat_send_player(placer:get_player_name(), minetest.chat_send_player(placer:get_player_name(),
minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!")) minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!"))
end
return return
end, end,
drop = "", drop = "",