Update init.lua

This commit is contained in:
Elkien3 2022-04-19 08:32:28 -05:00
parent 839fc74e79
commit 05ef5c3720

View File

@ -164,10 +164,10 @@ local waspunched = {}
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage) minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
local name = hitter:get_player_name() local name = hitter:get_player_name()
local plName = player:get_player_name() local plName = player:get_player_name()
if not name or not plName then return end if not name or not plName then return false end
if not minetest.check_player_privs(name, {pvp=true}) and not waspunched[name] then if not minetest.check_player_privs(name, {pvp=true}) and not waspunched[name] then
damage = damage/3 damage = damage/3
player:set_hp(player:get_hp()-damage, "punch") player:set_hp(math.floor(player:get_hp()-damage+.5), "punch")
return true return true
elseif not minetest.check_player_privs(plName, {pvp=true}) then elseif not minetest.check_player_privs(plName, {pvp=true}) then
waspunched[plName] = (waspunched[plName] or 0) + 1 waspunched[plName] = (waspunched[plName] or 0) + 1
@ -180,6 +180,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
end end
end) end)
end end
return false
end) end)
player_effects = {} player_effects = {}