From 7b3deef14a3d8a9acd95d22c2ac472453eeb5c35 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 30 Sep 2015 16:24:13 +0100 Subject: Switched farmed shrooms for default mt shrooms --- mushroom.lua | 250 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 125 insertions(+), 125 deletions(-) (limited to 'mushroom.lua') diff --git a/mushroom.lua b/mushroom.lua index 31b4e09..2b4703b 100644 --- a/mushroom.lua +++ b/mushroom.lua @@ -1,147 +1,147 @@ --- Mushroom Spores -minetest.register_craftitem("ethereal:mushroom_craftingitem", { - description = "Mushroom Spores", - groups = {not_in_creative_inventory = 1}, - inventory_image = "mushroom_spores.png", - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:mushroom_garden_1") - end, -}) --- Mushroom Plant (Must be farmed to become edible) -minetest.register_node("ethereal:mushroom_plant", { - description = "Mushroom (edible)", - drawtype = "plantlike", - tiles = {"mushroom.png"}, - inventory_image = "mushroom.png", - selection_box = { - type = "fixed", - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} - }, - drop = "ethereal:mushroom_craftingitem", - wield_image = "mushroom.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - groups = {snappy = 2, dig_immediate = 3, flammable = 2}, - sounds = default.node_sound_defaults(), - on_use = minetest.item_eat(1), -}) +-- does flowers:mushroom_red exists? +-- if not then create temporary shroom stuff --- Mushroom Soup (Heals 1 heart) -minetest.register_craftitem("ethereal:mushroom_soup", { - description = "Mushroom Soup", - inventory_image = "mushroom_soup.png", - on_use = minetest.item_eat(2, "ethereal:bowl"), -}) +if minetest.registered_nodes["flowers:mushroom_red"] then -minetest.register_craft({ - output = "ethereal:mushroom_soup", - recipe = { - {"ethereal:mushroom_plant", ""}, - {"ethereal:mushroom_plant", ""}, - {"ethereal:bowl", ""}, - } -}) + print ("[Ethereal] Using current mushrooms in flowers mod") --- Cooked Mushroom Soup (Heals 1 and half heart) -minetest.register_craftitem("ethereal:mushroom_soup_cooked", { - description = "Mushroom Soup Cooked", - inventory_image = "mushroom_soup_cooked.png", - on_use = minetest.item_eat(3, "ethereal:bowl"), -}) +else -minetest.register_craft({ - type = "cooking", - cooktime = 10, - output = "ethereal:mushroom_soup_cooked", - recipe = "ethereal:mushroom_soup" -}) + print ("[Ethereal] Defining temporary mushrooms") --- Define Mushroom growth stages -local ndef = { - drawtype = "plantlike", - tiles = {"ethereal_mushroom_garden_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = { - items = { - {items = {"ethereal:mushroom_craftingitem"},rarity = 1}, - {items = {"ethereal:mushroom_plant"},rarity = 14}, - } - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} - }, - groups = { - snappy = 3, flammable = 2, plant = 1, mushroom = 1, - attached_node = 1, growing = 1, not_in_creative_inventory = 1 - }, - sounds = default.node_sound_leaves_defaults(), +-- The following code was taken from minetest 0.4.13's flowers mod +-- incase players are using older version of minetest + +local mushrooms_datas = { + {"brown", 2}, + {"red", -6} } -minetest.register_node("ethereal:mushroom_1", table.copy(ndef)) -ndef.tiles[1] = "ethereal_mushroom_garden_2.png" -ndef.drop.items[2].rarity = 7 -ndef.groups.mushroom = 2 -minetest.register_node("ethereal:mushroom_2", table.copy(ndef)) +for _, m in pairs(mushrooms_datas) do + local name, nut = m[1], m[2] + + -- Register fertile mushrooms (these spawn on map and drop spores) + + 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) + + 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 -ndef.tiles[1] = "ethereal_mushroom_garden_3.png" -ndef.drop.items[2] = {items = {"ethereal:mushroom_plant 3"}, rarity = 3} -ndef.groups.mushroom = 3 -minetest.register_node("ethereal:mushroom_3", table.copy(ndef)) + 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 -ndef.tiles[1] = "ethereal_mushroom_garden_4.png" -ndef.drop.items[2].rarity = 1 -ndef.drop.items[3] = {items = {"ethereal:mushroom_plant 3"}, rarity = 7} -ndef.groups.mushroom = 4 -ndef.groups.growing = nil -minetest.register_node("ethereal:mushroom_4", table.copy(ndef)) +end -- END if red mushroom exists already --- Abm for growing Mushroom -if farming.mod ~= "redo" then +-- Register growing ABM minetest.register_abm({ - nodenames = {"group:mushroom"}, - neighbors = {"farming:soil_wet"}, - interval = 30, - chance = 2, + nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"}, + interval = 11, + chance = 50, action = function(pos, node) - -- return if already full grown - if minetest.get_item_group(node.name, "growing") < 1 then + local node_under = minetest.get_node_or_nil({x = pos.x, + y = pos.y - 1, z = pos.z}) + if not node_under then return end - - -- check if on wet soil - pos.y = pos.y - 1 - if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then - return - end - pos.y = pos.y + 1 - - -- check light - local light = minetest.get_node_light(pos) - if not light - or light < 5 then - return + 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 end - - -- grow - node.name = "ethereal:mushroom_garden_"..minetest.get_item_group(node.name, "mushroom") + 1 - minetest.set_node(pos, node) end }) -end +-- set compatibility with old ethereal shrooms +minetest.register_alias("ethereal:mushroom_craftingitem", "flowers:mushroom_spores_brown") +minetest.register_alias("ethereal:mushroom_plant", "flowers:mushroom_brown") +minetest.register_alias("ethereal:mushroom_soup_cooked", "ethereal:mushroom_soup") +minetest.register_alias("ethereal:mushroom_1", "flowers:mushroom_spores_brown") +minetest.register_alias("ethereal:mushroom_2", "flowers:mushroom_spores_brown") +minetest.register_alias("ethereal:mushroom_3", "flowers:mushroom_fertile_brown") +minetest.register_alias("ethereal:mushroom_4", "flowers:mushroom_fertile_brown") --- legacy -for i = 1, 4 do - minetest.register_alias("ethereal:mushroom_garden_"..i, "ethereal:mushroom_"..i) -end +-- mushroom soup (Heals 1 heart) +minetest.register_craftitem("ethereal:mushroom_soup", { + description = "Mushroom Soup", + inventory_image = "mushroom_soup.png", + on_use = minetest.item_eat(5, "ethereal:bowl"), +}) --- Temporary compatibility lines for Xanadu server -minetest.register_alias("ethereal:mushroom_7", "ethereal:mushroom_3") -minetest.register_alias("ethereal:mushroom_8", "ethereal:mushroom_4") \ No newline at end of file +minetest.register_craft({ + output = "ethereal:mushroom_soup", + recipe = { + {"flowers:mushroom_brown"}, + {"flowers:mushroom_brown"}, + {"ethereal:bowl"}, + } +}) -- cgit v1.2.3