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

Commit

Permalink
[tsm_pyramids] Convert globalstep and clean variables for #179
Browse files Browse the repository at this point in the history
  • Loading branch information
Lymkwi committed Aug 3, 2016
1 parent 7bf6c9e commit 66c5582
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mods/tsm_pyramids/room.lua
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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:"
Expand Down

0 comments on commit 66c5582

Please sign in to comment.