diff --git a/api.txt b/api.txt index b9d5cff..2500df3 100644 --- a/api.txt +++ b/api.txt @@ -20,7 +20,6 @@ The farming API allows you to easily register plants and hoes. ### Hoe Definition - { description = "My Hoe", -- Description for tooltip inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image @@ -42,6 +41,7 @@ The farming API allows you to easily register plants and hoes. -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) minlight = 13, -- Minimum light to grow maxlight = minetest.LIGHT_MAX -- Maximum light to grow + can_grow = function(pos) -- Called every growth tick to check if plant can grow returning True if needs are met (optional, defaults to checking for wet soil below plant). } Note: Any crops registered with the above function will use the new growing routines, also if crops are manually added with the {growing=1} group they will also grow. @@ -50,7 +50,7 @@ Note: Any crops registered with the above function will use the new growing rout If a mod registers nodes to be used as crops using the {growing=1} group then an additional function can be used for custom growth checks instead of the standard 'are we above wet soil'. -growth_check = function(pos, node_name) +growth_check = function(pos, [node_name]) -- check surrounding for jungle tree if minetest.find_node_near(pos, 1, {"default:jungletree"}) then return true -- place next growth stage diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 1032b49..e67ad1d 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -160,6 +160,8 @@ local def = { }, is_ground_content = false, sounds = farming.sounds.node_sound_leaves_defaults(), + + -- custom function to check for growing conditions, returning True when found growth_check = function(pos, node_name) if minetest.find_node_near(pos, 1,