summaryrefslogtreecommitdiff
path: root/wheat.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2016-03-10 17:45:55 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2016-03-10 17:45:55 +0000
commitdaac92f3983afd8e1ff63c4043547d03519ef460 (patch)
tree4dd7ae04f10559a5a54cc93095db49922f3f28e0 /wheat.lua
parenta91b9807974440c5a6487a4446ada29e382d7061 (diff)
Added barley, tidied and tweaked code
Diffstat (limited to 'wheat.lua')
-rw-r--r--wheat.lua235
1 files changed, 68 insertions, 167 deletions
diff --git a/wheat.lua b/wheat.lua
index d2bad0d..c19ac27 100644
--- a/wheat.lua
+++ b/wheat.lua
@@ -1,16 +1,5 @@
---= Wheat
-
--- Wheat Seed
-
---minetest.register_craftitem("farming:seed_wheat", {
--- description = "Wheat Seed",
--- inventory_image = "farming_wheat_seed.png",
--- on_place = function(itemstack, placer, pointed_thing)
--- return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
--- end,
---})
-
+-- wheat seeds
minetest.register_node("farming:seed_wheat", {
description = "Wheat Seed",
tiles = {"farming_wheat_seed.png"},
@@ -28,15 +17,13 @@ minetest.register_node("farming:seed_wheat", {
end,
})
--- Harvested Wheat
-
+-- harvested wheat
minetest.register_craftitem("farming:wheat", {
description = "Wheat",
inventory_image = "farming_wheat.png",
})
--- Straw
-
+-- straw
minetest.register_node("farming:straw", {
description = "Straw",
tiles = {"farming_straw.png"},
@@ -62,7 +49,6 @@ minetest.register_craft({
})
-- flour
-
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
@@ -74,8 +60,7 @@ minetest.register_craft({
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
--- Bread
-
+-- bread
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
@@ -89,9 +74,8 @@ minetest.register_craft({
recipe = "farming:flour"
})
--- Define Wheat growth stages
-
-minetest.register_node("farming:wheat_1", {
+-- wheat definition
+local crop_def = {
drawtype = "plantlike",
tiles = {"farming_wheat_1.png"},
paramtype = "light",
@@ -102,150 +86,67 @@ minetest.register_node("farming:wheat_1", {
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:wheat_2", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_2.png"},
- paramtype = "light",
- sunlight_propagates = true,
- 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:wheat_3", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_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(),
-})
-
-minetest.register_node("farming:wheat_4", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_4.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(),
-})
-
-minetest.register_node("farming:wheat_5", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_5.png"},
- paramtype = "light",
- sunlight_propagates = true,
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:wheat'}, rarity = 2},
- {items = {'farming:seed_wheat'}, rarity = 2},
- }
- },
- 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:wheat_6", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_6.png"},
- paramtype = "light",
- sunlight_propagates = true,
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:wheat'}, rarity = 2},
- {items = {'farming:seed_wheat'}, rarity = 1},
- }
- },
- 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:wheat_7", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_7.png"},
- paramtype = "light",
- sunlight_propagates = true,
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:wheat'}, rarity = 1},
- {items = {'farming:wheat'}, rarity = 3},
- {items = {'farming:seed_wheat'}, rarity = 1},
- {items = {'farming:seed_wheat'}, rarity = 3},
- }
- },
- 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:wheat_8", {
- drawtype = "plantlike",
- tiles = {"farming_wheat_8.png"},
- paramtype = "light",
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:wheat'}, rarity = 1},
- {items = {'farming:wheat'}, rarity = 2},
- {items = {'farming:seed_wheat'}, rarity = 1},
- {items = {'farming:seed_wheat'}, 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:wheat_1", table.copy(crop_def))
+
+-- stage 2
+crop_def.tiles = {"farming_wheat_2.png"}
+minetest.register_node("farming:wheat_2", table.copy(crop_def))
+
+-- stage 3
+crop_def.tiles = {"farming_wheat_3.png"}
+minetest.register_node("farming:wheat_3", table.copy(crop_def))
+
+-- stage 4
+crop_def.tiles = {"farming_wheat_4.png"}
+minetest.register_node("farming:wheat_4", table.copy(crop_def))
+
+-- stage 5
+crop_def.tiles = {"farming_wheat_5.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:wheat'}, rarity = 2},
+ {items = {'farming:seed_wheat'}, rarity = 2},
+ }
+}
+minetest.register_node("farming:wheat_5", table.copy(crop_def))
+
+-- stage 6
+crop_def.tiles = {"farming_wheat_6.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:wheat'}, rarity = 2},
+ {items = {'farming:seed_wheat'}, rarity = 1},
+ }
+}
+minetest.register_node("farming:wheat_6", table.copy(crop_def))
+
+-- stage 7
+crop_def.tiles = {"farming_wheat_7.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:wheat'}, rarity = 1},
+ {items = {'farming:wheat'}, rarity = 3},
+ {items = {'farming:seed_wheat'}, rarity = 1},
+ {items = {'farming:seed_wheat'}, rarity = 3},
+ }
+}
+minetest.register_node("farming:wheat_7", table.copy(crop_def))
+
+-- stage 8 (final)
+crop_def.tiles = {"farming_wheat_8.png"}
+crop_def.groups.growing = 0
+crop_def.drop = {
+ items = {
+ {items = {'farming:wheat'}, rarity = 1},
+ {items = {'farming:wheat'}, rarity = 3},
+ {items = {'farming:seed_wheat'}, rarity = 1},
+ {items = {'farming:seed_wheat'}, rarity = 3},
+ }
+}
+minetest.register_node("farming:wheat_8", table.copy(crop_def))