forked from minetest/minetest_game
60ccb522d4
- API {farming.register_hoe(), farming.register_plant()} - Fertilities -> Plant only grow on soil with a fitting fertility, e.g. Wheat only grows on grassland, while cotton grows in deserts and grassland) - New soil: Desert Sand - Place seeds instead of plants
65 lines
1.4 KiB
Lua
65 lines
1.4 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",
|
|
inventory_image = "farming_wheat_seed.png",
|
|
steps = 8,
|
|
minlight = 13,
|
|
maxlight = LIGHT_MAX,
|
|
fertility = {"grassland"}
|
|
})
|
|
minetest.register_craftitem("farming:flour", {
|
|
description = "Flour",
|
|
inventory_image = "farming_flour.png",
|
|
})
|
|
|
|
minetest.register_craftitem("farming:bread", {
|
|
description = "Bread",
|
|
inventory_image = "farming_bread.png",
|
|
on_use = minetest.item_eat(4),
|
|
})
|
|
|
|
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 = LIGHT_MAX,
|
|
fertility = {"grassland", "desert"}
|
|
})
|
|
|
|
minetest.register_craftitem("farming:string", {
|
|
description = "String",
|
|
inventory_image = "farming_cotton.png",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = "wool:white",
|
|
recipe = {
|
|
{"farming:cotton", "farming:cotton"},
|
|
{"farming:cotton", "farming:cotton"},
|
|
}
|
|
})
|