1
0
Fork 0

sweet berries plantable not only on farming soil

This commit is contained in:
cora 2022-10-24 16:23:14 +02:00 committed by Gitea
parent 2b08f9ac53
commit 2664fb871b
2 changed files with 17 additions and 13 deletions

View File

@ -59,18 +59,18 @@ for _, campfire in pairs(campfires) do
drawtype = "mesh", drawtype = "mesh",
mesh = "mcl_campfires_campfire_lit.obj", mesh = "mcl_campfires_campfire_lit.obj",
tiles = {{ tiles = {{
name="mcl_campfires_" .. campfire.techname .. "_fire.png", name="mcl_campfires_" .. campfire.techname .. "_fire.png",
animation={ animation={
type="vertical_frames", type="vertical_frames",
aspect_w=16, aspect_w=16,
aspect_h=16, aspect_h=16,
length=2.0 length=2.0
}}, }},
{name="mcl_campfires_" .. campfire.techname .. "_log_lit.png", {name="mcl_campfires_" .. campfire.techname .. "_log_lit.png",
animation={ animation={
type="vertical_frames", type="vertical_frames",
aspect_w=16, aspect_w=16,
aspect_h=16, aspect_h=16,
length=2.0 length=2.0
}} }}
}, },

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local planton = {"mcl_core:dirt_with_grass","mcl_core:dirt","mcl_core:podzol","mcl_core:coarse_dirt","mcl_farming:soil","mcl_moss:moss"}
for i=0, 3 do for i=0, 3 do
local texture = "mcl_farming_sweet_berry_bush_" .. i .. ".png" local texture = "mcl_farming_sweet_berry_bush_" .. i .. ".png"
local node_name = "mcl_farming:sweet_berry_bush_" .. i local node_name = "mcl_farming:sweet_berry_bush_" .. i
@ -40,12 +42,14 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
groups = { food = 2, eatable = 1, compostability=30 }, groups = { food = 2, eatable = 1, compostability=30 },
on_secondary_use = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_sweet_berry:sweet_berry_bush_0") if pointed_thing.type == "node" and table.indexof(planton,minetest.get_node(pointed_thing.under).name) ~= -1 and minetest.get_node(pointed_thing.above).name == "air" then
if new then minetest.set_node(pointed_thing.above,{name="mcl_farming:sweet_berry_bush_0"})
return new if not minetest.is_creative_enabled(placer:get_player_name()) then
else itemstack:take_item()
return minetest.do_item_eat(1, nil, itemstack, placer, pointed_thing) end
return itemstack
end end
return minetest.do_item_eat(1, nil, itemstack, placer, pointed_thing)
end, end,
}) })
minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry") minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry")