1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 14:16:06 +02:00

[spawn & sethome] Reduce calls to action_timers : use the wrapper

This commit is contained in:
LeMagnesium
2015-10-17 13:16:03 +02:00
parent 892910a2a4
commit 82fb540a59
2 changed files with 3 additions and 47 deletions

View File

@ -18,21 +18,6 @@ minetest.register_chatcommand("spawn", {
end
end
-- Checking timers
if not action_timers.api.get_timer("spawn_" .. name) then
action_timers.api.register_timer("spawn_" .. name, SPAWN_INTERVAL)
return go_to_spawn()
else
local res = action_timers.api.do_action("spawn_" .. name, go_to_spawn)
print(res)
if tonumber(res) then
minetest.chat_send_player(name, "Please retry later, you used spawn last time less than ".. SPAWN_INTERVAL .." seconds ago.")
minetest.chat_send_player(name, "Retry in: ".. math.floor(res) .." seconds.")
minetest.log("action","Player ".. name .." tried to respawn within forbidden interval.")
return false
else
return res
end
end
action_timers.wrapper(name, "spawn", "spawn_" .. name, SPAWN_INTERVAL, go_to_spawn, {})
end
})