I wanted to make a peanut crop for my mod, using the farming redo api, but i wanted to
give it a little something, by using a lbm so that whenever it reaches stage 5 it will spread on a nearby soil node.
The thing is that i'm new to modding and lua in general so i'm a little confused.
This is what i have written so far, can somebody help me?
By the way the lbm is in the same .lua as all the crops stages, 5 in total and it grows.
Code: Select all
minetest.register_lbm({
name = "sandwiches:peanut_spreading_lbm",
nodenames = {"sandwiches:peanut_5"},
action = function(pos, node)
local soil_pos = minetest.find_node_near({x= pos.x, y= pos.y-1, z= pos.z},1,{"farming:soil_wet","farming:soil"})
local above_node = minetest.get_node({x= soil_pos.x, y= soil_pos.y+1, z= soil_pos.z})
if(above_node.name == "air") then
minetest.set_node({x= soil_pos.x, y= soil_pos.y+1, z= soil_pos.z}, {name= "sandwiches:peanut_1"})
end
end,
})