1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-11 12:50:41 +01:00

[solarmana] Switch to minetest.after

This commit is contained in:
Wouters Dorian 2015-07-31 15:02:21 +02:00
parent f94ecd5fd8
commit cc8c707571

View File

@ -44,13 +44,10 @@ local mana_from_node = {
local time_total_mana_reset = 10.0 local time_total_mana_reset = 10.0
local time_next_mana_reset = time_total_mana_reset local time_next_mana_reset = time_total_mana_reset
minetest.register_globalstep(function(dtime) local function tick()
-- We do not care if this does not run as often as possible, -- We do not care if this does not run as often as possible,
-- as all it does is change the regeneration to a fixed number -- as all it does is change the regeneration to a fixed number
time_next_regen_check = time_next_regen_check - dtime minetest.after(time_next_regen_check, tick)
if time_next_regen_check < 0.0 then
time_next_regen_check = time_total_regen_check
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local pos = player:getpos() local pos = player:getpos()
@ -111,7 +108,6 @@ minetest.register_globalstep(function(dtime)
mana.setregen(name, regen_to) mana.setregen(name, regen_to)
--print("Regen to "..regen_to.." : "..light_day.."/"..light_now.."/"..light_night) --print("Regen to "..regen_to.." : "..light_day.."/"..light_now.."/"..light_night)
end end
end
--[[ Comment this in for testing if you have no mana sink --[[ Comment this in for testing if you have no mana sink
@ -123,5 +119,6 @@ minetest.register_globalstep(function(dtime)
end end
--]] --]]
end
end) tick()