added stubs for growth permission for farming plants

This commit is contained in:
FaceDeer 2022-07-22 21:22:37 -06:00
parent 46765df3ef
commit bf82b3b3fe
3 changed files with 35 additions and 3 deletions

View File

@ -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

View File

@ -35,7 +35,6 @@ df_farming.spawn_dead_fungus_vm = function(vi, area, data, param2_data)
param2_data[vi] = 0 param2_data[vi] = 0
end end
-- not DF canon
minetest.register_node("df_farming:cavern_fungi", { minetest.register_node("df_farming:cavern_fungi", {
description = S("Cavern Fungi"), description = S("Cavern Fungi"),
_doc_items_longdesc = df_farming.doc.cavern_fungi_desc, _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 -- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1}) minetest.add_node(pt.above, {name = plantname, param2 = 1})
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) df_farming.plant_timer(pt.above, plantname)
end
if not minetest.settings:get_bool("creative_mode", false) then if not minetest.settings:get_bool("creative_mode", false) then
itemstack:take_item() itemstack:take_item()
end end

View File

@ -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 -- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)}) minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
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) df_farming.plant_timer(pt.above, plantname)
end
if not minetest.settings:get_bool("creative_mode", false) then if not minetest.settings:get_bool("creative_mode", false) then
itemstack:take_item() itemstack:take_item()
end end