diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2018-06-17 09:55:26 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2018-06-17 09:55:26 +0100 |
commit | 8a4ca846d90abf5732b436c1f31b72c6b52e61dc (patch) | |
tree | b5d7ba913649ec5b95e40a5cedac717e92eea225 /init.lua | |
parent | 9d6728053aa2138e1fc77938ec4c34f89ba29542 (diff) |
added growth_check(pos, nodename) function
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -7,7 +7,7 @@ farming = {} farming.mod = "redo" -farming.version = "20180609" +farming.version = "20180617" farming.path = minetest.get_modpath("farming") farming.select = { type = "fixed", @@ -301,11 +301,16 @@ function farming.plant_growth_timer(pos, elapsed, node_name) return false end - if stages.plant_name == "farming:cocoa" then + -- custom growth check + local chk = minetest.registered_nodes[node_name].growth_check - if not minetest.find_node_near(pos, 1, {"default:jungletree"}) then + if chk then + + if chk(pos, node_name) then return true end + + -- otherwise check for wet soil beneath crop else local under = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }) |