Abstract crops.register method a bit.

This commit is contained in:
Auke Kok 2015-05-07 23:40:14 -07:00
parent bcf27ebd99
commit 7ba94da27a
6 changed files with 28 additions and 24 deletions

View File

@ -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 })

View File

@ -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)

View File

@ -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 })

View File

@ -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 })

View File

@ -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 })

View File

@ -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 })