mirror of
https://codeberg.org/tenplus1/farming.git
synced 2025-06-29 23:01:00 +02:00
separate food /non-food items from crop files, tidy code
This commit is contained in:
@ -5,51 +5,25 @@
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=19488
|
||||
]]
|
||||
|
||||
local S = farming.translate
|
||||
local a = farming.recipe_items
|
||||
local S = minetest.get_translator("farming")
|
||||
|
||||
-- item/seed
|
||||
|
||||
-- onion
|
||||
minetest.register_craftitem("farming:onion", {
|
||||
description = S("Onion"),
|
||||
inventory_image = "crops_onion.png",
|
||||
groups = {
|
||||
compostability = 48, seed = 2, food_onion = 1
|
||||
},
|
||||
groups = {compostability = 48, seed = 2, food_onion = 1},
|
||||
on_use = minetest.item_eat(1),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1)
|
||||
end
|
||||
})
|
||||
|
||||
farming.add_eatable("farming:onion", 1)
|
||||
|
||||
-- onion soup
|
||||
minetest.register_craftitem("farming:onion_soup", {
|
||||
description = S("Onion Soup"),
|
||||
inventory_image = "farming_onion_soup.png",
|
||||
groups = {compostability = 65},
|
||||
on_use = minetest.item_eat(6, a.bowl)
|
||||
})
|
||||
|
||||
farming.add_eatable("farming:onion_soup", 6)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:onion_soup",
|
||||
recipe = {
|
||||
{"group:food_onion", "group:food_onion", "group:food_onion"},
|
||||
{"group:food_onion", "group:food_bowl", "group:food_onion"},
|
||||
{"", a.pot, ""}
|
||||
},
|
||||
replacements = {{"farming:pot", "farming:pot"}}
|
||||
})
|
||||
|
||||
-- yellow dye
|
||||
minetest.register_craft({
|
||||
output = a.dye_yellow,
|
||||
recipe = {{"group:food_onion"}}
|
||||
})
|
||||
|
||||
-- crop definition
|
||||
|
||||
local def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"crops_onion_plant_1.png"},
|
||||
@ -73,21 +47,26 @@ local def = {
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
|
||||
minetest.register_node("farming:onion_1", table.copy(def))
|
||||
|
||||
-- stage 2
|
||||
|
||||
def.tiles = {"crops_onion_plant_2.png"}
|
||||
minetest.register_node("farming:onion_2", table.copy(def))
|
||||
|
||||
-- stage 3
|
||||
|
||||
def.tiles = {"crops_onion_plant_3.png"}
|
||||
minetest.register_node("farming:onion_3", table.copy(def))
|
||||
|
||||
-- stage 4
|
||||
|
||||
def.tiles = {"crops_onion_plant_4.png"}
|
||||
minetest.register_node("farming:onion_4", table.copy(def))
|
||||
|
||||
-- stage 5
|
||||
|
||||
def.tiles = {"crops_onion_plant_5.png"}
|
||||
def.groups.growing = nil
|
||||
def.selection_box = farming.select_final
|
||||
@ -103,6 +82,7 @@ def.drop = {
|
||||
minetest.register_node("farming:onion_5", table.copy(def))
|
||||
|
||||
-- add to registered_plants
|
||||
|
||||
farming.registered_plants["farming:onion"] = {
|
||||
crop = "farming:onion",
|
||||
seed = "farming:onion",
|
||||
@ -112,6 +92,7 @@ farming.registered_plants["farming:onion"] = {
|
||||
}
|
||||
|
||||
-- mapgen
|
||||
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},
|
||||
|
Reference in New Issue
Block a user