From 397d449f1e668ceb8939626e018fc98ef72abbd3 Mon Sep 17 00:00:00 2001 From: auouymous Date: Thu, 10 Dec 2020 03:53:50 -0700 Subject: [PATCH] Use empty string for protection check if puncher or clicker is nil. --- mesecons_blinkyplant/init.lua | 2 +- mesecons_delayer/init.lua | 4 ++-- mesecons_noteblock/init.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mesecons_blinkyplant/init.lua b/mesecons_blinkyplant/init.lua index 3bad6a7..80b6b7e 100644 --- a/mesecons_blinkyplant/init.lua +++ b/mesecons_blinkyplant/init.lua @@ -33,7 +33,7 @@ mesecon.register_node("mesecons_blinkyplant:blinky_plant", { }, on_timer = on_timer, on_rightclick = function(pos, node, clicker) - if minetest.is_protected(pos, clicker and clicker:get_player_name()) then + if minetest.is_protected(pos, clicker and clicker:get_player_name() or "") then return end diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua index 66665ad..d392633 100644 --- a/mesecons_delayer/init.lua +++ b/mesecons_delayer/init.lua @@ -93,7 +93,7 @@ local off_state = { wield_image = "mesecons_delayer_off_1.png", groups = off_groups, on_punch = function(pos, node, puncher) - if minetest.is_protected(pos, puncher and puncher:get_player_name()) then + if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then return end @@ -134,7 +134,7 @@ local on_state = { }, groups = {bendy = 2, snappy = 1, dig_immediate = 2, not_in_creative_inventory = 1}, on_punch = function(pos, node, puncher) - if minetest.is_protected(pos, puncher and puncher:get_player_name()) then + if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then return end diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index 577cee0..40e2577 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -4,7 +4,7 @@ minetest.register_node("mesecons_noteblock:noteblock", { is_ground_content = false, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, on_punch = function(pos, node, puncher) -- change sound when punched - if minetest.is_protected(pos, puncher and puncher:get_player_name()) then + if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then return end