diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 62ca087..e589867 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -395,12 +395,14 @@ if armor.config.punch_damage == true then minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities) local name = player:get_player_name() - local hit_ip = hitter:is_player() - if name and hit_ip and minetest.is_protected(player:get_pos(), "") then - return - elseif name then - armor:punch(player, hitter, time_from_last_punch, tool_capabilities) - last_punch_time[name] = minetest.get_gametime() + if hitter ~= nil then + local hit_ip = hitter:is_player() + if name and hit_ip and minetest.is_protected(player:get_pos(), "") then + return + elseif name then + armor:punch(player, hitter, time_from_last_punch, tool_capabilities) + last_punch_time[name] = minetest.get_gametime() + end end end) end