Minetest 0.5 adds an "unregister_biome" function

This commit is contained in:
FaceDeer 2018-06-04 19:32:45 -06:00
parent af9982786e
commit c590d55587

View File

@ -92,6 +92,14 @@ end
-- track of the biome they belong to via an internal ID that gets changed when the biomes -- track of the biome they belong to via an internal ID that gets changed when the biomes
-- are re-registered, resulting in them being left assigned to the wrong biomes. -- are re-registered, resulting in them being left assigned to the wrong biomes.
function subterrane:override_biome(biome_def) function subterrane:override_biome(biome_def)
--Minetest 0.5 adds this "unregister biome" method
if minetest.unregister_biome and biome_def.name then
minetest.unregister_biome(biome_def.name)
minetest.register_biome(biome_def)
return
end
local registered_biomes_copy = {} local registered_biomes_copy = {}
for old_biome_key, old_biome_def in pairs(minetest.registered_biomes) do for old_biome_key, old_biome_def in pairs(minetest.registered_biomes) do
registered_biomes_copy[old_biome_key] = old_biome_def registered_biomes_copy[old_biome_key] = old_biome_def