mirror of
https://codeberg.org/tenplus1/farming.git
synced 2024-12-25 02:00:20 +01:00
added extra compatibility for crops spawning on older v6 maps
This commit is contained in:
parent
41356a32e2
commit
79035d0473
69
mapgen.lua
69
mapgen.lua
@ -1,3 +1,8 @@
|
|||||||
|
-- what mapgen are we using
|
||||||
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
|
|
||||||
|
-- temp vars
|
||||||
|
local tmp1, tmp2, tmp3
|
||||||
|
|
||||||
-- decoration function
|
-- decoration function
|
||||||
local function register_plant(name, min, max, spawnon, spawnby, num, rarety)
|
local function register_plant(name, min, max, spawnon, spawnby, num, rarety)
|
||||||
@ -35,9 +40,6 @@ end
|
|||||||
register_plant("potato_3", 15, 40, nil, "", -1, farming.potato)
|
register_plant("potato_3", 15, 40, nil, "", -1, farming.potato)
|
||||||
register_plant("tomato_7", 5, 20, nil, "", -1, farming.tomato)
|
register_plant("tomato_7", 5, 20, nil, "", -1, farming.tomato)
|
||||||
register_plant("corn_7", 12, 22, nil, "", -1, farming.corn)
|
register_plant("corn_7", 12, 22, nil, "", -1, farming.corn)
|
||||||
register_plant("coffee_5", 20, 45, {"default:dirt_with_dry_grass",
|
|
||||||
"default:dirt_with_rainforest_litter",
|
|
||||||
"default:dry_dirt_with_dry_grass"}, "", -1, farming.coffee)
|
|
||||||
register_plant("raspberry_4", 3, 10, nil, "", -1, farming.raspberry)
|
register_plant("raspberry_4", 3, 10, nil, "", -1, farming.raspberry)
|
||||||
register_plant("rhubarb_3", 3, 15, nil, "", -1, farming.rhubarb)
|
register_plant("rhubarb_3", 3, 15, nil, "", -1, farming.rhubarb)
|
||||||
register_plant("blueberry_4", 3, 10, nil, "", -1, farming.blueberry)
|
register_plant("blueberry_4", 3, 10, nil, "", -1, farming.blueberry)
|
||||||
@ -47,23 +49,24 @@ register_plant("onion_5", 5, 22, nil, "", -1, farming.onion)
|
|||||||
register_plant("garlic_5", 3, 30, nil, "group:tree", 1, farming.garlic)
|
register_plant("garlic_5", 3, 30, nil, "group:tree", 1, farming.garlic)
|
||||||
register_plant("pea_5", 25, 50, nil, "", -1, farming.peas)
|
register_plant("pea_5", 25, 50, nil, "", -1, farming.peas)
|
||||||
register_plant("beetroot_5", 1, 15, nil, "", -1, farming.beetroot)
|
register_plant("beetroot_5", 1, 15, nil, "", -1, farming.beetroot)
|
||||||
register_plant("mint_4", 1, 75, {"default:dirt_with_grass",
|
|
||||||
"default:dirt_with_coniferous_litter"}, "group:water", 1, farming.mint)
|
|
||||||
register_plant("cabbage_6", 2, 10, nil, "", -1, farming.cabbage)
|
register_plant("cabbage_6", 2, 10, nil, "", -1, farming.cabbage)
|
||||||
register_plant("lettuce_5", 5, 30, nil, "", -1, farming.lettuce)
|
register_plant("lettuce_5", 5, 30, nil, "", -1, farming.lettuce)
|
||||||
register_plant("blackberry_4", 3, 10, nil, "", -1, farming.blackberry)
|
register_plant("blackberry_4", 3, 10, nil, "", -1, farming.blackberry)
|
||||||
register_plant("soy_6", 20, 50, {"default:dirt_with_dry_grass",
|
|
||||||
"default:dirt_with_rainforest_litter",
|
|
||||||
"default:dry_dirt_with_dry_grass"}, "", -1, farming.soy)
|
|
||||||
register_plant("vanilla_7", 5, 35, nil, "", -1, farming.vanilla)
|
register_plant("vanilla_7", 5, 35, nil, "", -1, farming.vanilla)
|
||||||
|
register_plant("mint_4", 1, 75, {
|
||||||
|
"default:dirt_with_grass", "default:dirt_with_coniferous_litter"},
|
||||||
|
"group:water", 1, farming.mint)
|
||||||
|
|
||||||
|
|
||||||
if minetest.get_mapgen_setting("mg_name") == "v6" then
|
-- v6 mapgen compatibility for specific crops
|
||||||
|
if mg_name == "v6" then
|
||||||
|
|
||||||
register_plant("carrot_8", 1, 30, nil, "group:water", 1, farming.carrot)
|
register_plant("carrot_8", 1, 30, nil, "group:water", 1, farming.carrot)
|
||||||
register_plant("cucumber_4", 1, 20, nil, "group:water", 1, farming.cucumber)
|
register_plant("cucumber_4", 1, 20, nil, "group:water", 1, farming.cucumber)
|
||||||
register_plant("melon_8", 1, 20, nil, "group:water", 1, farming.melon)
|
register_plant("melon_8", 1, 20, nil, "group:water", 1, farming.melon)
|
||||||
register_plant("pumpkin_8", 1, 20, nil, "group:water", 1, farming.pumpkin)
|
register_plant("pumpkin_8", 1, 20, nil, "group:water", 1, farming.pumpkin)
|
||||||
|
register_plant("coffee_5", 20, 45, nil, "", -1, farming.coffee)
|
||||||
|
register_plant("soy_6", 20, 50, nil, "", -1, farming.soy)
|
||||||
else
|
else
|
||||||
-- v7 maps have a beach so plants growing near water is limited to 6 high
|
-- v7 maps have a beach so plants growing near water is limited to 6 high
|
||||||
register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot)
|
register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot)
|
||||||
@ -71,8 +74,15 @@ else
|
|||||||
register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass",
|
register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass",
|
||||||
"default:dirt_with_rainforest_litter"}, "", -1, farming.melon)
|
"default:dirt_with_rainforest_litter"}, "", -1, farming.melon)
|
||||||
register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin)
|
register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin)
|
||||||
|
register_plant("coffee_5", 20, 45, {"default:dirt_with_dry_grass",
|
||||||
|
"default:dirt_with_rainforest_litter",
|
||||||
|
"default:dry_dirt_with_dry_grass"}, "", -1, farming.coffee)
|
||||||
|
register_plant("soy_6", 20, 50, {"default:dirt_with_dry_grass",
|
||||||
|
"default:dirt_with_rainforest_litter",
|
||||||
|
"default:dry_dirt_with_dry_grass"}, "", -1, farming.soy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if farming.hemp then
|
if farming.hemp then
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
@ -94,6 +104,7 @@ minetest.register_decoration({
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if farming.chili then
|
if farming.chili then
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
@ -115,10 +126,18 @@ minetest.register_decoration({
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if farming.pepper then
|
if farming.pepper then
|
||||||
|
|
||||||
|
local tmp1 = {"default:dirt_with_rainforest_litter"} -- v7
|
||||||
|
|
||||||
|
if mg_name == "v6" then
|
||||||
|
tmp1 = {"default:dirt_with_grass"} -- v6
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = {"default:dirt_with_rainforest_litter"},
|
place_on = tmp1,
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
noise_params = {
|
noise_params = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
@ -136,10 +155,22 @@ minetest.register_decoration({
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if farming.pineapple then
|
if farming.pineapple then
|
||||||
|
|
||||||
|
tmp1 = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"}
|
||||||
|
tmp2 = nil
|
||||||
|
tmp3 = -1
|
||||||
|
|
||||||
|
if mg_name == "v6" then
|
||||||
|
tmp1 = {"default:dirt_with_grass"}
|
||||||
|
tmp2 = "default:desert_sand"
|
||||||
|
tmp3 = 1
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"},
|
place_on = tmp1,
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
noise_params = {
|
noise_params = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
@ -151,14 +182,24 @@ minetest.register_decoration({
|
|||||||
},
|
},
|
||||||
y_min = 18,
|
y_min = 18,
|
||||||
y_max = 30,
|
y_max = 30,
|
||||||
decoration = {"farming:pineapple_8"}
|
decoration = {"farming:pineapple_8"},
|
||||||
|
spawn_by = tmp2,
|
||||||
|
num_spawn_by = tmp3
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tmp1 = {"default:dry_dirt_with_dry_grass"}
|
||||||
|
tmp2 = {"savanna"}
|
||||||
|
|
||||||
|
if mg_name == "v6" then
|
||||||
|
tmp1 = {"default:dirt_with_grass"}
|
||||||
|
tmp2 = {"jungle"}
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
name = "farming:cotton_wild",
|
name = "farming:cotton_wild",
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = {"default:dry_dirt_with_dry_grass"},
|
place_on = tmp1,
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
noise_params = {
|
noise_params = {
|
||||||
offset = -0.1,
|
offset = -0.1,
|
||||||
@ -168,7 +209,7 @@ minetest.register_decoration({
|
|||||||
octaves = 3,
|
octaves = 3,
|
||||||
persist = 0.7
|
persist = 0.7
|
||||||
},
|
},
|
||||||
biomes = {"savanna"},
|
biomes = tmp2,
|
||||||
y_max = 31000,
|
y_max = 31000,
|
||||||
y_min = 1,
|
y_min = 1,
|
||||||
decoration = "farming:cotton_wild"
|
decoration = "farming:cotton_wild"
|
||||||
|
Loading…
Reference in New Issue
Block a user