code consistency

This commit is contained in:
tenplus1 2022-09-15 15:12:53 +01:00
parent 7be6bee04c
commit ff8e0d73a4
3 changed files with 25 additions and 15 deletions

View File

@ -187,14 +187,17 @@ farming.register_plant("farming:cotton", {
})]]
-- mapgen
local grow_on = farming.mapgen == "v6" and {"default:dirt_with_grass"}
or {"default:dry_dirt_with_dry_grass"}
local biome = farming.mapgen == "v6" and {"jungle"} or {"savanna"}
local mg = farming.mapgen == "v6"
def = {
grow_on = mg and {"default:dirt_with_grass"} or {"default:dry_dirt_with_dry_grass"},
biome = mg and {"jungle"} or {"savanna"}
}
minetest.register_decoration({
name = "farming:cotton_wild",
deco_type = "simple",
place_on = grow_on,
place_on = def.grow_on,
sidelen = 16,
noise_params = {
offset = -0.1,
@ -204,7 +207,7 @@ minetest.register_decoration({
octaves = 3,
persist = 0.7
},
biomes = biome,
biomes = def.biome,
y_max = 31000,
y_min = 1,
decoration = "farming:cotton_wild"

View File

@ -156,12 +156,15 @@ farming.registered_plants["farming:pepper"] = {
}
-- mapgen
local grow_on = farming.mapgen == "v6" and {"default:dirt_with_grass"}
or {"default:dirt_with_rainforest_litter"}
local mg = farming.mapgen == "v6"
def = {
grow_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_rainforest_litter"}
}
minetest.register_decoration({
deco_type = "simple",
place_on = grow_on,
place_on = def.grow_on,
sidelen = 16,
noise_params = {
offset = 0,

View File

@ -142,14 +142,18 @@ farming.registered_plants["farming:pineapple"] = {
}
-- mapgen
local grow_on = farming.mapgen == "v6" and {"default:dirt_with_grass"}
or {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"}
local grow_near = farming.mapgen == "v6" and "default:desert_sand" or nil
local num = farming.mapgen == "v6" and 1 or -1
local mg = farming.mapgen == "v6"
def = {
grow_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass",
"default:dry_dirt_with_dry_grass"},
grow_near = mg and "default:desert_sand" or nil,
num = mg and 1 or -1
}
minetest.register_decoration({
deco_type = "simple",
place_on = grow_on,
place_on = def.grow_on,
sidelen = 16,
noise_params = {
offset = 0,
@ -162,6 +166,6 @@ minetest.register_decoration({
y_min = 18,
y_max = 30,
decoration = {"farming:pineapple_8"},
spawn_by = grow_near,
num_spawn_by = num
spawn_by = def.grow_near,
num_spawn_by = def.num
})