mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-11 04:50:17 +01:00
[solarmana] Switch to minetest.after
This commit is contained in:
parent
f94ecd5fd8
commit
cc8c707571
|
@ -44,13 +44,10 @@ local mana_from_node = {
|
|||
local time_total_mana_reset = 10.0
|
||||
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,
|
||||
-- as all it does is change the regeneration to a fixed number
|
||||
time_next_regen_check = time_next_regen_check - dtime
|
||||
if time_next_regen_check < 0.0 then
|
||||
time_next_regen_check = time_total_regen_check
|
||||
minetest.after(time_next_regen_check, tick)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local pos = player:getpos()
|
||||
|
@ -111,7 +108,6 @@ minetest.register_globalstep(function(dtime)
|
|||
mana.setregen(name, regen_to)
|
||||
--print("Regen to "..regen_to.." : "..light_day.."/"..light_now.."/"..light_night)
|
||||
end
|
||||
end
|
||||
|
||||
--[[ Comment this in for testing if you have no mana sink
|
||||
|
||||
|
@ -123,5 +119,6 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
--]]
|
||||
end
|
||||
|
||||
end)
|
||||
tick()
|
||||
|
|
Loading…
Reference in New Issue
Block a user