From 023d0303c1c01508039c1de0b79c5b86e21cefb1 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sat, 4 Jul 2015 12:22:39 +0100 Subject: Code tidy and fixed fruit not dropping --- mushroom.lua | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'mushroom.lua') diff --git a/mushroom.lua b/mushroom.lua index a09060e..31b4e09 100644 --- a/mushroom.lua +++ b/mushroom.lua @@ -1,7 +1,7 @@ -- Mushroom Spores minetest.register_craftitem("ethereal:mushroom_craftingitem", { description = "Mushroom Spores", - groups = {not_in_creative_inventory=1}, + 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") @@ -14,13 +14,16 @@ minetest.register_node("ethereal:mushroom_plant", { 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}}, + 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}, + groups = {snappy = 2, dig_immediate = 3, flammable = 2}, sounds = default.node_sound_defaults(), on_use = minetest.item_eat(1), }) @@ -65,12 +68,18 @@ local ndef = { buildable_to = true, drop = { items = { - {items = {"ethereal:mushroom_craftingitem"},rarity=1}, - {items = {"ethereal:mushroom_plant"},rarity=14}, + {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}, + 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(), } minetest.register_node("ethereal:mushroom_1", table.copy(ndef)) @@ -81,13 +90,13 @@ ndef.groups.mushroom = 2 minetest.register_node("ethereal:mushroom_2", table.copy(ndef)) ndef.tiles[1] = "ethereal_mushroom_garden_3.png" -ndef.drop.items[2] = {items = {"ethereal:mushroom_plant 3"},rarity=3} +ndef.drop.items[2] = {items = {"ethereal:mushroom_plant 3"}, rarity = 3} ndef.groups.mushroom = 3 minetest.register_node("ethereal:mushroom_3", table.copy(ndef)) 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.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)) @@ -107,11 +116,11 @@ minetest.register_abm({ end -- check if on wet soil - pos.y = pos.y-1 + 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 + pos.y = pos.y + 1 -- check light local light = minetest.get_node_light(pos) @@ -121,20 +130,18 @@ minetest.register_abm({ end -- grow - node.name = "ethereal:mushroom_garden_" .. minetest.get_item_group(node.name, "mushroom") + 1 + node.name = "ethereal:mushroom_garden_"..minetest.get_item_group(node.name, "mushroom") + 1 minetest.set_node(pos, node) end }) end - -- legacy - -for i = 1,4 do +for i = 1, 4 do minetest.register_alias("ethereal:mushroom_garden_"..i, "ethereal:mushroom_"..i) end -- Temporary compatibility lines for Xanadu server minetest.register_alias("ethereal:mushroom_7", "ethereal:mushroom_3") -minetest.register_alias("ethereal:mushroom_8", "ethereal:mushroom_4") +minetest.register_alias("ethereal:mushroom_8", "ethereal:mushroom_4") \ No newline at end of file -- cgit v1.2.3