From bf82b3b3fed9bd62b280cb549d972a924f514208 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 22 Jul 2022 21:22:37 -0600 Subject: [PATCH] added stubs for growth permission for farming plants --- df_farming/growth_conditions.lua | 25 +++++++++++++++++++++++++ df_farming/plants.lua | 6 ++++-- df_farming/plump_helmet.lua | 7 ++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/df_farming/growth_conditions.lua b/df_farming/growth_conditions.lua index e69de29..8ce1f42 100644 --- a/df_farming/growth_conditions.lua +++ b/df_farming/growth_conditions.lua @@ -0,0 +1,25 @@ +df_farming.growth_permitted = {} + +df_farming.growth_permitted["df_farming:cave_wheat_seed"] = function(pos) + return true +end + +df_farming.growth_permitted["df_farming:dimple_cup_seed"] = function(pos) + return true +end + +df_farming.growth_permitted["df_farming:pig_tail_seed"] = function(pos) + return true +end + +df_farming.growth_permitted["df_farming:quarry_bush_seed"] = function(pos) + return true +end + +df_farming.growth_permitted["df_farming:sweet_pod_seed"] = function(pos) + return true +end + +df_farming.growth_permitted["df_farming:plump_helmet_spawn"] = function(pos) + return true +end \ No newline at end of file diff --git a/df_farming/plants.lua b/df_farming/plants.lua index 455de13..2714001 100644 --- a/df_farming/plants.lua +++ b/df_farming/plants.lua @@ -35,7 +35,6 @@ df_farming.spawn_dead_fungus_vm = function(vi, area, data, param2_data) param2_data[vi] = 0 end --- not DF canon minetest.register_node("df_farming:cavern_fungi", { description = S("Cavern Fungi"), _doc_items_longdesc = df_farming.doc.cavern_fungi_desc, @@ -132,7 +131,10 @@ local place_seed = function(itemstack, placer, pointed_thing, plantname) -- add the node and remove 1 item from the itemstack minetest.add_node(pt.above, {name = plantname, param2 = 1}) - df_farming.plant_timer(pt.above, plantname) + local growth_permitted_function = df_farming.growth_permitted[plantname] + if not growth_permitted_function or growth_permitted_function(pt.above) then + df_farming.plant_timer(pt.above, plantname) + end if not minetest.settings:get_bool("creative_mode", false) then itemstack:take_item() end diff --git a/df_farming/plump_helmet.lua b/df_farming/plump_helmet.lua index 366e207..303751b 100644 --- a/df_farming/plump_helmet.lua +++ b/df_farming/plump_helmet.lua @@ -47,7 +47,12 @@ local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantn -- add the node and remove 1 item from the itemstack minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)}) - df_farming.plant_timer(pt.above, plantname) + + local growth_permitted_function = df_farming.growth_permitted["df_farming:plump_helmet_spawn"] -- use the same permitted function for all plump helmets + if not growth_permitted_function or growth_permitted_function(pt.above) then + df_farming.plant_timer(pt.above, plantname) + end + if not minetest.settings:get_bool("creative_mode", false) then itemstack:take_item() end