forked from mtcontrib/3d_armor
Call custom on_punched
functions w/ hitter = nil
too (#141)
This commit is contained in:
parent
25369e5165
commit
7bd77a7b80
|
@ -394,14 +394,15 @@ end
|
||||||
if armor.config.punch_damage == true then
|
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)
|
||||||
if hitter == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
if hitter then
|
||||||
local hit_ip = hitter:is_player()
|
local hit_ip = hitter:is_player()
|
||||||
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
|
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
|
||||||
return
|
return
|
||||||
elseif name then
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if name then
|
||||||
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
|
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
last_punch_time[name] = minetest.get_gametime()
|
last_punch_time[name] = minetest.get_gametime()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user