Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biome API: Add 'get_biome_name(biome_id)' API #7117

Closed
wants to merge 1 commit into from
Closed

Biome API: Add 'get_biome_name(biome_id)' API #7117

wants to merge 1 commit into from

Conversation

paramat
Copy link
Contributor

@paramat paramat commented Mar 9, 2018

For #7105
Many APIs use the biome ID, this is useful to get the name string from the ID.

Tested with this mod that prints biome name as you explore:

local timer = 0

	minetest.register_globalstep(function(dtime)
		timer = timer + dtime
		if timer > 2 then
			timer = 0
			for _, player in ipairs(minetest.get_connected_players()) do
				local pos = player:getpos()
				pos.x = math.floor(pos.x)
				pos.y = math.floor(pos.y)
				pos.z = math.floor(pos.z)
				local biome_data = minetest.get_biome_data(pos)
				local biome_name = minetest.get_biome_name(biome_data.biome)
				print(biome_name)
			end
		end
	end)

Note in mgv6 which does not define biomes 'default' is returned.

@paramat paramat added @ Script API @ Mapgen Feature ✨ PRs that add or enhance a feature labels Mar 9, 2018
@paramat paramat added the WIP The PR is still being worked on by its author and not ready yet. label Mar 9, 2018
Change name of default biome to a more suitable lowercase 'default'.
@paramat paramat removed Documentation needed WIP The PR is still being worked on by its author and not ready yet. labels Mar 10, 2018
@paramat
Copy link
Contributor Author

paramat commented Mar 10, 2018

Docs added, mergeable.

@paramat
Copy link
Contributor Author

paramat commented Mar 11, 2018

7ad6cdd

@paramat paramat closed this Mar 11, 2018
@paramat paramat deleted the biomenamefromid branch March 19, 2018 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants