use more precise timer for cooldown

This commit is contained in:
whosit 2024-11-23 21:34:21 +03:00
parent 5ff3d371c9
commit ea0d0f4511
2 changed files with 1 additions and 2 deletions

View File

@ -6,7 +6,6 @@ local Object = dofile(modpath .. DIR_DELIM .. "classic.lua")
local snowgame = {}
yl_snowball.GAME_TIMEOUT = 10 -- FIXME increase
local active_games = {}

View File

@ -85,7 +85,7 @@ yl_snowball.on_use = function(itemstack, user, pointed_thing)
local player = user
local player_name = player:get_player_name()
local current_time = os.clock() --core.get_gametime() -- gametime seems to "lag"?
local current_time = core.get_us_time() --core.get_gametime() -- gametime seems to "lag"?
if current_time - (player_last_throw_time[player_name] or 0) < yl_snowball.COOLDOWN then
-- too soon, don't shot, don't take items
return nil