From daac92f3983afd8e1ff63c4043547d03519ef460 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 10 Mar 2016 17:45:55 +0000 Subject: Added barley, tidied and tweaked code --- blueberry.lua | 88 +++++++++++++++++------------------------------------------ 1 file changed, 25 insertions(+), 63 deletions(-) (limited to 'blueberry.lua') diff --git a/blueberry.lua b/blueberry.lua index f785c23..6a29ba9 100644 --- a/blueberry.lua +++ b/blueberry.lua @@ -1,6 +1,5 @@ ---= Blueberries - +-- blueberries minetest.register_craftitem("farming:blueberries", { description = "Blueberries", inventory_image = "farming_blueberries.png", @@ -10,7 +9,7 @@ minetest.register_craftitem("farming:blueberries", { on_use = minetest.item_eat(1), }) --- Blueberry Muffin (Thanks to sosogirl123 for muffin image in deviantart.com) +-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image) minetest.register_craftitem("farming:muffin_blueberry", { description = "Blueberry Muffin", @@ -25,9 +24,8 @@ minetest.register_craft({ } }) --- Define Blueberry growth stages - -minetest.register_node("farming:blueberry_1", { +-- blueberry definition +local crop_def = { drawtype = "plantlike", tiles = {"farming_blueberry_1.png"}, paramtype = "light", @@ -40,64 +38,28 @@ minetest.register_node("farming:blueberry_1", { snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults(), -}) + sounds = default.node_sound_leaves_defaults() +} -minetest.register_node("farming:blueberry_2", { - drawtype = "plantlike", - tiles = {"farming_blueberry_2.png"}, - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults(), -}) +-- stage 1 +minetest.register_node("farming:blueberry_1", table.copy(crop_def)) -minetest.register_node("farming:blueberry_3", { - drawtype = "plantlike", - tiles = {"farming_blueberry_3.png"}, - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults(), -}) +-- stage 2 +crop_def.tiles = {"farming_blueberry_2.png"} +minetest.register_node("farming:blueberry_2", table.copy(crop_def)) --- Last stage of growth does not have growing group so abm never checks these +-- stage 3 +crop_def.tiles = {"farming_blueberry_3.png"} +minetest.register_node("farming:blueberry_3", table.copy(crop_def)) -minetest.register_node("farming:blueberry_4", { - drawtype = "plantlike", - tiles = {"farming_blueberry_4.png"}, - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = { - items = { - {items = {'farming:blueberries 2'}, rarity = 1}, - {items = {'farming:blueberries'}, rarity = 2}, - {items = {'farming:blueberries'}, rarity = 3}, - } - }, - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory=1 - }, - sounds = default.node_sound_leaves_defaults(), -}) \ No newline at end of file +-- stage 4 (final) +crop_def.tiles = {"farming_blueberry_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:blueberries 2'}, rarity = 1}, + {items = {'farming:blueberries'}, rarity = 2}, + {items = {'farming:blueberries'}, rarity = 3}, + } +} +minetest.register_node("farming:blueberry_4", table.copy(crop_def)) -- cgit v1.2.3