Skip to content

Commit

Permalink
Dungeongen: Also preserve river water nodes
Browse files Browse the repository at this point in the history
For future river mapgens
Dungeons will not generate in river water, to
avoid dungeons filling and blocking river channels
  • Loading branch information
paramat committed Nov 29, 2015
1 parent 900db31 commit 452c883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dungeongen.cpp
Expand Up @@ -65,6 +65,9 @@ DungeonGen::DungeonGen(Mapgen *mapgen, DungeonParams *dparams)
dp.np_wetness = nparams_dungeon_wetness;
dp.np_density = nparams_dungeon_density;
}

// For mapgens using river water
dp.c_river_water = mg->ndef->getId("mapgen_river_water_source");
}


Expand All @@ -87,7 +90,7 @@ void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax)
u32 i = vm->m_area.index(nmin.X, y, z);
for (s16 x = nmin.X; x <= nmax.X; x++) {
content_t c = vm->m_data[i].getContent();
if (c == CONTENT_AIR || c == dp.c_water)
if (c == CONTENT_AIR || c == dp.c_water || c == dp.c_river_water)
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
i++;
}
Expand Down
1 change: 1 addition & 0 deletions src/dungeongen.h
Expand Up @@ -40,6 +40,7 @@ int dir_to_facedir(v3s16 d);

struct DungeonParams {
content_t c_water;
content_t c_river_water;
content_t c_cobble;
content_t c_moss;
content_t c_stair;
Expand Down

0 comments on commit 452c883

Please sign in to comment.