Added new file to read

Init has been repurposed to store the detached inventory data. Data is
then replaced into the inventory on startup.
master
Austin Shenk 2013-01-19 12:09:37 -05:00
parent 1d9f7cc7a6
commit c09629daf9
1 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,17 @@
local file = io.open(minetest.get_worldpath().."/adventures_sources", "r")
local file = io.open(minetest.get_worldpath().."/adventures_init", "r")
if(file ~= nil) then
local i = 1
local inv = minetest.get_inventory({type="detached",name="initialstuff"})
for line in file:lines() do
if line ~= "initialized" and line ~= ",0" then
local values = line:split(",")
inv:set_stack("main", i, values[1].." "..values[2])
i = i+1
end
end
end
file = io.open(minetest.get_worldpath().."/adventures_sources", "r")
if(file ~= nil) then
for line in file:lines() do
if line ~= "initialized" and line ~= "" then