1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2025-07-06 18:20:33 +02:00

Don't assume hitter ~= nil in on_punchplayer callback

This commit is contained in:
Niklp
2024-03-15 22:56:45 +01:00
parent 7fc313f911
commit f50d6d68f6

View File

@ -395,6 +395,7 @@ 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()
if hitter ~= nil then
local hit_ip = hitter:is_player()
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
return
@ -402,6 +403,7 @@ if armor.config.punch_damage == true then
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
last_punch_time[name] = minetest.get_gametime()
end
end
end)
end