burli wrote:Is it possible to get informations about the biome the player is currently in? Or can I just get humidity and temperature? In MC you can see if you are in the plains, swampland and so on
burli wrote:Hm, but the mapgen knows the biome when he generates the map, right? What if the mg stores something like "biome:plains" in the NodeMetaRef of each node? Or would that be to much data?
burli wrote:In voxel.lua from valley_c you are using biomemap. Can other mods can use this information too?
burli wrote:How could a get_biome(pos) function look like? Can you give me a hint?
-- Create a table of biome ids, so I can use the biomemap.
if not valc.biome_ids then
local i
valc.biome_ids = {}
for name, desc in pairs(minetest.registered_biomes) do
i = minetest.get_biome_id(desc.name)
valc.biome_ids[i] = desc.name
end
end
local function get_biome(x, z)
index_2d = (z - minp.z) * csize.y * csize.x + (x - minp.x)
biome = valc.biome_ids[biomemap[index_2d]]
end
paramat wrote:Sometime i might add an API for getting biome at any time after mapgen, the core code is already in mgv7.
local function get_biome(x, z)
index_2d = (z - minp.z) * csize.y * csize.x + (x - minp.x)
biome = valc.biome_ids[biomemap[index_2d]]
end
duane 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
index_2d = (z - minp.z) * csize.y * csize.x + (x - minp.x)
index_2d = (z * csize.z + x)index_2d = (z - minp.z) * csize + (x - minp.x) + 1Users browsing this forum: No registered users and 4 guests