Don't assume `hitter ~= nil` in on_punchplayer callback
This commit is contained in:
parent
7fc313f911
commit
f50d6d68f6
|
@ -395,12 +395,14 @@ if armor.config.punch_damage == true then
|
||||||
minetest.register_on_punchplayer(function(player, hitter,
|
minetest.register_on_punchplayer(function(player, hitter,
|
||||||
time_from_last_punch, tool_capabilities)
|
time_from_last_punch, tool_capabilities)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local hit_ip = hitter:is_player()
|
if hitter ~= nil then
|
||||||
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
|
local hit_ip = hitter:is_player()
|
||||||
return
|
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
|
||||||
elseif name then
|
return
|
||||||
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
|
elseif name then
|
||||||
last_punch_time[name] = minetest.get_gametime()
|
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
|
last_punch_time[name] = minetest.get_gametime()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue