update_mod_storage changed to once per hour

master
Joachim Stolberg 2017-09-12 21:47:50 +02:00
parent 5cb9148eaa
commit f051bf82ef
1 changed files with 6 additions and 4 deletions

View File

@ -23,16 +23,20 @@ local Key2Number = minetest.deserialize(storage:get_string("Key2Number")) or {}
local NextNumber = minetest.deserialize(storage:get_string("NextNumber")) or 1 local NextNumber = minetest.deserialize(storage:get_string("NextNumber")) or 1
local Number2Pos = minetest.deserialize(storage:get_string("Number2Pos")) or {} local Number2Pos = minetest.deserialize(storage:get_string("Number2Pos")) or {}
function tubelib.update_mod_storage() local function update_mod_storage()
storage:set_string("Key2Number", minetest.serialize(Key2Number)) storage:set_string("Key2Number", minetest.serialize(Key2Number))
storage:set_string("NextNumber", minetest.serialize(NextNumber)) storage:set_string("NextNumber", minetest.serialize(NextNumber))
storage:set_string("Number2Pos", minetest.serialize(Number2Pos)) storage:set_string("Number2Pos", minetest.serialize(Number2Pos))
end end
minetest.register_on_shutdown(function() minetest.register_on_shutdown(function()
tubelib.update_mod_storage() update_mod_storage()
end) end)
-- store data each hour
minetest.after(60*60, update_mod_storage)
local Name2Name = {} -- translation table local Name2Name = {} -- translation table
------------------------------------------------------------------- -------------------------------------------------------------------
@ -165,7 +169,6 @@ function tubelib.get_node_number(pos, name)
pos = pos, pos = pos,
name = name, name = name,
} }
tubelib.update_mod_storage()
return number return number
end end
@ -177,7 +180,6 @@ function tubelib.remove_node(pos)
pos = pos, pos = pos,
name = nil, name = nil,
} }
tubelib.update_mod_storage()
end end
end end