1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-12-27 03:00:20 +01:00

seeds made with register_plant function are placed in world and germinate into stage_1 of crop.

This commit is contained in:
tenplus1 2023-04-08 07:41:03 +01:00
parent b5f71d8025
commit 03fce8b65f

View File

@ -317,13 +317,17 @@ minetest.register_abm({
-- check if group:growing node is a seed
local def = minetest.registered_nodes[node.name]
if def.groups and def.groups.seed then
if def and def.groups and def.groups.seed then
local next_stage = def.next_plant
local p2 = def.place_param2
def = minetest.registered_nodes[next_stage]
-- change seed to stage_1 or crop
if next_stage then
if def then
local p2 = def.place_param2 or 1
minetest.set_node(pos, {name = next_stage, param2 = p2})
end
else
@ -563,12 +567,12 @@ farming.register_plant = function(name, def)
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
place_param2 = def.place_param2 or nil,
place_param2 = 1, -- place seed flat
next_plant = mname .. ":" .. pname .. "_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing,
mname .. ":" .. pname .. "_1")
mname .. ":seed_" .. pname)
end
})