diff --git a/actions_register.lua b/actions_register.lua index 3c64df2..83d1644 100644 --- a/actions_register.lua +++ b/actions_register.lua @@ -536,22 +536,6 @@ farming.dig_by_tool = function(itemstack, user, pointed_thing, uses) end -- generate "seed" out of harvest and trellis -farming.trellis_seed = function(gdef) - if gdef.seed_name == nil then - return - end - if gdef.harvest_name == nil then - return - end - - minetest.register_craft({ - type = "shapeless", - output = gdef.seed_name.." 1", - recipe = { - farming.modname..":trellis",gdef.harvest_name - }, - }) -end -- function for using billhook on punchable fruits -- add wear to billhook and give player by change one more fruit diff --git a/crops.txt b/crops.txt index 50bd3ef..2425cae 100644 --- a/crops.txt +++ b/crops.txt @@ -12,9 +12,9 @@ cotton,1,,10,8,,,,,1,1,,,,1,,,,1,,,,,,3,,2,45,90,20,,,,12,,,,,,,,,,, culturewheat,1,,100,4,4,,1,,1,1,,,2,2,,,,1,,1,3,,1,3,,2,25,,40,,,,10,,,,,,100,farming:straw,,,farming:flour,farming:grain_roasted flax,,,10,7,,,,,1,1,,,,1,,,,1,,,,,,3,,,25,,30,,,,,,,,,,,farming:flaw,,,, garlic,,,10,5,,1,,1,,1,,,,,,,,,,,3,,,3,,,,,,,,,,,,,,,,,,,, -grapes,,,10,8,,2,1,,,1,,1,,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,,farming:wildgrapes_seed,, +grapes,,,10,8,,2,1,,,1,,1,,1,,,,,1,,,,,3,,3,,,,,,,,,,,,,,,,farming:seed_wildgrapes,, hemp,1,,10,8,,,,,1,,,,,,,,,1,,,,,,3,,2,,120,,,,,8,,,,1E-05,9,,farming:hemp_fibre,,,, -hop,1,,10,7,,1,1,,,1,,1,2,2,,,,,1,,4,,,3,,,,,,,,,,,,,,,,,,farming:wildhop_seed,, +hop,1,,10,7,,1,1,,,1,,1,2,2,,,,,1,,4,,,3,,,,,,,,,,,,,,,,,,farming:seed_wildhop,, mustard,1,,10,5,,,,,,,,,,1,,,,,,,,2,,3,,,,,,,,,,,,,,,,,,,, potato,1,,10,4,4,2,,,,1,,,2,1,,,,,,,4,1,,3,,,,,,,,,,,,,,,,,,,,farming:potato_baked raspberry,1,,10,4,,1,,,,,1,1,1,,,,,,,,,,,3,1,5,,,,,,,9,,,,,,,,,,, diff --git a/nodes_register.lua b/nodes_register.lua index ab35a4b..0781597 100644 --- a/nodes_register.lua +++ b/nodes_register.lua @@ -99,6 +99,7 @@ farming.register_plant = function(def) farming.register_steps(def) + -- crops, which should be cultured, does not randomly appear on the field if (not def.groups["to_culture"]) then local edef=def local spread_def={name=def.step_name.."_1", @@ -114,6 +115,8 @@ farming.register_plant = function(def) farming.register_infect(def) end + -- if defined special roast, grind item or seed to drop, + -- check if the item already exist. when not than register it. for _,it in ipairs({"roast","grind","seed_drop"}) do if def[it] ~= nil then if minetest.registered_craftitems[def[it]] == nil then @@ -121,6 +124,7 @@ farming.register_plant = function(def) end end end + if def.groups["use_flail"] then def.straw_name="farming:straw" if def.straw then @@ -128,15 +132,20 @@ farming.register_plant = function(def) end farming.craft_seed(def) end + if def.groups["use_trellis"] then farming.trellis_seed(def) + print(dump(def)) end + if def.groups["seed_grindable"] then farming.register_grind(def) end + if def.groups["seed_roastable"] then farming.register_roast(def) end + if def.groups["for_coffee"] then farming.register_coffee(def) end @@ -587,6 +596,23 @@ function farming.register_grind(rdef) -- print("time register grind "..1000*(os.clock()-starttime)) end +farming.trellis_seed = function(gdef) + if gdef.seed_name == nil then + return + end + if gdef.harvest_name == nil then + return + end + + minetest.register_craft({ + type = "shapeless", + output = gdef.seed_name.." 1", + recipe = { + farming.modname..":trellis",gdef.harvest_name + }, + }) +end + -- local starttime=os.clock() -- print("time define infect "..1000*(os.clock()-starttime))