Fix water not speeding up crop growth

This commit is contained in:
IamPyu 2024-10-16 16:12:21 -06:00
parent 9382dd186c
commit b874c556c8
2 changed files with 6 additions and 6 deletions

View File

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

View File

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