2013-02-05 09:04:55 -08:00
|
|
|
local file = io.open(minetest.get_worldpath().."/adventures_init", "w")
|
2013-01-05 21:10:57 -08:00
|
|
|
local str = ""
|
2013-02-05 09:04:55 -08:00
|
|
|
local main = minetest.get_inventory({type="detached",name="initialstuff"}):get_list("main")
|
|
|
|
for _,stack in pairs(main) do
|
|
|
|
str = str..stack:get_name().."`"..stack:get_count().."\n"
|
|
|
|
end
|
|
|
|
file:write(str)
|
|
|
|
file:close()
|
|
|
|
|
|
|
|
file = io.open(minetest.get_worldpath().."/adventures_sources", "w")
|
|
|
|
local saved = false
|
|
|
|
str = ""
|
2013-01-10 18:44:51 -08:00
|
|
|
for s,data in pairs(adventures.sources) do
|
|
|
|
if data ~= nil then
|
2013-01-09 19:34:10 -08:00
|
|
|
local meta = minetest.env:get_meta(data.pos)
|
2013-01-17 17:24:06 -08:00
|
|
|
if(data.name == "adventures:unbreakable_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")
|
2013-01-09 19:34:10 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
2013-01-17 17:24:06 -08:00
|
|
|
if(data.name == "adventures:unbuildable_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")
|
2013-01-17 17:24:06 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
|
|
|
if(data.name == "adventures:fullprotect_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")
|
2013-01-17 17:24:06 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
|
|
|
if(data.name == "adventures:spawn_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")
|
2013-01-17 17:24:06 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
|
|
|
if(data.name == "adventures:respawn_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")..
|
|
|
|
"`"..meta:get_int("id")
|
2013-01-17 17:24:06 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
|
|
|
if(data.name == "adventures:checkpoint_source") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."`"..
|
|
|
|
meta:get_int("x").."`"..meta:get_int("y").."`"..meta:get_int("z").."`"..
|
|
|
|
meta:get_int("width").."`"..meta:get_int("length").."`"..meta:get_int("height")..
|
|
|
|
"`"..meta:get_int("id")
|
2013-01-17 17:24:06 -08:00
|
|
|
.."\n"
|
|
|
|
end
|
2013-01-18 14:51:39 -08:00
|
|
|
if(data.name == "adventures:initial_stuff") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."\n"
|
2013-01-20 12:57:16 -08:00
|
|
|
end
|
|
|
|
if(data.name == "adventures:quest") then
|
2013-01-21 16:52:17 -08:00
|
|
|
str = str..data.name.."`"..data.pos.x.."`"..data.pos.y.."`"..data.pos.z.."\n"
|
2013-01-18 14:51:39 -08:00
|
|
|
end
|
2013-01-09 19:34:10 -08:00
|
|
|
saved = true
|
2013-01-03 19:31:49 -08:00
|
|
|
end
|
|
|
|
end
|
2013-01-05 21:10:57 -08:00
|
|
|
file:write(str)
|
|
|
|
file:close()
|
2013-01-24 20:25:48 -08:00
|
|
|
|
|
|
|
file = io.open(minetest.get_worldpath().."/adventures_books", "w")
|
|
|
|
str = ""
|
|
|
|
for name,story in pairs(adventures.registered_books) do
|
2013-01-25 20:58:24 -08:00
|
|
|
str = str..name.."`\n"
|
|
|
|
for _,line in pairs(story) do
|
|
|
|
str = str..line.."\n"
|
|
|
|
end
|
|
|
|
str = str.."`\n"
|
2013-01-24 20:25:48 -08:00
|
|
|
end
|
|
|
|
file:write(str)
|
|
|
|
file:close()
|
2013-01-05 21:10:57 -08:00
|
|
|
return saved
|