2020-10-16 14:51:07 -07:00
|
|
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
|
|
|
if tool_capabilities.damage_groups.nopunch then return end
|
2020-11-08 09:08:14 -08:00
|
|
|
if ctf_respawn_immunity.is_immune(player) then return true end
|
|
|
|
|
2020-10-16 14:51:07 -07:00
|
|
|
local class = ctf_classes.get(hitter)
|
2020-10-13 20:00:21 -07:00
|
|
|
|
2020-10-16 14:51:07 -07:00
|
|
|
if class.properties.melee_bonus and hitter:get_wielded_item():get_name():find("sword") then
|
2020-11-08 10:09:15 -08:00
|
|
|
local php = player:get_hp()
|
|
|
|
|
2020-10-31 09:44:50 -07:00
|
|
|
if time_from_last_punch > 1 then
|
|
|
|
time_from_last_punch = 1
|
|
|
|
elseif time_from_last_punch < 0.5 then
|
|
|
|
time_from_last_punch = 0.5
|
2020-10-13 20:00:21 -07:00
|
|
|
end
|
|
|
|
|
2020-11-08 10:09:15 -08:00
|
|
|
if php - damage > 0 then
|
2020-11-08 11:27:27 -08:00
|
|
|
minetest.after(0, function()
|
|
|
|
player:punch(hitter, 1, {damage_groups = {fleshy = time_from_last_punch*2, nopunch = 1}}, dir)
|
|
|
|
end)
|
2020-11-07 17:17:21 -08:00
|
|
|
end
|
2020-10-13 08:42:41 -07:00
|
|
|
end
|
2020-10-16 14:51:07 -07:00
|
|
|
end)
|