mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-09 01:03:52 +01:00
ea9c4012d5
This changes the farming API such that any nodedef with paramtype2 and place_param2 are passed through to all the plant stages of the farming plant. This allows plants to use an alternative mesh for the plantlike drawtype, and provide a bit of graphical variation in plants. We enable this for wheat, using place_param2 = 3, which is the '#' shaped plant mesh. If you would actually be able to give yourself this plant in creative or through /give, you would also get the same '#' shape.
110 lines
2.2 KiB
Lua
110 lines
2.2 KiB
Lua
-- Global farming namespace
|
|
farming = {}
|
|
farming.path = minetest.get_modpath("farming")
|
|
|
|
-- Load files
|
|
dofile(farming.path .. "/api.lua")
|
|
dofile(farming.path .. "/nodes.lua")
|
|
dofile(farming.path .. "/hoes.lua")
|
|
|
|
-- WHEAT
|
|
farming.register_plant("farming:wheat", {
|
|
description = "Wheat seed",
|
|
paramtype2 = "meshoptions",
|
|
inventory_image = "farming_wheat_seed.png",
|
|
steps = 8,
|
|
minlight = 13,
|
|
maxlight = default.LIGHT_MAX,
|
|
fertility = {"grassland"},
|
|
groups = {flammable = 4},
|
|
place_param2 = 3,
|
|
})
|
|
minetest.register_craftitem("farming:flour", {
|
|
description = "Flour",
|
|
inventory_image = "farming_flour.png",
|
|
groups = {flammable = 1},
|
|
})
|
|
|
|
minetest.register_craftitem("farming:bread", {
|
|
description = "Bread",
|
|
inventory_image = "farming_bread.png",
|
|
on_use = minetest.item_eat(5),
|
|
groups = {flammable = 2},
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "shapeless",
|
|
output = "farming:flour",
|
|
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "cooking",
|
|
cooktime = 15,
|
|
output = "farming:bread",
|
|
recipe = "farming:flour"
|
|
})
|
|
|
|
-- Cotton
|
|
farming.register_plant("farming:cotton", {
|
|
description = "Cotton seed",
|
|
inventory_image = "farming_cotton_seed.png",
|
|
steps = 8,
|
|
minlight = 13,
|
|
maxlight = default.LIGHT_MAX,
|
|
fertility = {"grassland", "desert"},
|
|
groups = {flammable = 4},
|
|
})
|
|
|
|
minetest.register_alias("farming:string", "farming:cotton")
|
|
|
|
minetest.register_craft({
|
|
output = "wool:white",
|
|
recipe = {
|
|
{"farming:cotton", "farming:cotton"},
|
|
{"farming:cotton", "farming:cotton"},
|
|
}
|
|
})
|
|
|
|
-- Straw
|
|
minetest.register_craft({
|
|
output = "farming:straw 3",
|
|
recipe = {
|
|
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
|
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
|
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
|
}
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = "farming:wheat 3",
|
|
recipe = {
|
|
{"farming:straw"},
|
|
}
|
|
})
|
|
|
|
-- Fuels
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "farming:straw",
|
|
burntime = 3,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "farming:wheat",
|
|
burntime = 1,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "farming:cotton",
|
|
burntime = 1,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = "fuel",
|
|
recipe = "farming:hoe_wood",
|
|
burntime = 5,
|
|
})
|