mirror of
https://codeberg.org/tenplus1/farming.git
synced 2025-07-03 00:30:39 +02:00
separate food /non-food items from crop files, tidy code
This commit is contained in:
@ -1,22 +1,23 @@
|
||||
|
||||
local S = farming.translate
|
||||
local S = minetest.get_translator("farming")
|
||||
|
||||
-- item/seed
|
||||
|
||||
-- eggplant
|
||||
minetest.register_craftitem("farming:eggplant", {
|
||||
description = S("Eggplant"),
|
||||
inventory_image = "farming_eggplant.png",
|
||||
groups = {
|
||||
compostability = 48, seed = 2, food_eggplant = 1
|
||||
},
|
||||
groups = {compostability = 48, seed = 2, food_eggplant = 1},
|
||||
on_use = minetest.item_eat(3),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(3)
|
||||
end
|
||||
})
|
||||
|
||||
farming.add_eatable("farming:eggplant", 3)
|
||||
|
||||
-- definition
|
||||
-- crop definition
|
||||
|
||||
local def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_eggplant_1.png"},
|
||||
@ -38,13 +39,16 @@ local def = {
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
|
||||
minetest.register_node("farming:eggplant_1", table.copy(def))
|
||||
|
||||
-- stage 2
|
||||
|
||||
def.tiles = {"farming_eggplant_2.png"}
|
||||
minetest.register_node("farming:eggplant_2", table.copy(def))
|
||||
|
||||
-- stage 3
|
||||
|
||||
def.tiles = {"farming_eggplant_3.png"}
|
||||
def.drop = {
|
||||
items = {
|
||||
@ -54,7 +58,8 @@ def.drop = {
|
||||
}
|
||||
minetest.register_node("farming:eggplant_3", table.copy(def))
|
||||
|
||||
-- stage 4
|
||||
-- stage 4 (final)
|
||||
|
||||
def.tiles = {"farming_eggplant_4.png"}
|
||||
def.groups.growing = nil
|
||||
def.selection_box = farming.select_final
|
||||
@ -67,6 +72,7 @@ def.drop = {
|
||||
minetest.register_node("farming:eggplant_4", table.copy(def))
|
||||
|
||||
-- add to registered_plants
|
||||
|
||||
farming.registered_plants["farming:eggplant"] = {
|
||||
crop = "farming:eggplant",
|
||||
seed = "farming:eggplant",
|
||||
@ -76,6 +82,7 @@ farming.registered_plants["farming:eggplant"] = {
|
||||
}
|
||||
|
||||
-- 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