mirror of
https://codeberg.org/tenplus1/farming.git
synced 2025-12-27 16:25:20 +01:00
fix api.txt hoe recipe, add check for register_hoe recipe (thx the4codeblocks)
This commit is contained in:
8
api.txt
8
api.txt
@@ -27,8 +27,8 @@ The farming API allows you to easily register plants and hoes.
|
|||||||
material = "", -- Material for recipes
|
material = "", -- Material for recipes
|
||||||
recipe = { -- Craft recipe, if material isn't used
|
recipe = { -- Craft recipe, if material isn't used
|
||||||
{"air", "air", "air"},
|
{"air", "air", "air"},
|
||||||
{"", "group:stick"},
|
{"", "group:stick", ""},
|
||||||
{"", "group:stick"},
|
{"", "group:stick", ""},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ The farming API allows you to easily register plants and hoes.
|
|||||||
steps = 8, -- How many steps the plant has to grow, until it can be harvested
|
steps = 8, -- How many steps the plant has to grow, until it can be harvested
|
||||||
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
|
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
|
||||||
minlight = 13, -- Minimum light to grow
|
minlight = 13, -- Minimum light to grow
|
||||||
maxlight = minetest.LIGHT_MAX -- Maximum light to grow
|
maxlight = core.LIGHT_MAX -- Maximum light to grow
|
||||||
can_grow = function(pos) -- Called every growth tick to check if plant can grow returning True if needs are met (optional, defaults to checking for wet soil below plant).
|
can_grow = function(pos) -- Called every growth tick to check if plant can grow returning True if needs are met (optional, defaults to checking for wet soil below plant).
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ If a mod registers nodes to be used as crops using the {growing=1} group then an
|
|||||||
|
|
||||||
growth_check = function(pos, [node_name]) [DEPRECATED for above can_grow function]
|
growth_check = function(pos, [node_name]) [DEPRECATED for above can_grow function]
|
||||||
-- check surrounding for jungle tree
|
-- check surrounding for jungle tree
|
||||||
if minetest.find_node_near(pos, 1, {"default:jungletree"}) then
|
if core.find_node_near(pos, 1, {"default:jungletree"}) then
|
||||||
return true -- place next growth stage
|
return true -- place next growth stage
|
||||||
end
|
end
|
||||||
return false -- condition not met, skip next growth stage until next check
|
return false -- condition not met, skip next growth stage until next check
|
||||||
|
|||||||
19
hoes.lua
19
hoes.lua
@@ -36,19 +36,14 @@ farming.register_hoe = function(name, def)
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Register its recipe
|
-- Register its recipe
|
||||||
if def.recipe then
|
local recipe = def.recipe or (def.material and {
|
||||||
core.register_craft({ output = name:sub(2), recipe = def.recipe })
|
{def.material, def.material},
|
||||||
|
{"", "group:stick"},
|
||||||
|
{"", "group:stick"}
|
||||||
|
})
|
||||||
|
|
||||||
elseif def.material then
|
if recipe then
|
||||||
|
core.register_craft({ output = name:sub(2), recipe = recipe })
|
||||||
core.register_craft({
|
|
||||||
output = name:sub(2),
|
|
||||||
recipe = {
|
|
||||||
{def.material, def.material, ""},
|
|
||||||
{"", "group:stick", ""},
|
|
||||||
{"", "group:stick", ""}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user