This mod aims at re-implementing core biome system (biomes, decorations and dust) for Lua mapgens. It is a library (it does not do anything standalone), providing functions intended to be used in Lua mapgen mods, at the end of mapgen loop.
It reads biomes and decorations registered by minetest.register_biome and minetest.register_decoration, so it is natively compatible with minetest_game and all mods/games using these functions to add content.
It applies to mapgens that generate only stone, water, river water and air, and requires to add biomegen as a dependency (mandatory or optional) of the mapgen mod.
^ biomegen used by a Lua mapgen, under vanilla Minetest Game
The main function is biomegen.generate_all(data, area, vm, minp, maxp, seed), to be added after mapgen loop, but before writing vm to map. It generates biomes, decorations, ores and dust (for now using core function for ores). Other function do these steps separately, check Readme for more details.
Example:
Code: Select all
local data = {}
minetest.register_on_generated(function(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
vm:get_data(data)
------------------------
-- [MAPGEN LOOP HERE] --
------------------------
-- Generate biomes, decorations, ores and dust
biomegen.generate_all(data, area, vm, minp, maxp, seed)
-- Calculate lighting for what has been created.
vm:calc_lighting()
-- Write what has been created to the world.
vm:write_to_map()
-- Liquid nodes were placed so set them flowing.
vm:update_liquids()
end)
Dependencies: None!
License: GNU LGPL Version 3
Download zip / Browse the code