diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-03-10 17:45:55 +0000 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-03-10 17:45:55 +0000 |
commit | daac92f3983afd8e1ff63c4043547d03519ef460 (patch) | |
tree | 4dd7ae04f10559a5a54cc93095db49922f3f28e0 /cucumber.lua | |
parent | a91b9807974440c5a6487a4446ada29e382d7061 (diff) |
Added barley, tidied and tweaked code
Diffstat (limited to 'cucumber.lua')
-rw-r--r-- | cucumber.lua | 93 |
1 files changed, 31 insertions, 62 deletions
diff --git a/cucumber.lua b/cucumber.lua index 6a1bbab..22e367b 100644 --- a/cucumber.lua +++ b/cucumber.lua @@ -1,7 +1,10 @@ ---= Cucumber (Original textures from DocFarming mod) --- https://forum.minetest.net/viewtopic.php?id=3948 +--[[ + Original textures from DocFarming mod + https://forum.minetest.net/viewtopic.php?id=3948 +]] +-- cucumber minetest.register_craftitem("farming:cucumber", { description = "Cucumber", inventory_image = "farming_cucumber.png", @@ -11,9 +14,8 @@ minetest.register_craftitem("farming:cucumber", { on_use = minetest.item_eat(4), }) --- Define Cucumber growth stages - -minetest.register_node("farming:cucumber_1", { +-- cucumber definition +local crop_def = { drawtype = "plantlike", tiles = {"farming_cucumber_1.png"}, paramtype = "light", @@ -25,60 +27,27 @@ minetest.register_node("farming:cucumber_1", { snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults(), -}) - -minetest.register_node("farming:cucumber_2", { - drawtype = "plantlike", - tiles = {"farming_cucumber_2.png"}, - paramtype = "light", - 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(), -}) - -minetest.register_node("farming:cucumber_3", { - drawtype = "plantlike", - tiles = {"farming_cucumber_3.png"}, - paramtype = "light", - 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(), -}) - --- Last stage of growth does not have growing group so abm never checks these - -minetest.register_node("farming:cucumber_4", { - drawtype = "plantlike", - tiles = {"farming_cucumber_4.png"}, - paramtype = "light", - waving = 1, - walkable = false, - buildable_to = true, - drop = { - items = { - {items = {'farming:cucumber'}, rarity = 1}, - {items = {'farming:cucumber 2'}, rarity = 2}, - } - }, - 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 + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:cucumber_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_cucumber_2.png"} +minetest.register_node("farming:cucumber_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_cucumber_3.png"} +minetest.register_node("farming:cucumber_3", table.copy(crop_def)) + +-- stage 4 (final) +crop_def.tiles = {"farming_cucumber_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:cucumber'}, rarity = 1}, + {items = {'farming:cucumber 2'}, rarity = 2}, + } +} +minetest.register_node("farming:cucumber_4", table.copy(crop_def)) |