summaryrefslogtreecommitdiff
path: root/corn.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 /corn.lua
parenta91b9807974440c5a6487a4446ada29e382d7061 (diff)
Added barley, tidied and tweaked code
Diffstat (limited to 'corn.lua')
-rw-r--r--corn.lua202
1 files changed, 58 insertions, 144 deletions
diff --git a/corn.lua b/corn.lua
index dcb0833..4370757 100644
--- a/corn.lua
+++ b/corn.lua
@@ -1,7 +1,10 @@
---= Corn (Original textures from GeMinecraft)
--- http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
+--[[
+ Original textures from GeMinecraft
+ http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
+]]
+-- corn
minetest.register_craftitem("farming:corn", {
description = "Corn",
inventory_image = "farming_corn.png",
@@ -11,8 +14,7 @@ minetest.register_craftitem("farming:corn", {
on_use = minetest.item_eat(3),
})
---= Corn on the Cob (Texture by TenPlus1)
-
+-- corn on the cob (texture by TenPlus1)
minetest.register_craftitem("farming:corn_cob", {
description = "Corn on the Cob",
inventory_image = "farming_corn_cob.png",
@@ -26,8 +28,7 @@ minetest.register_craft({
recipe = "farming:corn"
})
---= Ethanol (Thanks to JKMurray for this idea)
-
+-- ethanol (thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", {
description = "Bottle of Ethanol",
inventory_image = "farming_bottle_ethanol.png",
@@ -48,9 +49,8 @@ minetest.register_craft({
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})
--- Define Corn growth stages
-
-minetest.register_node("farming:corn_1", {
+-- corn definition
+local crop_def = {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
paramtype = "light",
@@ -63,138 +63,52 @@ minetest.register_node("farming:corn_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:corn_2", {
- drawtype = "plantlike",
- tiles = {"farming_corn_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:corn_3", {
- drawtype = "plantlike",
- tiles = {"farming_corn_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:corn_4", {
- drawtype = "plantlike",
- tiles = {"farming_corn_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:corn_5", {
- drawtype = "plantlike",
- tiles = {"farming_corn_5.png"},
- paramtype = "light",
- waving = 1,
- 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:corn_6", {
- drawtype = "plantlike",
- tiles = {"farming_corn_6.png"},
- visual_scale = 1.45,
- paramtype = "light",
- waving = 1,
- 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:corn_7", {
- drawtype = "plantlike",
- tiles = {"farming_corn_7.png"},
- visual_scale = 1.45,
- paramtype = "light",
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:corn'}, rarity = 1},
- {items = {'farming:corn'}, rarity = 2},
- {items = {'farming:corn'}, 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 doesn not have growing group so abm never checks these
-
-minetest.register_node("farming:corn_8", {
- drawtype = "plantlike",
- tiles = {"farming_corn_8.png"},
- visual_scale = 1.45,
- paramtype = "light",
- waving = 1,
- walkable = false,
- buildable_to = true,
- drop = {
- items = {
- {items = {'farming:corn 2'}, rarity = 1},
- {items = {'farming:corn 2'}, rarity = 2},
- {items = {'farming:corn 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:corn_1", table.copy(crop_def))
+
+-- stage 2
+crop_def.tiles = {"farming_corn_2.png"}
+minetest.register_node("farming:corn_2", table.copy(crop_def))
+
+-- stage 3
+crop_def.tiles = {"farming_corn_3.png"}
+minetest.register_node("farming:corn_3", table.copy(crop_def))
+
+-- stage 4
+crop_def.tiles = {"farming_corn_4.png"}
+minetest.register_node("farming:corn_4", table.copy(crop_def))
+
+-- stage 5
+crop_def.tiles = {"farming_corn_5.png"}
+minetest.register_node("farming:corn_5", table.copy(crop_def))
+
+-- stage 6
+crop_def.tiles = {"farming_corn_6.png"}
+crop_def.visual_scale = 1.45
+minetest.register_node("farming:corn_6", table.copy(crop_def))
+
+-- stage 7
+crop_def.tiles = {"farming_corn_7.png"}
+crop_def.drop = {
+ items = {
+ {items = {'farming:corn'}, rarity = 1},
+ {items = {'farming:corn'}, rarity = 2},
+ {items = {'farming:corn'}, rarity = 3},
+ }
+}
+minetest.register_node("farming:corn_7", table.copy(crop_def))
+
+-- stage 8 (final)
+crop_def.tiles = {"farming_corn_8.png"}
+crop_def.groups.growing = 0
+crop_def.drop = {
+ items = {
+ {items = {'farming:corn 2'}, rarity = 1},
+ {items = {'farming:corn 2'}, rarity = 2},
+ {items = {'farming:corn 2'}, rarity = 2},
+ }
+}
+minetest.register_node("farming:corn_8", table.copy(crop_def))