diff --git a/crops.lua b/crops.lua index 07b9c34..889ee2c 100644 --- a/crops.lua +++ b/crops.lua @@ -49,6 +49,10 @@ Actual columns: value is used as roast time seed_grindable any value seed can be grinded, e.g. in a coffee grinder, needs "crop_grind.png" or value in grind + damage_per_second + any value damage a player get while in a node with this crop, e.g. thorns of raspberries + liquid_viscosity + any value resistance a player sees while walking through a field temperature_min/_max Range of temperature inside the crop can grow. humidity_min/_max Range of humidity elevation_min/_max Height range the crop can be found @@ -79,7 +83,7 @@ local crop_cols={ "infect_rate_base","infect_rate_monoculture","spread_rate","grow_time_mean","roast_time"}, groups_num={"to_culture","to_dig","has_harvest","on_soil","punchable","infectable", "seed_extractable","use_flail","use_trellis","snappy","infection_defence","seed_roastable", - "seed_grindable","for_flour","for_coffee"}} + "seed_grindable","for_flour","for_coffee","damage_per_second","liquid_viscosity"}} local crop_definition = farming.import_csv(farming.path.."/crops.txt",crop_cols) --print(dump(crop_definition)) diff --git a/crops.txt b/crops.txt index 6140c2b..1b4b04e 100644 --- a/crops.txt +++ b/crops.txt @@ -1,30 +1,30 @@ -name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,to_dig,has_harvest,on_soil,punchable,infectable,infection_defence,seed_extractable,no_seed,use_flail,use_trellis,for_coffee,seed_roastable,seed_grindable,for_flour,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,grow_time_mean,straw,culture_rate,seed_drop,grind,roast -default,1,,10,8,2,1,,,,,,,,,,,,,,,,3,15,80,10,80,0,200,11,14,1E-05,0.001,0.001,12,,,,, -barley,1,,10,7,2,,,,1,1,,1,,,,1,,1,3,,1,3,25,,30,,,,,,,,,,farming:straw,,,farming:flour, -beetroot,1,,10,5,2,2,,1,,1,,,,,,,,,,,,3,35,,30,,,,9,,,,,,,,,, -blackberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,,90,20,,,,9,,,,,,,,,, -blueberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,45,90,40,90,,,9,,,,,,,,,, -carrot,1,,10,8,2,2,,1,,1,,,,,,,,,2,,,3,45,,30,90,,,8,,,,,,,,,,farming:carrot_baked -chili,1,,20,8,2,1,,,,,1,,,,,,,,,,,3,45,90,,,,1000,,,,,,,,,,, -coffee,1,,20,5,2,1,,,,,1,,,,,,,1,4,,,3,50,120,50,150,,1000,12,,,,,,,,,, -corn,1,,10,8,2,2,,,,1,,1,,,,,,,4,1,,3,35,90,30,,,,,,,,,,,,,,farming:corn_cob -cotton,1,,10,8,2,,,,1,1,,1,,,,1,,,,,,3,45,90,20,,,,12,,,,,,,,,, -culturewheat,1,,100,4,3,,1,,1,1,,1,,,,1,,1,3,,1,3,25,,40,,,,10,,,,,100,farming:straw,,,farming:flour, -flax,,,10,7,2,,,,1,1,,1,,,,1,,,,,,3,25,,30,,,,,,,,,,farming:flaw,,,, -garlic,,,10,5,2,1,,1,,1,,,,,,,,,3,,,3,,,,,,,,,,,,,,,,, -grapes,1,,10,8,3,2,1,,,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,farming:seed_wildgrapes,, -hemp,1,,10,8,2,,,,1,,,,,,,1,,,,,,3,,120,,,,,6,,,,1E-05,9,farming:hemp_fibre,,,, -hop,1,,10,7,3,1,1,,,1,1,1,,,,,1,,4,,,3,,,,,,,,,,,,,,,farming:seed_wildhop,, -mustard,1,,10,5,2,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,, -potato,1,,10,4,2,2,,,,1,,1,,,,,,,4,1,,3,,,,,,,,,,,,,,,,,farming:potato_baked -raspberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,,,,,,,9,,,,,,,,,, -rhubarb,1,,10,3,2,2,,1,,1,,,,,,,,,,,,3,,,,,,,9,,,,,,,,,, -spelt,1,,10,7,2,,,,1,1,,1,,,,1,,,3,,1,3,,,,,,,,,,,,,farming:straw,,,farming:flour, -strawberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,,,,,,,9,,,,,,,,,, -tea,,,20,5,2,1,,,,,1,,,1,,,,,4,,,3,30,70,30,70,,,,,,,,,,,,, -tobaco,1,,10,8,2,,,,1,1,1,,2,,,,,,4,,,3,,,,,,,,,,,,,,,,, -tomato,,,10,8,2,1,,,1,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,,, -nettle,1,,10,5,2,1,,,1,,,,1,,,1,,,2,,,3,5,150,,100,,2000,6,,,,,8,farming:nettle_fibre,,,, -wheat,1,farming:culturewheat,10,8,2,,,,1,1,,1,,,,1,,1,3,,1,3,,,,,,,,,,,,,farming:straw,10,,farming:flour, -wildhop,1,hop,10,6,2,,,,,,,,,,1,,,,4,,,3,,,,,,,,,,,,,,5,,, -wildgrapes,1,,10,4,2,1,,,,,,,,,1,,,,,,,3,,,,,,,,,,,,,,5,,, +name,enabled,next_plant,rarety,steps,harvest_max,eat_hp,to_culture,to_dig,has_harvest,on_soil,punchable,infectable,infection_defence,seed_extractable,no_seed,use_flail,use_trellis,for_coffee,seed_roastable,seed_grindable,for_flour,snappy,damage_per_second,liquid_viscosity,temperature_min,temperature_max,humidity_min,humidity_max,elevation_min,elevation_max,light_min,light_max,infect_rate_base,infect_rate_monoculture,spread_rate,grow_time_mean,straw,culture_rate,seed_drop,grind,roast +default,1,,10,8,2,1,,,,,,,,,,,,,,,,3,,,15,80,10,80,0,200,11,14,1E-05,0.001,0.001,12,,,,, +barley,1,,10,7,2,,,,1,1,,1,,,,1,,1,3,,1,3,,2,25,,30,,,,,,,,,,farming:straw,,,farming:flour, +beetroot,1,,10,5,2,2,,1,,1,,,,,,,,,,,,3,,,35,,30,,,,9,,,,,,,,,, +blackberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,1,5,,90,20,,,,9,,,,,,,,,, +blueberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,,,45,90,40,90,,,9,,,,,,,,,, +carrot,1,,10,8,2,2,,1,,1,,,,,,,,,2,,,3,,,45,,30,90,,,8,,,,,,,,,,farming:carrot_baked +chili,1,,20,8,2,1,,,,,1,,,,,,,,,,,3,,,45,90,,,,1000,,,,,,,,,,, +coffee,1,,20,5,2,1,,,,,1,,,,,,,1,4,,,3,,,50,120,50,150,,1000,12,,,,,,,,,, +corn,1,,10,8,2,2,,,,1,,1,,,,,,,4,1,,3,,2,35,90,30,,,,,,,,,,,,,,farming:corn_cob +cotton,1,,10,8,2,,,,1,1,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,,,,,,, +culturewheat,1,,100,4,3,,1,,1,1,,1,,,,1,,1,3,,1,3,,2,25,,40,,,,10,,,,,100,farming:straw,,,farming:flour, +flax,,,10,7,2,,,,1,1,,1,,,,1,,,,,,3,,,25,,30,,,,,,,,,,farming:flaw,,,, +garlic,,,10,5,2,1,,1,,1,,,,,,,,,3,,,3,,,,,,,,,,,,,,,,,,, +grapes,1,,10,8,3,2,1,,,1,1,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,farming:seed_wildgrapes,, +hemp,1,,10,8,2,,,,1,,,,,,,1,,,,,,3,,2,,120,,,,,6,,,,1E-05,9,farming:hemp_fibre,,,, +hop,1,,10,7,3,1,1,,,1,1,1,,,,,1,,4,,,3,,,,,,,,,,,,,,,,,farming:seed_wildhop,, +mustard,1,,10,5,2,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,,,, +potato,1,,10,4,2,2,,,,1,,1,,,,,,,4,1,,3,,,,,,,,,,,,,,,,,,,farming:potato_baked +raspberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,1,5,,,,,,,9,,,,,,,,,, +rhubarb,1,,10,3,2,2,,1,,1,,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,, +spelt,1,,10,7,2,,,,1,1,,1,,,,1,,,3,,1,3,,2,,,,,,,,,,,,,farming:straw,,,farming:flour, +strawberry,1,,10,4,2,1,,,,,1,,,,,,,,,,,3,,,,,,,,,9,,,,,,,,,, +tea,,,20,5,2,1,,,,,1,,,1,,,,,4,,,3,,,30,70,30,70,,,,,,,,,,,,, +tobaco,1,,10,8,2,,,,1,1,1,,2,,,,,,4,,,3,,,,,,,,,,,,,,,,,,, +tomato,,,10,8,2,1,,,1,1,1,1,,,,,1,,,,,3,,,,,,,,,,,,,,,,,,, +nettle,1,,10,5,2,1,,,1,,,,1,,,1,,,2,,,3,1,3,5,150,,100,,2000,6,,,,,8,farming:nettle_fibre,,,, +wheat,1,farming:culturewheat,10,8,2,,,,1,1,,1,,,,1,,1,3,,1,3,,2,,,,,,,,,,,,,farming:straw,10,,farming:flour, +wildhop,1,hop,10,6,2,,,,,,,,,,1,,,,4,,,3,,,,,,,,,,,,,,,,5,,, +wildgrapes,1,,10,4,2,1,,,,,,,,,1,,,,,,,3,,,,,,,,,,,,,,,,5,,, diff --git a/register.lua b/register.lua index e0c0b8f..a7f0936 100644 --- a/register.lua +++ b/register.lua @@ -308,7 +308,7 @@ farming.register_steps = function(sdef) ndef[colu]=node_def[colu] end ndef.groups = {snappy = 3, flammable = 2,flora=1, plant = 1, not_in_creative_inventory = 1, attached_node = 1} - for _,colu in ipairs({"infectable","snappy","seed_extractable","punchable"}) do + for _,colu in ipairs({"infectable","snappy","seed_extractable","punchable","damage_per_second","liquid_viscosity"}) do if sdef.groups[colu] then ndef.groups[colu] = sdef.groups[colu] end @@ -317,6 +317,7 @@ farming.register_steps = function(sdef) ndef.groups[sdef.mod_name]=1 ndef.tiles={sdef.mod_name.."_"..sdef.plant_name.."_"..i..".png"} if i < sdef.steps then + ndef.groups["farming_grows"]=1 -- plant is growing ndef.next_step=sdef.step_name .. "_" .. (i + 1) ndef.on_timer = farming.step_on_timer ndef.grow_time_min=sdef.grow_time_min or 120 @@ -333,6 +334,24 @@ farming.register_steps = function(sdef) if sdef.groups["use_trellis"] then table.insert(ndef.drop.items,1,{items={"farming:trellis"}}) end + -- check if plant hurts while going through + if ndef.groups["damage_per_second"] then + -- calculate damage as part of growing: Full damage only for full grown plant + local step_damage=math.ceil(ndef.groups["damage_per_second"]*i/sdef.steps) + if step_damage > 0 then + ndef.damage_per_second = step_damage + end + end + -- for some crops you should walk slowly through like a wheat field + if ndef.groups["liquid_viscosity"] then + local step_viscosity=math.ceil(ndef.groups["liquid_viscosity"]*i/sdef.steps) + if step_viscosity > 0 then + ndef.liquid_viscosity= step_viscosity + ndef.liquidtype="source" + ndef.liquid_renewable=false + ndef.liquid_range=0 + end + end local base_rarity = 1 if sdef.steps ~= 1 then base_rarity = sdef.steps - i + 1 @@ -346,7 +365,8 @@ farming.register_steps = function(sdef) end end if i == sdef.steps then - ndef.on_dig = farming.harvest_on_dig + ndef.groups["farming_fullgrown"]=1 + ndef.on_dig = farming.harvest_on_dig end -- at the end stage you can harvest by change a cultured seed (if defined) if (i == sdef.steps and sdef.next_plant ~= nil) then