mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Dungeons: Do not remove nodes that have 'is_ground_content = false' (#8423)
Like randomwalk caves, preserve nodes that have 'is_ground_content = false', to avoid dungeons that generate out beyond the edge of a mapchunk destroying nodes added by mods in 'register_on_generated()'. Issue discovered by, and original PR by, argyle77.
This commit is contained in:
parent
d0a1a29ab3
commit
5e7662ca16
@ -6040,7 +6040,11 @@ Used by `minetest.register_node`.
|
|||||||
place_param2 = nil, -- Force value for param2 when player places node
|
place_param2 = nil, -- Force value for param2 when player places node
|
||||||
|
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
-- If false, the cave generator will not carve through this node
|
-- If false, the cave generator and dungeon generator will not carve
|
||||||
|
-- through this node.
|
||||||
|
-- Specifically, this stops mod-added nodes being removed by caves and
|
||||||
|
-- dungeons when those generate in a neighbor mapchunk and extend out
|
||||||
|
-- beyond the edge of that mapchunk.
|
||||||
|
|
||||||
sunlight_propagates = false,
|
sunlight_propagates = false,
|
||||||
-- If true, sunlight will go infinitely through this node
|
-- If true, sunlight will go infinitely through this node
|
||||||
|
@ -100,8 +100,11 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
|||||||
|
|
||||||
if (dp.only_in_ground) {
|
if (dp.only_in_ground) {
|
||||||
// Set all air and liquid drawtypes to be untouchable to make dungeons
|
// Set all air and liquid drawtypes to be untouchable to make dungeons
|
||||||
// open to air and liquids. Optionally set ignore to be untouchable to
|
// open to air and liquids.
|
||||||
// prevent projecting dungeons.
|
// Optionally set ignore to be untouchable to prevent projecting dungeons.
|
||||||
|
// Like randomwalk caves, preserve nodes that have 'is_ground_content = false',
|
||||||
|
// to avoid dungeons that generate out beyond the edge of a mapchunk destroying
|
||||||
|
// nodes added by mods in 'register_on_generated()'.
|
||||||
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
|
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
|
||||||
for (s16 y = nmin.Y; y <= nmax.Y; y++) {
|
for (s16 y = nmin.Y; y <= nmax.Y; y++) {
|
||||||
u32 i = vm->m_area.index(nmin.X, y, z);
|
u32 i = vm->m_area.index(nmin.X, y, z);
|
||||||
@ -109,7 +112,8 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
|||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
NodeDrawType dtype = ndef->get(c).drawtype;
|
NodeDrawType dtype = ndef->get(c).drawtype;
|
||||||
if (dtype == NDT_AIRLIKE || dtype == NDT_LIQUID ||
|
if (dtype == NDT_AIRLIKE || dtype == NDT_LIQUID ||
|
||||||
(preserve_ignore && c == CONTENT_IGNORE))
|
(preserve_ignore && c == CONTENT_IGNORE) ||
|
||||||
|
!ndef->get(c).is_ground_content)
|
||||||
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
|
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user