From 1e31e383d4dac1cbe9d96ca1152922e91c61b453 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 4 Dec 2022 18:36:54 +0100 Subject: [PATCH] Fix invalid function signature for `on_place` callbacks + handling of possible nil value --- mods/ITEMS/mcl_core/nodes_misc.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_misc.lua b/mods/ITEMS/mcl_core/nodes_misc.lua index 50c683232..81a2fab32 100644 --- a/mods/ITEMS/mcl_core/nodes_misc.lua +++ b/mods/ITEMS/mcl_core/nodes_misc.lua @@ -246,9 +246,11 @@ minetest.register_node("mcl_core:realm_barrier", { _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. node_placement_prediction = "", - on_place = function(pos, placer, itemstack, pointed_thing) - minetest.chat_send_player(placer:get_player_name(), - minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!")) + on_place = function(_, placer, _) + if placer then + minetest.chat_send_player(placer:get_player_name(), + minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!")) + end return end, }) @@ -277,9 +279,11 @@ minetest.register_node("mcl_core:void", { 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. node_placement_prediction = "", - on_place = function(pos, placer, itemstack, pointed_thing) - minetest.chat_send_player(placer:get_player_name(), - minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!")) + on_place = function(_, placer, _) + if placer then + minetest.chat_send_player(placer:get_player_name(), + minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!")) + end return end, drop = "",