From 32bdb9a393754464d9baece64e1a3e93d0e29981 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 14 Dec 2015 23:53:27 -0800 Subject: [PATCH] Remove spores from mushrooms. These have almost no value gameplay wise. Mushrooms spread by their very nature into appropriate soil nearby, and harvesting spores is something only scientists do. Actual mushroom farmers leave a few mushrooms and put on more manure, and keep the light off. Modify the growth ABM to test for light levels and attempt to plant a similar mushroom nearby (+/- 2 x,z, +/- y). Light at both source and destination needs to be low enough. I've tuned it to be 3-4 spaces from a torch. Mushrooms will die in full sunlight, but they can survive under trees and may grow out at night anywhere. Removed obsolete textures. Remove unused nodes and provide aliases for them. Aliased obsolete nodes so no unknown item nodes appear. Mushrooms die only in full sunlight (light level 15). --- mods/flowers/init.lua | 164 +++++++----------- .../flowers_mushroom_spores_brown.png | Bin 94 -> 0 bytes .../textures/flowers_mushroom_spores_red.png | Bin 92 -> 0 bytes 3 files changed, 64 insertions(+), 100 deletions(-) delete mode 100644 mods/flowers/textures/flowers_mushroom_spores_brown.png delete mode 100644 mods/flowers/textures/flowers_mushroom_spores_red.png diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index e8899efd..dd8e031d 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -124,120 +124,84 @@ minetest.register_abm({ -- Mushrooms -- -local mushrooms_datas = { - {"brown", 2}, - {"red", -6} -} - -for _, m in pairs(mushrooms_datas) do - local name, nut = m[1], m[2] - - -- Register fertile mushrooms - - -- 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) .. " Fertile 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, - not_in_creative_inventory = 1}, - drop = { - items = { - {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), - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} - } - }) - - -- 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, { - description = string.sub(string.upper(name), 0, 1) .. - string.sub(name, 2) .. " Mushroom Spores", - drawtype = "signlike", - tiles = {"flowers_mushroom_spores_" .. name .. ".png"}, - inventory_image = "flowers_mushroom_spores_" .. name .. ".png", - wield_image = "flowers_mushroom_spores_" .. name .. ".png", - paramtype = "light", - paramtype2 = "wallmounted", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - selection_box = { - type = "wallmounted", - }, - groups = {dig_immediate = 3, attached_node = 1}, - }) -end - +minetest.register_node("flowers:mushroom_red", { + description = "Red Mushroom", + tiles = {"flowers_mushroom_red.png"}, + inventory_image = "flowers_mushroom_red.png", + wield_image = "flowers_mushroom_red.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(-5), + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + } +}) --- Register growing ABM +minetest.register_node("flowers:mushroom_brown", { + description = "Brown Mushroom", + tiles = {"flowers_mushroom_brown.png"}, + inventory_image = "flowers_mushroom_brown.png", + wield_image = "flowers_mushroom_brown.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(1), + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + } +}) +-- mushroom spread and death minetest.register_abm({ - nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"}, + nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, interval = 11, chance = 50, action = function(pos, node) - local node_under = minetest.get_node_or_nil({x = pos.x, - y = pos.y - 1, z = pos.z}) + if minetest.get_node_light(pos, nil) == 15 then + minetest.remove_node(pos) + end + local random = { + x = pos.x + math.random(-2,2), + y = pos.y + math.random(-1,1), + z = pos.z + math.random(-2,2) + } + local random_node = minetest.get_node_or_nil(random) + if not random_node then + return + end + if random_node.name ~= "air" then + return + end + local node_under = minetest.get_node_or_nil({x = random.x, + y = random.y - 1, z = random.z}) if not node_under then return end 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_fertile_brown"}) - elseif node.name == "flowers:mushroom_spores_red" then - minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"}) - end + minetest.get_node_light(pos, nil) <= 9 and + minetest.get_node_light(random, nil) <= 9 then + minetest.set_node(random, {name = node.name}) end end }) +-- these old mushroom related nodes can be simplified now +minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red") +minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red") + -- -- Waterlily diff --git a/mods/flowers/textures/flowers_mushroom_spores_brown.png b/mods/flowers/textures/flowers_mushroom_spores_brown.png deleted file mode 100644 index a0818d23f0a2f7a3f2c25f61b44e34a002d3e9dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 94 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`s-7;6Ar_~T6D00EsA4)?|4Z7V rG`c;bL1=Nsgm%$gpW6zrG%+wN?-JbD?;~yp)WG2B>gTe~DWM4fXE7Wj diff --git a/mods/flowers/textures/flowers_mushroom_spores_red.png b/mods/flowers/textures/flowers_mushroom_spores_red.png deleted file mode 100644 index 1f1d3a4592af275bb1dd00dcfea73cd3094ca8c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`%APKcAr_~T6D00Eu$Q=a+hNsh qD;MS|5=WbD)?Aot-m_SYg~6(q|KstWS9pQS89ZJ6T-G@yGywoBP#ent -- 2.25.1