diff --git a/mods/tsm_pyramids/room.lua b/mods/tsm_pyramids/room.lua index 76d7f209..ec2a76e3 100755 --- a/mods/tsm_pyramids/room.lua +++ b/mods/tsm_pyramids/room.lua @@ -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:"