farming/mapgen.lua

139 lines
3.5 KiB
Lua
Raw Normal View History

2017-04-28 19:40:57 +02:00
2015-07-31 17:28:32 +02:00
-- decoration function
2017-04-28 19:40:57 +02:00
local function register_plant(name, min, max, spawnby, num, enabled)
if enabled ~= true then
return
end
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
2017-08-14 19:42:03 +02:00
scale = farming.rarety, -- 0.006,
2015-07-05 11:54:18 +02:00
spread = {x = 100, y = 100, z = 100},
seed = 329,
octaves = 3,
persist = 0.6
},
y_min = min,
y_max = max,
2015-07-31 17:28:32 +02:00
decoration = "farming:" .. name,
spawn_by = spawnby,
num_spawn_by = num,
})
end
2015-03-20 15:00:56 +01:00
2017-04-28 19:40:57 +02:00
-- add crops to mapgen
register_plant("potato_3", 15, 40, "", -1, farming.potato)
register_plant("tomato_7", 5, 20, "", -1, farming.tomato)
register_plant("corn_7", 12, 22, "", -1, farming.corn)
register_plant("coffee_5", 20, 45, "", -1, farming.coffee)
register_plant("raspberry_4", 3, 10, "", -1, farming.raspberry)
register_plant("rhubarb_3", 3, 15, "", -1, farming.rhubarb)
register_plant("blueberry_4", 3, 10, "", -1, farming.blueberry)
register_plant("beanbush", 18, 35, "", -1, farming.beans)
register_plant("grapebush", 25, 45, "", -1, farming.grapes)
2018-01-22 16:08:16 +01:00
register_plant("onion_5", 5, 22, "", -1, farming.onion)
register_plant("garlic_5", 3, 30, "group:tree", 1, farming.garlic)
2017-04-28 19:40:57 +02:00
2017-10-09 12:32:00 +02:00
if minetest.get_mapgen_setting("mg_name") == "v6" then
2017-04-28 19:40:57 +02:00
register_plant("carrot_8", 1, 30, "group:water", 1, farming.carrot)
register_plant("cucumber_4", 1, 20, "group:water", 1, farming.cucumber)
register_plant("melon_8", 1, 20, "group:water", 1, farming.melon)
register_plant("pumpkin_8", 1, 20, "group:water", 1, farming.pumpkin)
else
-- v7 maps have a beach so plants growing near water is limited to 6 high
register_plant("carrot_8", 1, 15, "", -1, farming.carrot)
register_plant("cucumber_4", 1, 10, "", -1, farming.cucumber)
2017-04-28 19:40:57 +02:00
register_plant("melon_8", 1, 6, "", -1, farming.melon)
register_plant("pumpkin_8", 1, 6, "", -1, farming.pumpkin)
2015-07-31 17:28:32 +02:00
end
2015-03-20 15:00:56 +01:00
2017-04-28 19:40:57 +02:00
if farming.hemp then
2017-04-08 12:00:12 +02:00
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety + 0.001, -- 0.06,
2017-04-08 12:00:12 +02:00
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.6
},
y_min = 3,
y_max = 45,
2017-04-08 12:00:12 +02:00
decoration = "farming:hemp_7",
spawn_by = "group:tree",
num_spawn_by = 1,
})
2016-08-14 10:27:38 +02:00
end
2017-08-31 13:14:54 +02:00
if farming.chili then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 760,
octaves = 3,
persist = 0.6
},
y_min = 5,
y_max = 35,
decoration = {"farming:chili_8"},
spawn_by = "group:tree",
num_spawn_by = 1,
})
end
2018-01-22 16:08:16 +01:00
if farming.pepper then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 933,
octaves = 3,
persist = 0.6
},
y_min = 5,
y_max = 35,
decoration = {"farming:pepper_5"},
spawn_by = "group:tree",
num_spawn_by = 1,
})
end
2018-02-08 12:13:25 +01:00
if farming.pineapple then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 917,
octaves = 3,
persist = 0.6
},
y_min = 18,
y_max = 30,
decoration = {"farming:pineapple_8"},
})
end