Don't spawn water plants on garden soil

This commit is contained in:
Niklp 2024-10-06 11:44:57 +02:00
parent d7be11a8aa
commit 46b176805d
No known key found for this signature in database
GPG Key ID: 05D6F5035E66267A

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,13 +211,13 @@ 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