use more precise timer for cooldown
This commit is contained in:
parent
5ff3d371c9
commit
ea0d0f4511
1
game.lua
1
game.lua
@ -6,7 +6,6 @@ local Object = dofile(modpath .. DIR_DELIM .. "classic.lua")
|
||||
local snowgame = {}
|
||||
|
||||
|
||||
|
||||
yl_snowball.GAME_TIMEOUT = 10 -- FIXME increase
|
||||
|
||||
local active_games = {}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user