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
parent
1d9f7cc7a6
commit
c09629daf9
15
decode.lua
15
decode.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue