reading new csv config

master
ademant 2018-10-09 14:47:37 +02:00
parent c7c1aae3a0
commit e6cb9548b9
3 changed files with 82 additions and 28 deletions

View File

@ -1,11 +1,27 @@
#name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,has_harvest,on_soil,punchable,infectable,snappy,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,light_min,light_max,infect_rate_base,infect_rate_monoculture,spread_rate
default,1,,10,8,2,1,,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
barley,1,,10,7,2,1,,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
coffee,1,,20,5,2,1,,,,1,,3,25,50,10,50,50,1000,11,14,1e-5,1e-3,1e-3
cocoa,1,,20,5,2,1,,,,1,,3,25,50,10,50,50,1000,11,14,1e-5,1e-3,1e-3
corn,1,,10,8,2,1,,,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
culturewheat,1,,100,4,2,,11,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
mustard,1,,10,5,2,1,,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
potato,1,,10,4,2,1,,,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
spelt,1,,10,7,2,1,,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
wheat,1,culturewheat,10,8,2,1,,1,1,,1,3,15,50,10,50,0,100,11,14,1e-5,1e-3,1e-3
#name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,to_dig,has_harvest,on_soil,punchable,infectable,seed_extractable,snappy,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,light_min,light_max,infect_rate_base,infect_rate_monoculture,spread_rate
default,1,,10,8,2,1,,,,,,,,3,15,50,10,50,0,31000,11,14,1E-05,0.001,0.001
barley,1,,10,7,2,1,,,1,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
beetroot,1,,10,5,2,2,,1,,1,,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
blackberry,1,,10,4,2,1,,,,,1,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
blueberry,1,,10,4,2,1,,,,,1,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
carrot,1,,10,8,2,2,,1,,1,,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
chili,1,,20,8,2,1,,,,,1,,,3,25,50,10,50,50,1000,11,14,1E-05,0.001,0.001
coffee,1,,20,5,2,1,,,,,1,,,3,25,50,10,50,50,1000,11,14,1E-05,0.001,0.001
cocoa,1,,20,5,2,1,,,,,1,,,3,25,50,10,50,50,1000,11,14,1E-05,0.001,0.001
corn,1,,10,8,2,2,,,,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
cotton,1,,10,8,2,2,,,1,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
culturewheat,1,,100,4,2,1,1,,1,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
garlic,1,,10,5,2,2,,1,,1,,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
hemp,,,10,8,2,2,,,1,1,,1,,3,,50,10,50,0,100,11,14,1E-05,0.001,0.001
hop,1,,10,7,2,1,,,1,1,1,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
mustard,1,,10,5,2,1,,,1,,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
potato,1,,10,4,2,2,,,,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
raspberry,1,,10,4,2,1,,,,,1,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
rhubarb,1,,10,3,2,2,,1,,1,,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
spelt,1,,10,7,2,1,,,1,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
strawberry,1,,10,4,2,1,,,,,1,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
tea,1,,20,5,2,1,,,,,1,,1,3,25,50,10,50,50,,11,14,1E-05,0.001,0.001
tobaco,,,10,8,2,2,,,,1,,1,1,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
tomato,1,,10,8,2,1,,,1,1,1,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001
urtica,,,10,8,2,1,,,1,,,,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.01
wheat,1,culturewheat,10,8,2,1,,,1,1,,1,,3,15,50,10,50,0,100,11,14,1E-05,0.001,0.001

1 #name enabled next_plant rarety steps harvest_max eat_hp to_culture to_dig has_harvest on_soil punchable infectable seed_extractable snappy temperature_min temperature_max humidity_min humidity_max elevation_min elevation_max light_min light_max infect_rate_base infect_rate_monoculture spread_rate
2 default 1 10 8 2 1 1 1 1 3 15 50 10 50 0 100 31000 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
3 barley 1 10 7 2 1 1 1 1 3 15 50 10 50 0 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
4 coffee beetroot 1 20 10 5 2 1 2 1 1 1 3 25 15 50 10 50 50 0 1000 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
5 cocoa blackberry 1 20 10 5 4 2 1 1 3 25 15 50 10 50 50 0 1000 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
6 corn blueberry 1 10 8 4 2 1 1 1 1 3 15 50 10 50 0 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
7 culturewheat carrot 1 100 10 4 8 2 2 11 1 1 1 1 3 15 50 10 50 0 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
8 mustard chili 1 10 20 5 8 2 1 1 1 1 1 3 15 25 50 10 50 0 50 100 1000 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
9 potato coffee 1 10 20 4 5 2 1 1 1 1 3 15 25 50 10 50 0 50 100 1000 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
10 spelt cocoa 1 10 20 7 5 2 1 1 1 1 1 3 15 25 50 10 50 0 50 100 1000 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
11 wheat corn 1 culturewheat 10 8 2 1 2 1 1 1 3 15 50 10 50 0 100 11 14 1e-5 1E-05 1e-3 0.001 1e-3 0.001
12 cotton 1 10 8 2 2 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
13 culturewheat 1 100 4 2 1 1 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
14 garlic 1 10 5 2 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
15 hemp 10 8 2 2 1 1 1 3 50 10 50 0 100 11 14 1E-05 0.001 0.001
16 hop 1 10 7 2 1 1 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
17 mustard 1 10 5 2 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
18 potato 1 10 4 2 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
19 raspberry 1 10 4 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
20 rhubarb 1 10 3 2 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
21 spelt 1 10 7 2 1 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
22 strawberry 1 10 4 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
23 tea 1 20 5 2 1 1 1 3 25 50 10 50 50 11 14 1E-05 0.001 0.001
24 tobaco 10 8 2 2 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
25 tomato 1 10 8 2 1 1 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001
26 urtica 10 8 2 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.01
27 wheat 1 culturewheat 10 8 2 1 1 1 1 3 15 50 10 50 0 100 11 14 1E-05 0.001 0.001

View File

@ -7,11 +7,10 @@ local crop_definition = {}
local file = io.open(farming.path .. "/crops.csv", "r")
for line in file:lines() do
local attribs = line:split(",", true)
local name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,has_harvest,on_soil,punchable,infectable,snappy,
temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,infect_rate_base,
infect_rate_monoculture,spread_rate = unpack(attribs)
local name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,has_harvest,on_soil,punchable,infectable,
seed_extractable,snappy,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,
infect_rate_base,infect_rate_monoculture,spread_rate = unpack(attribs)
if #name > 0 and name:sub(1,1) ~= "#" and #enabled > 0 and #steps > 0 then
print(dump(attribs))
biom_def={min_temp=tonumber(temperature_min) or 0,
max_temp=tonumber(temperature_max) or 100,
min_humidity=tonumber(humidity_min) or 0,
@ -19,25 +18,22 @@ for line in file:lines() do
spawnon={spawn_min=tonumber(elevation_min) or 0,
spawn_max=tonumber(elevation_max)} or 31000,
}
print(dump(biom_def))
local crop_biom=farming.get_biomes(biom_def)
print(dump(crop_biom))
crop_definition[name]={
paramtype2 = "meshoptions",
fertility = {"grassland"},
place_param2 = 3,
groups = {farming=1},
steps = tonumber(steps),
grow_time_mean=tonumber(grow_time_mean) or 100,
harvest_max=tonumber(harvest_max) or 2,
light_min=tonumber(light_min) or 13,
grow_time_mean=tonumber(grow_time_mean),
harvest_max=tonumber(harvest_max),
light_min=tonumber(light_min),
light_max=tonumber(light_max) or default.LIGHT_MAX,
temperature_min=tonumber(temperature_min) or 0,
temperature_max=tonumber(temperature_max) or 100,
humidity_min=tonumber(humidity_min) or 0,
humidity_max=tonumber(humidity_max) or 100,
elevation_min=tonumber(elevation_min) or 0,
elevation_max=tonumber(elevation_max) or 31000,
temperature_min=tonumber(temperature_min),
temperature_max=tonumber(temperature_max),
humidity_min=tonumber(humidity_min),
humidity_max=tonumber(humidity_max),
elevation_min=tonumber(elevation_min),
elevation_max=tonumber(elevation_max),
description=S(name),
eat_hp=tonumber(eat_hp),
next_plant=next_plant,
@ -68,6 +64,36 @@ for line in file:lines() do
if #infectable > 0 then
crop_definition[name].groups["infectable"]=tonumber(infectable)
end
if #seed_extractable > 0 then
crop_definition[name].groups["seed_extractable"]=tonumber(seed_extractable)
end
if #snappy > 0 then
crop_definition[name].groups["snappy"]=tonumber(snappy)
else
crop_definition[name].groups["snappy"]=3
end
end
print(dump(crop_definition))
end
if crop_definition["default"]~=nil then
local default_def = crop_definition["default"]
print(#crop_definition)
print(dump(default_def))
for i,tdef in ipairs(crop_definition) do
print(dump(tdef))
if tdef.name ~= "default" then
local tdef_name = tdef.name
for _,colu in ipairs({"rarety","harvest_max","temperature_min","temperature_max",
"humidity_min","humidity_max","elevation_min","elevation_max",
"infect_rate_base","infect_rate_monoculture","spread_rate"}) do
print(colu)
if crop_definition[tdef_name][colu] == nil then
print(colu)
print(default_def[colu])
crop_definition[tdef_name][colu] = default_def[colu]
end
end
end
end
end
-- print(dump(crop_definition))

View File

@ -86,3 +86,15 @@ msgstr "Tomate"
msgid "Hops"
msgstr "Hopfen"
msgid "Urtica"
msgstr "Brennnessel"
msgid "Hemp"
msgstr "Hanf"
msgid "Tobaco"
msgstr "Tabak"
msgid "Tea"
msgstr "Tee"