diff --git a/depends.txt b/depends.txt index 5bdcc1f..b1e1dee 100644 --- a/depends.txt +++ b/depends.txt @@ -10,3 +10,4 @@ dye? ferns? dryplants? df_trees? +df_farming? diff --git a/init.lua b/init.lua index 8cfa1f9..f1b14fb 100644 --- a/init.lua +++ b/init.lua @@ -218,12 +218,25 @@ local function check_crops(pos, nodename, strength) crop = nodename:split(":")[2] -- get stage number or set to 0 for seed - stage = tonumber( crop:split("_")[2] ) or 0 + if crop:split("_")[3] then + stage = crop:split("_")[3] + else + stage = crop:split("_")[2] + end + + stage = tonumber(stage) or 0 + stage = min(stage + strength, crops[n][2]) -- check for place_param setting nod = crops[n][1] .. stage def = minetest.registered_nodes[nod] + + -- make sure crop exists or isn't fully grown already + if not def or nod == nodename then + return false + end + def = def and def.place_param2 or 0 minetest.set_node(pos, {name = nod, param2 = def}) diff --git a/mod.conf b/mod.conf index 7f91a15..8865483 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = bonemeal depends = default -optional_depends = intllib, lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees +optional_depends = intllib, lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees, df_farming description = Adds bone and bonemeal giving the ability to quickly grow plants and saplings. diff --git a/mods.lua b/mods.lua index 1cee64c..e105f17 100644 --- a/mods.lua +++ b/mods.lua @@ -208,3 +208,16 @@ if minetest.get_modpath("df_trees") then {"df_trees:tunnel_tube_sapling", df_trees.spawn_tunnel_tube, "soil"} }) end + + +if minetest.get_modpath("df_farming") then + + bonemeal:add_crop({ + {"df_farming:cave_wheat_", 8, "df_farming:cave_wheat_seed"}, + {"df_farming:dimple_cup_", 4, "df_farming:dimple_cup_seed"}, + {"df_farming:pig_tail_", 8, "df_farming:pig_tail_seed"}, + {"df_farming:plump_helmet_", 4, "df_farming:plump_helmet_spawn"}, + {"df_farming:quarry_bush_", 5, "df_farming:quarry_bush_seed"}, + {"df_farming:sweet_pod_", 6, "df_farming:sweet_pod_seed"} + }) +end