Skip to content

Commit

Permalink
only remove default biomes before registering ethereal one's
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Apr 24, 2022
1 parent a58edd7 commit f99917e
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 6 deletions.
5 changes: 0 additions & 5 deletions biomes.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

-- clear default mapgen biomes, decorations but keep ores
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
--minetest.clear_registered_ores()

local S = ethereal.intllib


Expand Down
91 changes: 91 additions & 0 deletions biomes_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

--[[
Apologies for any breakages to current biomes or mods, the following code was
forced by wsor4035 so that Ethereal would be approved for contentdb inclusion
]]--


local old_biomes = {}
local old_decor = {}


-- backup registered biome data
for key, def in pairs(minetest.registered_biomes) do
old_biomes[key] = def
end

for key, def in pairs(minetest.registered_decorations) do
old_decor[key] = def
end


-- clear current biome data
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
-- minetest.clear_registered_ores()


-- create list of default biomes to remove
local def_biomes = {
"rainforest_swamp", "grassland_dunes", "cold_desert", "taiga", "icesheet_ocean",
"snowy_grassland_under", "desert", "deciduous_forest", "taiga_ocean", "desert_ocean",
"tundra_ocean", "snowy_grassland_ocean", "sandstone_desert", "tundra_under",
"coniferous_forest_ocean", "tundra", "sandstone_desert_under", "grassland",
"rainforest", "grassland_ocean", "tundra_beach", "rainforest_under", "savanna_under",
"icesheet", "savanna_ocean", "tundra_highland", "savanna", "cold_desert_under",
"cold_desert_ocean", "desert_under", "taiga_under", "savanna_shore",
"sandstone_desert_ocean", "snowy_grassland", "coniferous_forest_under",
"deciduous_forest_ocean", "grassland_under", "icesheet_under", "rainforest_ocean",
"deciduous_forest_shore", "deciduous_forest_under", "coniferous_forest_dunes",
"coniferous_forest"
}


-- only re-register biomes that aren't on the list
for key, def in pairs(old_biomes) do

local can_add = true

for num, bio in pairs(def_biomes) do

if key == bio then
can_add = false
end
end

if can_add == true then
minetest.register_biome(def)
end
end


-- only re-register decorations that don't appear in any of the above biomes
for key, def in pairs(old_decor) do

local can_add = true

if type(def.biomes) == "table" then

for num, bio in pairs(def.biomes) do

can_add = true

for n, b in pairs(def_biomes) do

if bio == b then
can_add = false
end
end
end
else
if def.biomes == key then
can_add = false
end
end

if can_add == true then
minetest.register_decoration(def)
end
end
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
]]


ethereal = {version = "20220405"}
ethereal = {version = "20220424"}


local function setting(stype, name, default)
Expand Down Expand Up @@ -120,6 +120,7 @@ dofile(path .. "/fishing.lua")
dofile(path .. "/extra.lua")
dofile(path .. "/sealife.lua")
dofile(path .. "/fences.lua")
dofile(path .. "/biomes_init.lua")
dofile(path .. "/biomes.lua")
dofile(path .. "/ores.lua")
dofile(path .. "/schems.lua")
Expand Down

0 comments on commit f99917e

Please sign in to comment.