Page 1 of 1

Doesn't recognize custom biome

PostPosted: Fri May 22, 2015 14:12
by Kenney
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

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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,
})

Re: Doesn't recognize custom biome

PostPosted: Fri May 22, 2015 14:48
by Amaz
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.

Re: Doesn't recognize custom biome

PostPosted: Fri May 22, 2015 15:53
by Kenney
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

Re: Doesn't recognize custom biome

PostPosted: Fri May 22, 2015 18:22
by Gael de Sailly
Kenney wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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.

Re: Doesn't recognize custom biome

PostPosted: Sat May 23, 2015 12:03
by Kenney
Gael de Sailly wrote:seed = 'voxus' is a constant. Be careful : it will generate every time the same world.

Yep that was on purpose :)

Re: Doesn't recognize custom biome

PostPosted: Sun Sep 18, 2016 21:07
by procedural_map
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.

Re: Doesn't recognize custom biome

PostPosted: Tue Sep 20, 2016 20:41
by Byakuren
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.

Re: Doesn't recognize custom biome

PostPosted: Wed Sep 21, 2016 01:50
by paramat
> 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.