register_biomes and lua mapgen

Kilarin
Member
 
Posts: 774
Joined: Mon Mar 10, 2014 00:36

register_biomes and lua mapgen

by Kilarin » Thu May 09, 2019 22:59

will the built in minetest.register_biome work along with a lua mapgen? Or, if you generate your own landscape do you also have to generate your own biomes?

The specific case I tried was generating some land up at a high altitude, and registering a few biomes that had ymin and ymax set for that altitude. The land generated just fine, but no biomes (as I expected actually)
 

User avatar
duane
Member
 
Posts: 1571
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: register_biomes and lua mapgen

by duane » Fri May 10, 2019 00:17

register_biome will work, but the only thing it's designed to do is add biome data to a table. The mapgen then uses that data to place decorations.

If your lua mapgen is based on single node, you'll have to place all the decorations yourself. If you build on another C mapgen, you'll get some decorations before your lua runs. You can also use minetest.generate_decorations to place them after your code runs, but if I remember right, they'll still be based on the original heightmap, so adding terrain will cause problems.

You might be able to modify the heightmap returned by minetest.get_mapgen_object(), but I don't think the C mapgen will use it, even in generate_decorations.
Believe in people and you don't need to believe anything else.
 

Kilarin
Member
 
Posts: 774
Joined: Mon Mar 10, 2014 00:36
 

User avatar
DrFrankenstone
Member
 
Posts: 110
Joined: Tue May 24, 2016 05:36
Location: Melbourne, Australia
GitHub: treer

Re: register_biomes and lua mapgen

by DrFrankenstone » Fri May 10, 2019 23:37

As duane said, you have to code the lua mapgen to make use of the biome data, and this only became possible in Minetest v5, so there's not many lua mapgens that do it yet (Hallelujah Mountains sort-of does it).

I've written a feature request "Expose MapgenBasic::generateBiomes() to lua", which would allow lua mapgens to easily implement all registered biomes, but it's not a high priority feature, and it would involve some refactoring.
 

User avatar
paramat
Developer
 
Posts: 3434
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: register_biomes and lua mapgen

by paramat » Thu May 16, 2019 20:59

Kilarin wrote:will the built in minetest.register_biome work along with a lua mapgen?

No. When using the lua voxel manipulator (LVM) in a lua mapgen, only the registered ores and decorations can be generated in the LVM.
There's a feature request for generating the registered biomes in a LVM.
 

Kilarin
Member
 
Posts: 774
Joined: Mon Mar 10, 2014 00:36
 


Return to Modding Discussion



Who is online

Users browsing this forum: MSN [Bot] and 5 guests