forked from mtcontrib/plantlife_modpack
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
fa9f30043f
@ -7,6 +7,8 @@ local mname = "cavestuff"
|
|||||||
-- support for i18n
|
-- support for i18n
|
||||||
local S = minetest.get_translator("cavestuff")
|
local S = minetest.get_translator("cavestuff")
|
||||||
|
|
||||||
|
cavestuff = {}
|
||||||
|
|
||||||
dofile(minetest.get_modpath("cavestuff").."/nodes.lua")
|
dofile(minetest.get_modpath("cavestuff").."/nodes.lua")
|
||||||
dofile(minetest.get_modpath("cavestuff").."/mapgen.lua")
|
dofile(minetest.get_modpath("cavestuff").."/mapgen.lua")
|
||||||
|
|
||||||
|
@ -1,55 +1,39 @@
|
|||||||
--Map Generation Stuff
|
--Map Generation Stuff
|
||||||
|
|
||||||
local random = math.random
|
biome_lib:register_generate_plant(
|
||||||
local floor = math.floor
|
{
|
||||||
|
surface = {
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:gravel",
|
||||||
|
"default:stone",
|
||||||
|
"default:permafrost_with_stones"
|
||||||
|
},
|
||||||
|
max_count = 50,
|
||||||
|
rarity = 0,
|
||||||
|
plantlife_limit = -1,
|
||||||
|
check_air = true,
|
||||||
|
random_facedir = {0, 3}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cavestuff:pebble_1",
|
||||||
|
"cavestuff:pebble_2"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
biome_lib:register_generate_plant(
|
||||||
if maxp.y >= 2 and minp.y <= 0 then
|
{
|
||||||
-- Generate pebbles
|
surface = {
|
||||||
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
|
"default:desert_sand",
|
||||||
-- Assume X and Z lengths are equal
|
"default:desert_stone"
|
||||||
local divlen = 16
|
},
|
||||||
local divs = (maxp.x-minp.x)/divlen+1;
|
max_count = 50,
|
||||||
for divx=0,divs-1 do
|
rarity = 0,
|
||||||
for divz=0,divs-1 do
|
plantlife_limit = -1,
|
||||||
local x0 = minp.x + floor((divx+0)*divlen)
|
check_air = true,
|
||||||
local z0 = minp.z + floor((divz+0)*divlen)
|
random_facedir = {0, 3}
|
||||||
local x1 = minp.x + floor((divx+1)*divlen)
|
},
|
||||||
local z1 = minp.z + floor((divz+1)*divlen)
|
{
|
||||||
-- Determine pebble amount from perlin noise
|
"cavestuff:desert_pebble_1",
|
||||||
local pebble_amount = floor(perlin1:get2d({x=x0, y=z0}) ^ 2 * 2)
|
"cavestuff:desert_pebble_2"
|
||||||
-- Find random positions for pebbles based on this random
|
}
|
||||||
local pr = PseudoRandom(seed+1)
|
)
|
||||||
for i=0,pebble_amount do
|
|
||||||
local x = pr:next(x0, x1)
|
|
||||||
local z = pr:next(z0, z1)
|
|
||||||
-- Find ground level (0...15)
|
|
||||||
local ground_y = nil
|
|
||||||
for y=30,0,-1 do
|
|
||||||
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
|
|
||||||
ground_y = y
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if ground_y then
|
|
||||||
local p = {x=x,y=ground_y+1,z=z}
|
|
||||||
local nn = minetest.get_node(p).name
|
|
||||||
-- Check if the node can be replaced
|
|
||||||
if minetest.registered_nodes[nn] and
|
|
||||||
minetest.registered_nodes[nn].buildable_to then
|
|
||||||
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
|
||||||
-- If desert sand, add dry shrub
|
|
||||||
if nn == "default:dirt_with_grass" then
|
|
||||||
minetest.swap_node(p,{name="cavestuff:pebble_"..pr:next(1,2), param2=random(0,3)})
|
|
||||||
elseif nn == "default:desert_sand" then
|
|
||||||
minetest.swap_node(p,{name="cavestuff:desert_pebble_"..pr:next(1,2), param2=random(0,3)})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
name = cavestuff
|
name = cavestuff
|
||||||
depends = default
|
depends = default,biome_lib
|
||||||
|
@ -7,27 +7,24 @@
|
|||||||
-- Looked at code from: default
|
-- Looked at code from: default
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
local random = math.random
|
biome_lib:register_generate_plant(
|
||||||
|
{
|
||||||
abstract_dryplants.grow_grass = function(pos)
|
surface = {
|
||||||
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
"default:dirt_with_grass",
|
||||||
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
"stoneage:grass_with_silex",
|
||||||
or minetest.get_node(right_here).name == "default:junglegrass" then
|
"sumpf:peat",
|
||||||
minetest.swap_node(right_here, {name="default:grass_"..random(1,5)})
|
"sumpf:sumpf"
|
||||||
end
|
},
|
||||||
end
|
max_count = TALL_GRASS_PER_MAPBLOCK,
|
||||||
|
rarity = 101 - TALL_GRASS_RARITY,
|
||||||
biome_lib:register_generate_plant({
|
min_elevation = 1, -- above sea level
|
||||||
surface = {
|
plantlife_limit = -0.9,
|
||||||
"default:dirt_with_grass",
|
check_air = true,
|
||||||
"stoneage:grass_with_silex",
|
|
||||||
"sumpf:peat",
|
|
||||||
"sumpf:sumpf"
|
|
||||||
},
|
},
|
||||||
max_count = TALL_GRASS_PER_MAPBLOCK,
|
{ "default:grass_1",
|
||||||
rarity = 101 - TALL_GRASS_RARITY,
|
"default:grass_2",
|
||||||
min_elevation = 1, -- above sea level
|
"default:grass_3",
|
||||||
plantlife_limit = -0.9,
|
"default:grass_4",
|
||||||
},
|
"default:grass_5"
|
||||||
abstract_dryplants.grow_grass
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user