Skip to content

Commit d86956c

Browse files
committed
Update PvP cooldown delay
1 parent a0cb201 commit d86956c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

interact.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ local S = areas.S
22

33
local enable_damage = minetest.settings:get_bool("enable_damage")
44

5+
local COOLDOWN = 1/5
6+
57
local old_is_protected = minetest.is_protected
68
function minetest.is_protected(pos, name)
79
if not areas:canInteract(pos, name) then
@@ -63,7 +65,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch)
6365
local player_name = hitter:get_player_name()
6466

6567
-- It is possible to use cheats
66-
if time_from_last_punch < 0.25 then
68+
if time_from_last_punch < COOLDOWN then
6769
minetest.chat_send_player(player_name, S("Wow, wow, take it easy!"))
6870
return true
6971
end
@@ -81,7 +83,7 @@ end)
8183
local old_calculate_knockback = minetest.calculate_knockback
8284
function minetest.calculate_knockback(player, hitter, time_from_last_punch, ...)
8385
if player:is_player() and hitter and hitter:is_player() and
84-
(time_from_last_punch < 0.25 or not can_pvp_at(player:get_pos()) or
86+
(time_from_last_punch < COOLDOWN or not can_pvp_at(player:get_pos()) or
8587
not can_pvp_at(hitter:get_pos())) then
8688
return 0
8789
end

0 commit comments

Comments
 (0)