Did some bugfixing in harvest.lua

This commit is contained in:
Andrew Lalis 2018-09-27 08:37:40 +02:00
parent 4f1db31164
commit 80be066744
1 changed files with 6 additions and 1 deletions

View File

@ -213,13 +213,14 @@ local function loadConfig(filename)
file:close() file:close()
return t return t
else else
print("No config file " .. filename .. "exists. Please create it before continuing.") print("No config file " .. filename .. " exists. Please create it before continuing.")
return nil return nil
end end
end end
--[[ --[[
Guides the user in creating a new config. Guides the user in creating a new config.
return - table: The config created.
--]] --]]
local function createConfig(filename) local function createConfig(filename)
local config = {} local config = {}
@ -239,6 +240,7 @@ local function createConfig(filename)
config.COLS = tonumber(io.read()) config.COLS = tonumber(io.read())
print("How many crops are being harvested?") print("How many crops are being harvested?")
config.crop_definitions = {}
for i=1,tonumber(io.read()) do for i=1,tonumber(io.read()) do
print("Crop "..i..": What is the block name? (Use geolyzer to analyze it)") print("Crop "..i..": What is the block name? (Use geolyzer to analyze it)")
local name = io.read() local name = io.read()
@ -251,6 +253,7 @@ local function createConfig(filename)
file = io.open(filename, "w") file = io.open(filename, "w")
file:write(serial.serialize(config)) file:write(serial.serialize(config))
file:close() file:close()
return config
end end
local function main() local function main()
@ -263,3 +266,5 @@ local function main()
local drop_count = dropItems() local drop_count = dropItems()
print(harvest_count..", "..drop_count) print(harvest_count..", "..drop_count)
end end
main()