Doesn't recognize custom biome

Post Reply
User avatar
Kenney
Member
Posts: 131
Joined: Fri Jan 02, 2015 12:12
In-game: Kenney

Doesn't recognize custom biome

by Kenney » Post

I've written the code below but the map generation just doesn't create the biome. Mods with custom biomes written by others (Snow Biome) do seem to work.

Minetest 0.4.12

Code: Select all

-- Map generation

minetest.clear_registered_decorations()
minetest.clear_registered_biomes()

local mapgen_params = {mgname = 'v7', seed = 'voxus', flags=''}
minetest.set_mapgen_params(mapgen_params)

minetest.register_alias("voxus:dirt", "default:dirt")

minetest.register_biome({
	name = "plains2",
	node_top = "default:dirt",
	depth_top = 1,
	node_filler = "default:dirt",
	depth_filler = 3,
	height_min = 1,
	height_max = 20,
	heat_point = 10,
	humidity_point = 40,
})
Games:
Voxus | UFO Race

Amaz
Member
Posts: 354
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Doesn't recognize custom biome

by Amaz » Post

I was able to get it to work by adding a depends.txt with default in. Maybe that's the problem? Because unless the biomes are loaded, there aren't any biomes for Minetest to clear. This was with minetest game though.

User avatar
Kenney
Member
Posts: 131
Joined: Fri Jan 02, 2015 12:12
In-game: Kenney

Re: Doesn't recognize custom biome

by Kenney » Post

Amaz wrote:I was able to get it to work by adding a depends.txt with default in. Maybe that's the problem? Because unless the biomes are loaded, there aren't any biomes for Minetest to clear. This was with minetest game though.
That actually indeed did the trick, thanks a lot! <3
Games:
Voxus | UFO Race

User avatar
Gael de Sailly
Member
Posts: 845
Joined: Sun Jan 26, 2014 17:01
GitHub: gaelysam
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly gaelysam
Location: Voiron, France

Re: Doesn't recognize custom biome

by Gael de Sailly » Post

Kenney wrote:

Code: Select all

local mapgen_params = {mgname = 'v7', seed = 'voxus', flags=''}
seed = 'voxus' is a constant. Be careful : it will generate every time the same world.
Just realize how bored we would be if the world was perfect.

User avatar
Kenney
Member
Posts: 131
Joined: Fri Jan 02, 2015 12:12
In-game: Kenney

Re: Doesn't recognize custom biome

by Kenney » Post

Gael de Sailly wrote:seed = 'voxus' is a constant. Be careful : it will generate every time the same world.
Yep that was on purpose :)
Games:
Voxus | UFO Race

procedural_map
New member
Posts: 4
Joined: Wed Aug 17, 2016 11:48

Re: Doesn't recognize custom biome

by procedural_map » Post

Amaz wrote:I was able to get it to work by adding a depends.txt with default in. Maybe that's the problem? Because unless the biomes are loaded, there aren't any biomes for Minetest to clear. This was with minetest game though.
Thank you. It worked for me too!

To be honest, this should be noted at http://dev.minetest.net/minetest.register_biome (It seems that not everyone can edit it)
In the intro http://dev.minetest.net/Intro they say that "depends.txt" is not necessary.
There is no indication that I need this (depends.txt with default). It's counter-intuitive - The game loads everything just fine (dirt with grass, rock etc); there is no an error window. I'm not sure if it's possible but I think we can redefine all nodes/biomes. So why we need "load default" to unload everything in the next second?
Obviously there are reasons but for a new minetest's modder this is weird.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Doesn't recognize custom biome

by Byakuren » Post

procedural_map wrote:
Amaz wrote:I was able to get it to work by adding a depends.txt with default in. Maybe that's the problem? Because unless the biomes are loaded, there aren't any biomes for Minetest to clear. This was with minetest game though.
Thank you. It worked for me too!

To be honest, this should be noted at http://dev.minetest.net/minetest.register_biome (It seems that not everyone can edit it)
In the intro http://dev.minetest.net/Intro they say that "depends.txt" is not necessary.
There is no indication that I need this (depends.txt with default). It's counter-intuitive - The game loads everything just fine (dirt with grass, rock etc); there is no an error window. I'm not sure if it's possible but I think we can redefine all nodes/biomes. So why we need "load default" to unload everything in the next second?
Obviously there are reasons but for a new minetest's modder this is weird.
depends.txt really is not necessary to make a mod, which is what the Intro page is about. If your mod's behavior depends on other mods, then you will need depends.txt, but not all mods do.

The documentation for minetest.clear_registered_biomes says that it clears all biomes currently registered. So you need to ensure that the biomes you want to clear have already been registered when you call it, which you need depends.txt for.

If anything, the warning should go with clear_registered_biomes, not register_biome.
Every time a mod API is left undocumented, a koala dies.

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

Re: Doesn't recognize custom biome

by paramat » Post

> Because unless the biomes are loaded, there aren't any biomes for Minetest to clear.

That's not the issue, there is an initial fallback biome defined in case none are registered.
What happened is that without a dependency on default, the default mod was run after Kenney's mod and added it's biomes to Kenney's, since Kenney's biome is at heat = 10 is was probably hard to find.
If you clear biomes you need a dependency on default to make that register it's biomes first.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 26 guests