mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 10:10:39 +01:00
[tsm_pyramids] Convert globalstep and clean variables for #179
This commit is contained in:
parent
7bf6c9e16e
commit
66c55825e8
@ -1,7 +1,7 @@
|
|||||||
pyramids.saved_chests = {}
|
pyramids.saved_chests = {}
|
||||||
pyramids.timer = 0
|
|
||||||
pyramids.max_time = 30*60
|
pyramids.max_time = 30*60
|
||||||
|
|
||||||
|
|
||||||
local room = {"a","a","a","a","a","a","a","a","a",
|
local room = {"a","a","a","a","a","a","a","a","a",
|
||||||
"a","c","a","c","a","c","a","c","a",
|
"a","c","a","c","a","c","a","c","a",
|
||||||
"a","s","a","s","a","s","a","s","a",
|
"a","s","a","s","a","s","a","s","a",
|
||||||
@ -62,10 +62,7 @@ minetest.register_on_shutdown(function()
|
|||||||
savechests()
|
savechests()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
local function chests_reload()
|
||||||
pyramids.timer = pyramids.timer + dtime
|
|
||||||
if pyramids.timer < pyramids.max_time then return end
|
|
||||||
pyramids.timer = 0
|
|
||||||
-- It might happen that chests are not loaded
|
-- It might happen that chests are not loaded
|
||||||
if pyramids.saved_chests then
|
if pyramids.saved_chests then
|
||||||
for _,k in ipairs(pyramids.saved_chests) do
|
for _,k in ipairs(pyramids.saved_chests) do
|
||||||
@ -75,7 +72,9 @@ minetest.register_globalstep(function(dtime)
|
|||||||
pyramids.saved_chests = loadchests() or {}
|
pyramids.saved_chests = loadchests() or {}
|
||||||
end
|
end
|
||||||
minetest.log("action","[tsm_pyramids] Chests reloaded")
|
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 function replace(str,iy)
|
||||||
local out = "default:"
|
local out = "default:"
|
||||||
|
Loading…
Reference in New Issue
Block a user