1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

[tsm_pyramids] Convert globalstep and clean variables for #179

This commit is contained in:
LeMagnesium 2016-08-03 18:36:27 +02:00
parent 7bf6c9e16e
commit 66c55825e8
No known key found for this signature in database
GPG Key ID: A54DDB5272C51E8B

View File

@ -1,7 +1,7 @@
pyramids.saved_chests = {}
pyramids.timer = 0
pyramids.max_time = 30*60
local room = {"a","a","a","a","a","a","a","a","a",
"a","c","a","c","a","c","a","c","a",
"a","s","a","s","a","s","a","s","a",
@ -62,10 +62,7 @@ minetest.register_on_shutdown(function()
savechests()
end)
minetest.register_globalstep(function(dtime)
pyramids.timer = pyramids.timer + dtime
if pyramids.timer < pyramids.max_time then return end
pyramids.timer = 0
local function chests_reload()
-- It might happen that chests are not loaded
if pyramids.saved_chests then
for _,k in ipairs(pyramids.saved_chests) do
@ -75,7 +72,9 @@ minetest.register_globalstep(function(dtime)
pyramids.saved_chests = loadchests() or {}
end
minetest.log("action","[tsm_pyramids] Chests reloaded")
end)
minetest.after(pyramids.max_time, chests_reload)
end
minetest.after(0, chests_reload)
local function replace(str,iy)
local out = "default:"