added savanna biome and dry grass stuff

This commit is contained in:
kaadmy 2015-10-01 17:10:41 -07:00
parent ba3f3e0532
commit d7aa836052
12 changed files with 90 additions and 133 deletions

View File

@ -1,7 +1,7 @@
-- minetest/default/mapgen.lua
--
-- Aliases for map generator outputs
-- Aliases for map generator outputs(Might not be needed with v7, but JIC)
--
minetest.register_alias("mapgen_stone", "default:stone")
@ -34,10 +34,10 @@ minetest.register_ore(
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_scarcity = 10*10*10,
clust_num_ores = 6,
clust_size = 4,
height_min = -128,
height_min = -31000,
height_max = 32,
})
@ -47,10 +47,22 @@ minetest.register_ore(
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 8,
clust_size = 6,
height_min = -31000,
height_max = -32,
})
minetest.register_ore(
{
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 20,
clust_size = 10,
height_min = -128,
height_max = -32,
height_min = -31000,
height_max = -64,
})
minetest.register_ore(
@ -61,7 +73,7 @@ minetest.register_ore(
clust_scarcity = 8*8*8,
clust_num_ores = 6,
clust_size = 4,
height_min = -128,
height_min = -31000,
height_max = 0,
})
@ -73,7 +85,7 @@ minetest.register_ore(
clust_scarcity = 8*8*8,
clust_num_ores = 20,
clust_size = 10,
height_min = -128,
height_min = -31000,
height_max = -32,
})
@ -82,134 +94,13 @@ minetest.register_ore(
ore_type = "blob",
ore = "default:block_steel",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_scarcity = 12*12*12,
clust_num_ores = 10,
clust_size = 10,
height_min = -128,
height_max = -64,
height_min = -31000,
height_max = -128,
})
function default.make_papyrus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name="default:papyrus"})
else
return
end
end
end
function default.make_cactus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name="default:cactus"})
else
return
end
end
end
function default.mgv6_ongen(minp, maxp, seed)
-- Generate cactuses
local perlin1 = minetest.get_perlin(230, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine cactus amount from perlin noise
local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3)
-- Find random positions for cactus based on this random
local pr = PseudoRandom(seed+1)
for i=0,cactus_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 and ground_y > 10) and minetest.get_node({x=x,y=ground_y,z=z}).name == "default:sand" then
default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(2, 3))
end
end
end
end
local pr = PseudoRandom(seed+541)
for x=minp.x,maxp.x do
for z=minp.z,maxp.z do
local perlin1=((minetest.get_perlin(5123, 3, 0.6, 1):get2d({x=x*0.03, y=z*0.03}) * 0.5) + 0.5)*60
if pr:next(0, 15) > perlin1 then
local ground_y = nil
for y=2,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
local pos={x=x, y=ground_y, z=z}
if (ground_y and ground_y < 20) and minetest.get_node(pos).name == "default:sand" then
if minetest.find_node_near(pos, 3, {"group:water"}) then
default.make_papyrus({x=pos.x, y=pos.y+1, z=pos.z}, pr:next(1, 3))
end
end
end
local perlin2=((minetest.get_perlin(8175, 12, 0.8, 0.7):get2d({x=x*0.025, y=z*0.025}) * 0.5) + 0.5)*1000
if pr:next(0, 15) > perlin2 then
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 ~= nil then
local p = {x = x, y = ground_y+1, z = z}
local nn=minetest.get_node(p).name
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 nn == "default:dirt_with_grass" then
if pr:next(0, 100) < 1 then
minetest.set_node(p, {name = "farming:wheat_4"})
else
minetest.set_node(p, {name = "default:grass"})
end
elseif nn == "default:sand" and pr:next(0, 300) < 1 then
minetest.set_node(p, {name = "farming:cotton_4"})
end
end
end
end
end
end
end
local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then
default.log("please use v5 or v7 mapgen instead; v6 mapgen may not work and is not supported.", "info")
-- minetest.register_on_generated(default.mgv6_ongen)
end
--
-- Biome setup
--
@ -266,6 +157,18 @@ minetest.register_biome(
heat_point = 50, humidity_point = 35,
})
minetest.register_biome(
{
name = "Savanna",
node_top = "default:dirt_with_dry_grass", depth_top = 1,
node_filler = "default:dirt", depth_filler = 2,
node_underwater = "default:dirt",
node_shore_top = "default:sand",
node_shore_filler = "default:sand", height_shore = 0,
y_min = -32000, y_max = 32000,
heat_point = 60, humidity_point = 25,
})
minetest.register_biome(
{
name = "Desert",
@ -274,8 +177,8 @@ minetest.register_biome(
node_underwater = "default:dirt",
node_shore_top = "default:sand",
node_shore_filler = "default:sand", height_shore = 0,
y_min = -32000, y_max = 32000,
heat_point = 80, humidity_point = 10,
y_min = 0, y_max = 32000,
heat_point = 70, humidity_point = 20,
})
-- Decorations
@ -392,6 +295,18 @@ minetest.register_decoration(
y_max = 32000,
})
minetest.register_decoration(
{
deco_type = "simple",
place_on = "default:dirt_with_dry_grass",
sidelen = 16,
fill_ratio = 0.07,
biomes = {"Savanna"},
decoration = {"default:dry_grass"},
y_min = 0,
y_max = 50,
})
minetest.register_decoration(
{
deco_type = "simple",

View File

@ -87,6 +87,26 @@ minetest.register_node(
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node(
"default:dirt_with_dry_grass",
{
description = "Dirt with Dry Grass",
tiles ={"default_dry_grass.png", "default_dirt.png", "default_dirt.png^default_dry_grass_side.png"},
groups = {crumbly=3, soil=1, fall_damage_add_percent=-5, not_in_craftingguide = 1},
drop = {
max_items = 3,
items = {
{items = {"default:dirt"}, rarity = 1},
{items = {"default:grass 2"}, rarity = 6},
}
},
is_ground_content = true,
sounds = default.node_sound_dirt_defaults(
{
footstep = {name="default_soft_footstep", gain=0.3},
}),
})
minetest.register_node(
"default:dirt_with_grass",
{
@ -963,6 +983,28 @@ minetest.register_node(
end,
})
minetest.register_node(
"default:dry_grass",
{
description = "Dry Grass Clump",
drawtype = "plantlike",
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}
},
visual_scale = 1.15,
tiles ={"default_dry_grass_clump.png"},
inventory_image = "default_dry_grass_clump_inventory.png",
wield_image = "default_dry_grass_clump_inventory.png",
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
groups = {snappy=2,dig_immediate=3,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node(
"default:grass",
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B