Merge pull request #185 from Niklp09/flowers

Don't spawn water plants on garden soil
This commit is contained in:
Joachim Stolberg 2024-10-06 16:24:10 +02:00 committed by GitHub
commit 009ea6f3fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,6 @@ local Cable = techage.ElectricCable
local power = networks.power local power = networks.power
local Flowers = {} local Flowers = {}
local Plants = {} local Plants = {}
local Ignore = { ["flowers:waterlily_waving"] = true }
-- 9 plant positions below the light -- 9 plant positions below the light
local Positions = { local Positions = {
{x = 0, y =-1, z = 0}, {x = 0, y =-1, z = 0},
@ -192,10 +191,11 @@ function techage.register_plant(name)
end end
minetest.after(1, function() minetest.after(1, function()
-- Flowers
local function add_flower(name) local function add_flower(name)
local def = minetest.registered_nodes[name] local def = minetest.registered_nodes[name]
if def and (def.groups.mushroom == 1 or def.groups.flower == 1) then if def and (def.groups.mushroom == 1 or def.groups.flower == 1) then
if not Ignore[name] then if not (name:find("waterlily") or name:find("seaweed")) then -- we don't want water plants on garden soil
techage.register_flower(name) techage.register_flower(name)
end end
end end
@ -211,14 +211,14 @@ minetest.after(1, function()
end end
end end
end end
-- Plants
for name,ndef in pairs(minetest.registered_nodes) do for name,ndef in pairs(minetest.registered_nodes) do
if type(name) == "string" then if type(name) == "string" then
local mod = string.split(name, ":")[1] local mod = string.split(name, ":")[1]
if mod == "farming" and ndef.on_timer then -- probably a plant that still needs to grow if mod == "farming" and ndef.on_timer then -- probably a plant that still needs to grow
if not Ignore[name] then
techage.register_plant(name) techage.register_plant(name)
end end
end end
end end
end
end) end)