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,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- item definition
minetest.register_craftitem("farming:artichoke", {
description = S("Artichoke"),
inventory_image = "farming_artichoke.png",
groups = {
compostability = 48, seed = 2, food_artichoke = 1
},
groups = {compostability = 48, seed = 2, food_artichoke = 1},
on_use = minetest.item_eat(4),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1")
end,
on_use = minetest.item_eat(4)
end
})
farming.add_eatable("farming:artichoke", 4)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_artichoke_1.png"},
@ -37,21 +38,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:artichoke_1", table.copy(def))
-- stage 2
def.tiles = {"farming_artichoke_2.png"}
minetest.register_node("farming:artichoke_2", table.copy(def))
-- stage 3
def.tiles = {"farming_artichoke_3.png"}
minetest.register_node("farming:artichoke_3", table.copy(def))
-- stage 4
def.tiles = {"farming_artichoke_4.png"}
minetest.register_node("farming:artichoke_4", table.copy(def))
-- stage 5 (final)
def.tiles = {"farming_artichoke_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -64,6 +70,7 @@ def.drop = {
minetest.register_node("farming:artichoke_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:artichoke"] = {
crop = "farming:artichoke",
seed = "farming:artichoke",
@ -73,6 +80,7 @@ farming.registered_plants["farming:artichoke"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},