add strawberry and wild onion to farming.registered_crops (thanks nixnoxus)
This commit is contained in:
parent
bba8bc3ccc
commit
d22d8a3986
81
onion.lua
81
onion.lua
@ -65,40 +65,55 @@ crop_def.drop = {
|
|||||||
}
|
}
|
||||||
minetest.register_node("ethereal:onion_5", table.copy(crop_def))
|
minetest.register_node("ethereal:onion_5", table.copy(crop_def))
|
||||||
|
|
||||||
|
|
||||||
-- growing routine if farming redo isn't present
|
-- growing routine if farming redo isn't present
|
||||||
if not farming or not farming.mod or farming.mod ~= "redo" then
|
if farming and farming.mod and farming.mod == "redo" then
|
||||||
|
|
||||||
minetest.register_abm({
|
-- add to registered_plants
|
||||||
label = "Ethereal grow onion",
|
farming.registered_plants["ethereal:wild_onion_plant"] = {
|
||||||
nodenames = {"ethereal:onion_1", "ethereal:onion_2", "ethereal:onion_3", "ethereal:onion_4"},
|
crop = "ethereal:onion",
|
||||||
neighbors = {"farming:soil_wet"},
|
seed = "ethereal:wild_onion_plant",
|
||||||
interval = 11,
|
minlight = farming.min_light,
|
||||||
chance = 20,
|
maxlight = farming.max_light,
|
||||||
catch_up = false,
|
steps = 5
|
||||||
action = function(pos, node)
|
}
|
||||||
|
|
||||||
-- are we on wet soil?
|
else
|
||||||
pos.y = pos.y - 1
|
|
||||||
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
minetest.register_abm({
|
||||||
return
|
label = "Ethereal grow onion",
|
||||||
|
nodenames = {
|
||||||
|
"ethereal:onion_1", "ethereal:onion_2", "ethereal:onion_3",
|
||||||
|
"ethereal:onion_4"
|
||||||
|
},
|
||||||
|
neighbors = {"farming:soil_wet"},
|
||||||
|
interval = 11,
|
||||||
|
chance = 20,
|
||||||
|
catch_up = false,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
-- are we on wet soil?
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
|
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
|
-- do we have enough light?
|
||||||
|
local light = minetest.get_node_light(pos)
|
||||||
|
|
||||||
|
if not light or light < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- grow to next stage
|
||||||
|
local num = node.name:split("_")[2]
|
||||||
|
|
||||||
|
node.name = "ethereal:onion_" .. tonumber(num + 1)
|
||||||
|
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
end
|
end
|
||||||
pos.y = pos.y + 1
|
})
|
||||||
|
end
|
||||||
-- do we have enough light?
|
|
||||||
local light = minetest.get_node_light(pos)
|
|
||||||
|
|
||||||
if not light
|
|
||||||
or light < 13 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- grow to next stage
|
|
||||||
local num = node.name:split("_")[2]
|
|
||||||
|
|
||||||
node.name = "ethereal:onion_" .. tonumber(num + 1)
|
|
||||||
|
|
||||||
minetest.swap_node(pos, node)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
end -- END IF
|
|
||||||
|
@ -84,44 +84,56 @@ crop_def.drop = {
|
|||||||
}
|
}
|
||||||
minetest.register_node("ethereal:strawberry_8", table.copy(crop_def))
|
minetest.register_node("ethereal:strawberry_8", table.copy(crop_def))
|
||||||
|
|
||||||
|
|
||||||
-- growing routine if farming redo isn't present
|
-- growing routine if farming redo isn't present
|
||||||
if not farming or not farming.mod or farming.mod ~= "redo" then
|
if farming and farming.mod and farming.mod == "redo" then
|
||||||
|
|
||||||
minetest.register_abm({
|
-- add to registered_plants
|
||||||
label = "Ethereal grow strawberry",
|
farming.registered_plants["ethereal:strawberry"] = {
|
||||||
nodenames = {
|
crop = "ethereal:strawberry",
|
||||||
"ethereal:strawberry_1", "ethereal:strawberry_2", "ethereal:strawberry_3",
|
seed = "ethereal:strawberry",
|
||||||
"ethereal:strawberry_4", "ethereal:strawberry_5", "ethereal:strawberry_6",
|
minlight = farming.min_light,
|
||||||
"ethereal:strawberry_7"
|
maxlight = farming.max_light,
|
||||||
},
|
steps = 8
|
||||||
neighbors = {"farming:soil_wet"},
|
}
|
||||||
interval = 9,
|
|
||||||
chance = 20,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos, node)
|
|
||||||
|
|
||||||
-- are we on wet soil?
|
else
|
||||||
pos.y = pos.y - 1
|
|
||||||
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
minetest.register_abm({
|
||||||
return
|
label = "Ethereal grow strawberry",
|
||||||
|
nodenames = {
|
||||||
|
"ethereal:strawberry_1", "ethereal:strawberry_2", "ethereal:strawberry_3",
|
||||||
|
"ethereal:strawberry_4", "ethereal:strawberry_5", "ethereal:strawberry_6",
|
||||||
|
"ethereal:strawberry_7"
|
||||||
|
},
|
||||||
|
neighbors = {"farming:soil_wet"},
|
||||||
|
interval = 9,
|
||||||
|
chance = 20,
|
||||||
|
catch_up = false,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
-- are we on wet soil?
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
|
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
|
-- do we have enough light?
|
||||||
|
local light = minetest.get_node_light(pos)
|
||||||
|
|
||||||
|
if not light or light < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- grow to next stage
|
||||||
|
local num = node.name:split("_")[2]
|
||||||
|
|
||||||
|
node.name = "ethereal:strawberry_" .. tonumber(num + 1)
|
||||||
|
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
end
|
end
|
||||||
pos.y = pos.y + 1
|
})
|
||||||
|
end
|
||||||
-- do we have enough light?
|
|
||||||
local light = minetest.get_node_light(pos)
|
|
||||||
|
|
||||||
if not light
|
|
||||||
or light < 13 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- grow to next stage
|
|
||||||
local num = node.name:split("_")[2]
|
|
||||||
|
|
||||||
node.name = "ethereal:strawberry_" .. tonumber(num + 1)
|
|
||||||
|
|
||||||
minetest.swap_node(pos, node)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
end -- END IF
|
|
||||||
|
Loading…
Reference in New Issue
Block a user