Crops appear on v7/v5 maps as well

master
TenPlus1 2015-07-31 16:28:32 +01:00
parent 3d12807ca8
commit 5757896caa
1 changed files with 21 additions and 5 deletions

View File

@ -1,6 +1,4 @@
-- spawn new foods on map
-- decoration function
local function register_plant(name, min, max, spawnby, num)
minetest.register_decoration({
deco_type = "simple",
@ -16,7 +14,7 @@ local function register_plant(name, min, max, spawnby, num)
},
y_min = min,
y_max = max,
decoration = "farming:"..name,
decoration = "farming:" .. name,
spawn_by = spawnby,
num_spawn_by = num,
})
@ -38,8 +36,26 @@ function farming.register_mgv6_decorations()
register_plant("beanbush", 18, 35, "", -1)
end
-- enable in v6 mapgen only
-- v7 maps have a beach so plants growing near water is limited to 6- high
function farming.register_mgv7_decorations()
register_plant("potato_3", 15, 40, "", -1)
register_plant("tomato_7", 5, 20, "", -1)
register_plant("carrot_8", 1, 6, "", -1)
register_plant("cucumber_4", 1, 6, "", -1)
register_plant("corn_7", 12, 22, "", -1)
register_plant("corn_8", 10, 20, "", -1)
register_plant("coffee_5", 20, 45, "", -1)
register_plant("melon_8", 1, 6, "", -1)
register_plant("pumpkin_8", 1, 6, "", -1)
register_plant("raspberry_4", 3, 10, "", -1)
register_plant("rhubarb_3", 3, 15, "group:tree", 1)
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
end
-- detect mapgen
if minetest.get_mapgen_params().mgname == "v6" then
farming.register_mgv6_decorations()
else
farming.register_mgv7_decorations()
end