1
0
Fork 0

Respect player's choice of mg_flags

objects
Wuzzy 2020-06-16 01:46:07 +02:00
parent 6c47ec0b92
commit 2394809649
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,2 @@
name = MineClone 2
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
disallowed_mapgen_settings = mg_flags

View File

@ -1077,18 +1077,32 @@ local function register_mgv6_decorations()
end
local mg_flags = minetest.settings:get_flags("mg_flags")
-- Disable builtin dungeons, we provide our own dungeons
mg_flags.dungeons = false
-- Apply mapgen-specific mapgen code
if mg_name == "v6" then
register_mgv6_decorations()
minetest.set_mapgen_setting("mg_flags", "biomes,caves,nodungeons,decorations,light", true)
elseif superflat then
-- Enforce superflat-like mapgen: No hills, lakes or caves
minetest.set_mapgen_setting("mg_flags", "biomes,nocaves,nodungeons,nodecorations,light", true)
-- Enforce superflat-like mapgen: no caves, decor, lakes and hills
mg_flags.caves = false
mg_flags.decorations = false
minetest.set_mapgen_setting("mgflat_spflags", "nolakes,nohills", true)
else
minetest.set_mapgen_setting("mg_flags", "biomes,caves,nodungeons,decorations,light", true)
end
local mg_flags_str = ""
for k,v in pairs(mg_flags) do
if v == false then
k = "no" .. k
end
mg_flags_str = mg_flags_str .. k .. ","
end
if string.len(mg_flags_str) > 0 then
mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str)-1)
end
minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)
-- Helper function for converting a MC probability to MT, with
-- regards to MapBlocks.
-- Some MC generated structures are generated on per-chunk