mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-09-27 23:10:35 +02:00
Use early return
This commit is contained in:
parent
f50d6d68f6
commit
4f4e6f5943
|
@ -394,8 +394,10 @@ 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 ~= nil 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
|
||||||
|
@ -403,7 +405,6 @@ if armor.config.punch_damage == true 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
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user