for _, m in pairs(mushrooms_datas) do
local name, nut = m[1], m[2]
- -- Register mushrooms
+ -- Register fertile mushrooms
- minetest.register_node("flowers:mushroom_" .. name, {
+ -- These are placed by mapgen and the growing ABM.
+ -- These drop an infertile mushroom, and 0 to 3 spore
+ -- nodes with an average of 1.25 per mushroom, for
+ -- a slow multiplication of mushrooms when farming.
+
+ minetest.register_node("flowers:mushroom_fertile_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
- string.sub(name, 2) .. " Mushroom",
+ string.sub(name, 2) .. " Fertile Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
- groups = {snappy = 3, flammable = 3, attached_node = 1},
+ groups = {snappy = 3, flammable = 3, attached_node = 1,
+ not_in_creative_inventory = 1},
drop = {
- max_items = 1,
items = {
- {items = {"flowers:mushroom_" .. name}, rarity = 2,},
- {items = {"flowers:mushroom_spores_" .. name}, rarity = 3,},
- {items = {"flowers:mushroom_spores_" .. name .. " 2"}, rarity = 2,},
- {items = {"flowers:mushroom_spores_" .. name .. " 3"}, rarity = 2,},
- },
+ {items = {"flowers:mushroom_" .. name}},
+ {items = {"flowers:mushroom_spores_" .. name}, rarity = 4},
+ {items = {"flowers:mushroom_spores_" .. name}, rarity = 2},
+ {items = {"flowers:mushroom_spores_" .. name}, rarity = 2}
+ }
},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
}
})
+ -- Register infertile mushrooms
+
+ -- These do not drop spores, to avoid the use of repeated digging
+ -- and placing of a single mushroom to generate unlimited spores.
+
+ minetest.register_node("flowers:mushroom_" .. name, {
+ description = string.sub(string.upper(name), 0, 1) ..
+ string.sub(name, 2) .. " Mushroom",
+ tiles = {"flowers_mushroom_" .. name .. ".png"},
+ inventory_image = "flowers_mushroom_" .. name .. ".png",
+ wield_image = "flowers_mushroom_" .. name .. ".png",
+ drawtype = "plantlike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ buildable_to = true,
+ groups = {snappy = 3, flammable = 3, attached_node = 1},
+ sounds = default.node_sound_leaves_defaults(),
+ on_use = minetest.item_eat(nut),
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
+ }
+ })
+
-- Register mushroom spores
minetest.register_node("flowers:mushroom_spores_" .. name, {
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then
if node.name == "flowers:mushroom_spores_brown" then
- minetest.set_node(pos, {name = "flowers:mushroom_brown"})
- else
- minetest.set_node(pos, {name = "flowers:mushroom_red"})
+ minetest.set_node(pos, {name = "flowers:mushroom_fertile_brown"})
+ elseif node.name == "flowers:mushroom_spores_red" then
+ minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"})
end
end
end