From b874c556c82e20de96d29ca1e4900e7032d93a5a Mon Sep 17 00:00:00 2001 From: IamPyu Date: Wed, 16 Oct 2024 16:12:21 -0600 Subject: [PATCH] Fix water not speeding up crop growth --- mods/ITEMS/pyutest_farming/api.lua | 8 ++++---- mods/ITEMS/pyutest_farming/init.lua | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/pyutest_farming/api.lua b/mods/ITEMS/pyutest_farming/api.lua index 128809e..2cda5cd 100644 --- a/mods/ITEMS/pyutest_farming/api.lua +++ b/mods/ITEMS/pyutest_farming/api.lua @@ -22,7 +22,7 @@ PyuTest.make_item("pyutest_farming:hoe", "Hoe", { end }) -PyuTest.make_crop = function (name, desc, output, growtime, textures) +PyuTest.make_crop = function (name, desc, output, growtime, water_multiplier, textures) local t = textures or {} PyuTest.make_node(name.."_crop", desc .. "Crop", { @@ -40,10 +40,10 @@ PyuTest.make_crop = function (name, desc, output, growtime, textures) walkable = false, floodable = true, on_construct = function (pos) - local time = growtime or 90 + local time = growtime - if PyuTest.node_beside_group(pos, "water") then - growtime = growtime / 2 + if PyuTest.node_beside_group(pos - vector.new(0, 1, 0), "water") then + time = time * (water_multiplier or 0.5) end local timer = minetest.get_node_timer(pos) diff --git a/mods/ITEMS/pyutest_farming/init.lua b/mods/ITEMS/pyutest_farming/init.lua index 40c40dd..70bdb41 100644 --- a/mods/ITEMS/pyutest_farming/init.lua +++ b/mods/ITEMS/pyutest_farming/init.lua @@ -2,13 +2,13 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) dofile(modpath .. "/api.lua") -PyuTest.make_crop("pyutest_farming:wheat", "Wheat", "pyutest_tools:wheat 2", 65, { +PyuTest.make_crop("pyutest_farming:wheat", "Wheat", "pyutest_tools:wheat 2", 65, nil, { crop_color = "#eed89a", grown_color = "#eed89a", seed_color = "#eed89a" }) -PyuTest.make_crop("pyutest_farming:carrot", "Carrot", "pyutest_tools:carrot 3", 90, { +PyuTest.make_crop("pyutest_farming:carrot", "Carrot", "pyutest_tools:carrot 3", 90, nil, { crop_color = "#d19d79", grown_color = "#d19d79", seed_color = "#d19d79"