Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit 66c5582

Browse files
committed
[tsm_pyramids] Convert globalstep and clean variables for #179
1 parent 7bf6c9e commit 66c5582

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mods/tsm_pyramids/room.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pyramids.saved_chests = {}
2-
pyramids.timer = 0
32
pyramids.max_time = 30*60
43

4+
55
local room = {"a","a","a","a","a","a","a","a","a",
66
"a","c","a","c","a","c","a","c","a",
77
"a","s","a","s","a","s","a","s","a",
@@ -62,10 +62,7 @@ minetest.register_on_shutdown(function()
6262
savechests()
6363
end)
6464

65-
minetest.register_globalstep(function(dtime)
66-
pyramids.timer = pyramids.timer + dtime
67-
if pyramids.timer < pyramids.max_time then return end
68-
pyramids.timer = 0
65+
local function chests_reload()
6966
-- It might happen that chests are not loaded
7067
if pyramids.saved_chests then
7168
for _,k in ipairs(pyramids.saved_chests) do
@@ -75,7 +72,9 @@ minetest.register_globalstep(function(dtime)
7572
pyramids.saved_chests = loadchests() or {}
7673
end
7774
minetest.log("action","[tsm_pyramids] Chests reloaded")
78-
end)
75+
minetest.after(pyramids.max_time, chests_reload)
76+
end
77+
minetest.after(0, chests_reload)
7978

8079
local function replace(str,iy)
8180
local out = "default:"

0 commit comments

Comments
 (0)