Skip to content
Permalink
Browse files

Flowers: Add sporeless mushrooms and edit drops

  • Loading branch information
paramat committed Aug 14, 2015
1 parent 35de524 commit 408ee69fb8d715ed10870ff3e9ef7262a1f4deb2
Showing with 47 additions and 17 deletions.
  1. +43 −13 mods/flowers/init.lua
  2. +4 −4 mods/flowers/mapgen.lua
@@ -130,11 +130,16 @@ local mushrooms_datas = {
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",
@@ -143,15 +148,15 @@ for _, m in pairs(mushrooms_datas) do
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),
@@ -161,6 +166,31 @@ for _, m in pairs(mushrooms_datas) do
}
})

-- 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, {
@@ -198,9 +228,9 @@ minetest.register_abm({
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
@@ -50,8 +50,8 @@ function flowers.register_mgv6_decorations()
register_mgv6_flower("viola")
register_mgv6_flower("dandelion_white")

register_mgv6_mushroom("mushroom_brown")
register_mgv6_mushroom("mushroom_red")
register_mgv6_mushroom("mushroom_fertile_brown")
register_mgv6_mushroom("mushroom_fertile_red")
end


@@ -112,8 +112,8 @@ function flowers.register_decorations()
register_flower(1133, "viola")
register_flower(73133, "dandelion_white")

register_mushroom("mushroom_brown")
register_mushroom("mushroom_red")
register_mushroom("mushroom_fertile_brown")
register_mushroom("mushroom_fertile_red")
end


0 comments on commit 408ee69

Please sign in to comment.