1
0
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:
tenplus1
2024-08-11 15:38:55 +01:00
parent cdac09a8f4
commit a9a1b720a3
57 changed files with 3691 additions and 3271 deletions

View File

@ -1,43 +1,23 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- rhubarb
minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
groups = {
compostability = 48, seed = 2, food_rhubarb = 1
},
groups = {compostability = 48, seed = 2, food_rhubarb = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:rhubarb", 1)
-- rhubarb pie
minetest.register_craftitem("farming:rhubarb_pie", {
description = S("Rhubarb Pie"),
inventory_image = "farming_rhubarb_pie.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65}
})
-- crop definition
farming.add_eatable("farming:rhubarb_pie", 6)
minetest.register_craft({
output = "farming:rhubarb_pie",
recipe = {
{a.baking_tray, "group:food_sugar", ""},
{"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"},
{"group:food_wheat", "group:food_wheat", "group:food_wheat"}
},
replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
})
-- rhubarb definition
local def = {
drawtype = "plantlike",
tiles = {"farming_rhubarb_1.png"},
@ -60,13 +40,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:rhubarb_1", table.copy(def))
-- stage2
def.tiles = {"farming_rhubarb_2.png"}
minetest.register_node("farming:rhubarb_2", table.copy(def))
-- stage3
def.tiles = {"farming_rhubarb_3.png"}
def.drop = {
items = {
@ -76,6 +59,7 @@ def.drop = {
minetest.register_node("farming:rhubarb_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_rhubarb_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -89,6 +73,7 @@ def.drop = {
minetest.register_node("farming:rhubarb_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:rhubarb"] = {
crop = "farming:rhubarb",
seed = "farming:rhubarb",
@ -98,6 +83,7 @@ farming.registered_plants["farming:rhubarb"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},