Growlight: Improve flower registration
- Avoid duplicate registrations - Add support for Bakedclay flowers
This commit is contained in:
parent
2685054f24
commit
adf04af6e8
@ -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,12 +150,8 @@ 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
|
|
||||||
elseif mod == "flowers" then
|
|
||||||
techage.register_flower(name)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user