Abstract crops.register method a bit.
This commit is contained in:
parent
bcf27ebd99
commit
7ba94da27a
8
corn.lua
8
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 })
|
||||
|
||||
|
4
init.lua
4
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)
|
||||
|
12
melon.lua
12
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 })
|
||||
|
10
polebean.lua
10
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 })
|
||||
|
||||
|
@ -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 })
|
||||
|
10
tomato.lua
10
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 })
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user