Merge pull request #25 from Thomas--S/growlight-flowers

Growlight: Improve flower registration
This commit is contained in:
Joachim Stolberg 2020-08-22 19:21:20 +02:00 committed by GitHub
commit ac81960f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,10 +138,11 @@ function techage.register_plant(name)
end end
minetest.after(1, function() minetest.after(1, function()
for name,_ in pairs(minetest.registered_decorations) do for _,def in pairs(minetest.registered_decorations) do
if type(name) == "string" then local name = def.decoration
if name and type(name) == "string" then
local mod = string.split(name, ":")[1] local mod = string.split(name, ":")[1]
if mod == "flowers" then if mod == "flowers" or mod == "bakedclay" then -- Bakedclay also registers flowers as decoration.
techage.register_flower(name) techage.register_flower(name)
end end
end end
@ -149,13 +150,9 @@ minetest.after(1, function()
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" then if mod == "farming" and ndef.on_timer then -- probably a plant that still needs to grow
if ndef.on_timer then -- probably a plant that still needs to grow
techage.register_plant(name) techage.register_plant(name)
end end
elseif mod == "flowers" then
techage.register_flower(name)
end
end end
end end
end) end)