mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-30 18:46:28 -04:00
farming
This commit is contained in:
parent
9ab6fb56b1
commit
914402fd2b
4 changed files with 23 additions and 11 deletions
|
@ -359,6 +359,8 @@ The farming API allows you to easily register plants and hoes.
|
|||
|
||||
{
|
||||
description = "", -- Description of seed item
|
||||
harvest_description = "", -- Description of harvest item
|
||||
-- (optional, derived automatically if not provided)
|
||||
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
|
||||
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)
|
||||
|
|
|
@ -257,6 +257,9 @@ farming.register_plant = function(name, def)
|
|||
if not def.description then
|
||||
def.description = S("Seed")
|
||||
end
|
||||
if not def.harvest_description then
|
||||
def.harvest_description = pname:gsub("^%l", string.upper)
|
||||
end
|
||||
if not def.inventory_image then
|
||||
def.inventory_image = "unknown_item.png"
|
||||
end
|
||||
|
@ -325,7 +328,7 @@ farming.register_plant = function(name, def)
|
|||
|
||||
-- Register harvest
|
||||
minetest.register_craftitem(":" .. mname .. ":" .. pname, {
|
||||
description = pname:gsub("^%l", string.upper),
|
||||
description = def.harvest_description,
|
||||
inventory_image = mname .. "_" .. pname .. ".png",
|
||||
groups = def.groups or {flammable = 2},
|
||||
})
|
||||
|
|
|
@ -20,6 +20,7 @@ dofile(farming.path .. "/hoes.lua")
|
|||
|
||||
farming.register_plant("farming:wheat", {
|
||||
description = S("Wheat Seed"),
|
||||
harvest_description = S("Wheat"),
|
||||
paramtype2 = "meshoptions",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
steps = 8,
|
||||
|
@ -61,6 +62,7 @@ minetest.register_craft({
|
|||
|
||||
farming.register_plant("farming:cotton", {
|
||||
description = S("Cotton Seed"),
|
||||
harvest_description = S("Cotton"),
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
|
|
|
@ -153,16 +153,21 @@ minetest.register_node("farming:straw", {
|
|||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
"straw",
|
||||
"farming:straw",
|
||||
{snappy = 3, flammable = 4},
|
||||
{"farming_straw.png"},
|
||||
S("Straw Stair"),
|
||||
S("Straw Slab"),
|
||||
default.node_sound_leaves_defaults(),
|
||||
true
|
||||
)
|
||||
do
|
||||
local recipe = "farming:straw"
|
||||
local groups = {snappy = 3, flammable = 4}
|
||||
local images = {"farming_straw.png"}
|
||||
local sounds = default.node_sound_leaves_defaults()
|
||||
|
||||
stairs.register_stair("straw", recipe, groups, images, S("Straw Stair"),
|
||||
sounds, true)
|
||||
stairs.register_stair_inner("straw", recipe, groups, images, "",
|
||||
sounds, true, S("Inner Straw Stair"))
|
||||
stairs.register_stair_outer("straw", recipe, groups, images, "",
|
||||
sounds, true, S("Outer Straw Stair"))
|
||||
stairs.register_slab("straw", recipe, groups, images, S("Straw Slab"),
|
||||
sounds, true)
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Farming soil",
|
||||
|
|
Loading…
Add table
Reference in a new issue