local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator("eg_mapgen")

-- Register biomes

-- Grassland biome stack

-- A 'biome stack' is a vertical stack of biomes all having the same heat and
-- humidity points, and therefore all having the same horizontal distribution.
-- In minipeli only one biome stack is registered, more will probably be
-- desired for a developed game.

-- Dry land from beach top to world top

minetest.register_biome({
	name = "grassland",
	node_top = modname .. ":grass",
	depth_top = 1,
	node_filler = modname .. ":dirt",
	depth_filler = 1,
	node_riverbed = modname .. ":sand",
	depth_riverbed = 2,
	node_cave_liquid = modname .. ":water_source",
	node_dungeon = modname .. ":stone_block",
	node_dungeon_stair = modname .. ":stone_block_stair",
	y_max = 31000,
	y_min = 4,
	heat_point = 50,
	humidity_point = 50,
})

-- The sand of beaches and seabeds

minetest.register_biome({
	name = "grassland_sea",
	node_top = modname .. ":sand",
	depth_top = 1,
	node_filler = modname .. ":sand",
	depth_filler = 2,
	node_riverbed = modname .. ":sand",
	depth_riverbed = 2,
	node_cave_liquid = modname .. ":water_source",
	node_dungeon = modname .. ":stone_block",
	node_dungeon_stair = modname .. ":stone_block_stair",
	vertical_blend = 1,
	y_max = 3,
	y_min = -127,
	heat_point = 50,
	humidity_point = 50,
})

-- Shallow underground

minetest.register_biome({
	name = "grassland_under",
	node_cave_liquid = modname .. ":water_source",
	node_dungeon = modname .. ":stone_block",
	node_dungeon_stair = modname .. ":stone_block_stair",
	y_max = -128,
	y_min = -1023,
	heat_point = 50,
	humidity_point = 50,
})

-- Deep underground where magma first appears

minetest.register_biome({
	name = "grassland_deep",
	node_cave_liquid = {modname .. ":water_source", modname .. ":magma_source"},
	node_dungeon = modname .. ":stone_block",
	node_dungeon_stair = modname .. ":stone_block_stair",
	y_max = -512,
	y_min = -31000,
	heat_point = 60,
	humidity_point = 50,
})
