Flowers: Add sporeless mushrooms and edit drops
authorparamat <mat.gregory@virginmedia.com>
Mon, 10 Aug 2015 10:57:27 +0000 (11:57 +0100)
committerparamat <mat.gregory@virginmedia.com>
Fri, 14 Aug 2015 00:34:35 +0000 (01:34 +0100)
mods/flowers/init.lua
mods/flowers/mapgen.lua

index e705783a503fbbb1cfc085c6ce7f9fa879a4b929..bb2f30112dab0b029091485eb739477b41816e5c 100644 (file)
@@ -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
index e2260a929301ee2d74d576bcae24952331d78d21..5c386e58ad51b391bfbcf426961948e31c705036 100644 (file)
@@ -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