Add Glow berries

This commit is contained in:
cora 2022-06-05 20:53:22 +02:00
parent d67bbf45f3
commit 965af98560
1 changed files with 33 additions and 10 deletions

View File

@ -150,19 +150,24 @@ minetest.register_node("mcl_lush_caves:cave_vines_lit", {
drawtype = "plantlike", drawtype = "plantlike",
--drop = "mcl_farming:wheat_seeds", --drop = "mcl_farming:wheat_seeds",
light_source = 9, light_source = 9,
tiles = {"mcl_lush_caves_cave_vines.png"}, tiles = {"mcl_lush_caves_cave_vines_lit.png"},
inventory_image = "mcl_lush_caves_cave_vines.png", inventory_image = "mcl_lush_caves_cave_vines_lit.png",
wield_image = "mcl_lush_caves_cave_vines.png", wield_image = "mcl_lush_caves_cave_vines_lit.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
}, },
}, },
groups = { shearsy = 1, dig_immediate=3, plant=1, supported_node=0, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, cultivatable=1 }, groups = { shearsy = 1, handy = 1, plant=1, supported_node=0, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1 },
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
_mcl_blast_hardness = 0, _mcl_blast_hardness = 1,
drop = "mcl_lush_caves:glow_berry",
on_dig = function(pos)
minetest.add_item(pos,"mcl_lush_caves:glow_berry")
minetest.set_node(pos,{name="mcl_lush_caves:cave_vines"})
end,
}) })
minetest.register_node("mcl_lush_caves:rooted_dirt", { minetest.register_node("mcl_lush_caves:rooted_dirt", {
@ -178,6 +183,17 @@ minetest.register_node("mcl_lush_caves:rooted_dirt", {
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
}) })
minetest.register_craftitem("mcl_lush_caves:glow_berry", {
description = S("Glow berry"),
_doc_items_longdesc = S("This is a food item which can be eaten."),
stack_max = 64,
inventory_image = "mcl_lush_caves_glow_berries.png",
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
groups = {food = 2, eatable = 2, compostability = 50},
_mcl_saturation = 1.2,
})
minetest.register_decoration({ minetest.register_decoration({
decoration = "mcl_lush_caves:moss", decoration = "mcl_lush_caves:moss",
deco_type = "simple", deco_type = "simple",
@ -220,7 +236,7 @@ minetest.register_decoration({
}) })
minetest.register_decoration({ minetest.register_decoration({
decoration = "mcl_lush_caves:cave_vines_lit", decoration = "mcl_lush_caves:cave_vines",
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_lush_caves:moss"}, place_on = {"mcl_lush_caves:moss"},
sidelen = 80, sidelen = 80,
@ -243,7 +259,7 @@ minetest.register_decoration({
minetest.register_abm({ minetest.register_abm({
label = "Cave vines grow", label = "Cave vines grow",
nodenames = {"mcl_lush_caves:cave_vines_lit"}, nodenames = {"mcl_lush_caves:cave_vines_lit","mcl_lush_caves:cave_vines"},
interval = 5, interval = 5,
chance = 2, chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
@ -251,13 +267,20 @@ minetest.register_abm({
local pun = minetest.get_node(pu).name local pun = minetest.get_node(pu).name
local pd = vector.offset(pos,0,-1,0) local pd = vector.offset(pos,0,-1,0)
local pd2 = minetest.get_node(vector.offset(pos,0,-2,0)).name local pd2 = minetest.get_node(vector.offset(pos,0,-2,0)).name
if pun ~= "mcl_lush_caves:cave_vines_lit" and pun ~= "mcl_lush_caves:moss" then if pun ~= "mcl_lush_caves:cave_vines_lit" and pun ~= "mcl_lush_caves:cave_vines" and pun ~= "mcl_lush_caves:moss" then
minetest.set_node(pos,{name="air"}) minetest.set_node(pos,{name="air"})
return return
end end
if minetest.get_node(pd).name == "air" and pd2 == "air" then node.name = "mcl_lush_caves:cave_vines"
minetest.set_node(pd,{name=node.name}) if math.random(5) == 1 then
node.name="mcl_lush_caves:cave_vines_lit"
end end
if minetest.get_node(pd).name == "air" and pd2 == "air" then
minetest.set_node(pd,node)
else
minetest.set_node(pos,{name="mcl_lush_caves:cave_vines_lit"})
end
end end
}) })