mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 15:00:18 +01:00
Fix detecting mgv6 temples as 'desert' dungeon type
This commit is contained in:
parent
70cf7a26fd
commit
472997b4aa
@ -14,7 +14,7 @@ local function random_sample(rand, list, count)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
local function find_walls(cpos)
|
local function find_walls(cpos, is_temple)
|
||||||
local is_wall = function(node)
|
local is_wall = function(node)
|
||||||
return node.name ~= "air" and node.name ~= "ignore"
|
return node.name ~= "air" and node.name ~= "ignore"
|
||||||
end
|
end
|
||||||
@ -55,7 +55,7 @@ local function find_walls(cpos)
|
|||||||
local biome = minetest.get_biome_data(cpos)
|
local biome = minetest.get_biome_data(cpos)
|
||||||
biome = biome and minetest.get_biome_name(biome.biome) or ""
|
biome = biome and minetest.get_biome_name(biome.biome) or ""
|
||||||
local type = "normal"
|
local type = "normal"
|
||||||
if biome:find("desert") == 1 then
|
if is_temple or biome:find("desert") == 1 then
|
||||||
type = "desert"
|
type = "desert"
|
||||||
elseif biome:find("sandstone_desert") == 1 then
|
elseif biome:find("sandstone_desert") == 1 then
|
||||||
type = "sandstone"
|
type = "sandstone"
|
||||||
@ -125,6 +125,8 @@ end
|
|||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||||
local poslist = gennotify["dungeon"] or {}
|
local poslist = gennotify["dungeon"] or {}
|
||||||
|
local n_dungeons = #poslist
|
||||||
|
-- Add MGv6 desert temples to the list too
|
||||||
for _, entry in ipairs(gennotify["temple"] or {}) do
|
for _, entry in ipairs(gennotify["temple"] or {}) do
|
||||||
table.insert(poslist, entry)
|
table.insert(poslist, entry)
|
||||||
end
|
end
|
||||||
@ -137,7 +139,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
|||||||
-- process at most 8 rooms to keep runtime of this predictable
|
-- process at most 8 rooms to keep runtime of this predictable
|
||||||
local num_process = math.min(#poslist, 8)
|
local num_process = math.min(#poslist, 8)
|
||||||
for i = 1, num_process do
|
for i = 1, num_process do
|
||||||
local room = find_walls(poslist[i])
|
local room = find_walls(poslist[i], i > n_dungeons)
|
||||||
-- skip small rooms and everything that doesn't at least have 3 walls
|
-- skip small rooms and everything that doesn't at least have 3 walls
|
||||||
if math.min(room.size.x, room.size.z) >= 4 and #room.walls >= 3 then
|
if math.min(room.size.x, room.size.z) >= 4 and #room.walls >= 3 then
|
||||||
table.insert(candidates, room)
|
table.insert(candidates, room)
|
||||||
|
Loading…
Reference in New Issue
Block a user