summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-05-07 23:40:14 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2015-05-07 23:40:14 -0700
commit7ba94da27aedf69bb8301455af10f73d992a3f47 (patch)
treefffbc04b5c8535eafaec2c243453e73536572130
parentbcf27ebd99a3826982fd40da2981f7f459ee5205 (diff)
Abstract crops.register method a bit.
-rw-r--r--corn.lua8
-rw-r--r--init.lua4
-rw-r--r--melon.lua12
-rw-r--r--polebean.lua10
-rw-r--r--potato.lua8
-rw-r--r--tomato.lua10
6 files changed, 28 insertions, 24 deletions
diff --git a/corn.lua b/corn.lua
index 1ea5a10..253120b 100644
--- a/corn.lua
+++ b/corn.lua
@@ -336,8 +336,8 @@ local properties = {
doublesize = true,
}
-table.insert(crops.plants, { name = "crops:corn_base_seed", properties = properties })
-table.insert(crops.plants, { name = "crops:corn_base_1", properties = properties })
-table.insert(crops.plants, { name = "crops:corn_base_2", properties = properties })
-table.insert(crops.plants, { name = "crops:corn_base_3", properties = properties })
+crops.register({ name = "crops:corn_base_seed", properties = properties })
+crops.register({ name = "crops:corn_base_1", properties = properties })
+crops.register({ name = "crops:corn_base_2", properties = properties })
+crops.register({ name = "crops:corn_base_3", properties = properties })
diff --git a/init.lua b/init.lua
index f9400ed..ea5ae04 100644
--- a/init.lua
+++ b/init.lua
@@ -101,6 +101,10 @@ local find_plant = function(node)
return nil
end
+crops.register = function(plantdef)
+ table.insert(crops.plants, plantdef)
+end
+
crops.plant = function(pos, node)
minetest.set_node(pos, node)
local meta = minetest.get_meta(pos)
diff --git a/melon.lua b/melon.lua
index 23ea5e5..209b3a7 100644
--- a/melon.lua
+++ b/melon.lua
@@ -235,9 +235,9 @@ local properties = {
wither_damage = 10,
}
-table.insert(crops.plants, { name = "crops:melon_plant_1", properties = properties })
-table.insert(crops.plants, { name = "crops:melon_plant_2", properties = properties })
-table.insert(crops.plants, { name = "crops:melon_plant_3", properties = properties })
-table.insert(crops.plants, { name = "crops:melon_plant_4", properties = properties })
-table.insert(crops.plants, { name = "crops:melon_plant_5", properties = properties })
-table.insert(crops.plants, { name = "crops:melon_plant_5_attached", properties = properties })
+crops.register({ name = "crops:melon_plant_1", properties = properties })
+crops.register({ name = "crops:melon_plant_2", properties = properties })
+crops.register({ name = "crops:melon_plant_3", properties = properties })
+crops.register({ name = "crops:melon_plant_4", properties = properties })
+crops.register({ name = "crops:melon_plant_5", properties = properties })
+crops.register({ name = "crops:melon_plant_5_attached", properties = properties })
diff --git a/polebean.lua b/polebean.lua
index 587f04f..ee1d22d 100644
--- a/polebean.lua
+++ b/polebean.lua
@@ -293,9 +293,9 @@ local properties = {
doublesize = true,
}
-table.insert(crops.plants, { name = "crops:beanpole_plant_base_1", properties = properties })
-table.insert(crops.plants, { name = "crops:beanpole_plant_base_2", properties = properties })
-table.insert(crops.plants, { name = "crops:beanpole_plant_base_3", properties = properties })
-table.insert(crops.plants, { name = "crops:beanpole_plant_base_4", properties = properties })
-table.insert(crops.plants, { name = "crops:beanpole_plant_base_5", properties = properties })
+crops.register({ name = "crops:beanpole_plant_base_1", properties = properties })
+crops.register({ name = "crops:beanpole_plant_base_2", properties = properties })
+crops.register({ name = "crops:beanpole_plant_base_3", properties = properties })
+crops.register({ name = "crops:beanpole_plant_base_4", properties = properties })
+crops.register({ name = "crops:beanpole_plant_base_5", properties = properties })
diff --git a/potato.lua b/potato.lua
index cb2108e..248957b 100644
--- a/potato.lua
+++ b/potato.lua
@@ -182,7 +182,7 @@ local properties = {
wither_damage = 10,
}
-table.insert(crops.plants, { name = "crops:potato_plant_1", properties = properties })
-table.insert(crops.plants, { name = "crops:potato_plant_2", properties = properties })
-table.insert(crops.plants, { name = "crops:potato_plant_3", properties = properties })
-table.insert(crops.plants, { name = "crops:potato_plant_4", properties = properties })
+crops.register({ name = "crops:potato_plant_1", properties = properties })
+crops.register({ name = "crops:potato_plant_2", properties = properties })
+crops.register({ name = "crops:potato_plant_3", properties = properties })
+crops.register({ name = "crops:potato_plant_4", properties = properties })
diff --git a/tomato.lua b/tomato.lua
index 5234152..77ab866 100644
--- a/tomato.lua
+++ b/tomato.lua
@@ -182,9 +182,9 @@ local properties = {
wither = 20,
wither_damage = 10,
}
-table.insert(crops.plants, { name = "crops:tomato_plant_1", properties = properties })
-table.insert(crops.plants, { name = "crops:tomato_plant_2", properties = properties })
-table.insert(crops.plants, { name = "crops:tomato_plant_3", properties = properties })
-table.insert(crops.plants, { name = "crops:tomato_plant_4", properties = properties })
-table.insert(crops.plants, { name = "crops:tomato_plant_5", properties = properties })
+crops.register({ name = "crops:tomato_plant_1", properties = properties })
+crops.register({ name = "crops:tomato_plant_2", properties = properties })
+crops.register({ name = "crops:tomato_plant_3", properties = properties })
+crops.register({ name = "crops:tomato_plant_4", properties = properties })
+crops.register({ name = "crops:tomato_plant_5", properties = properties })