Dungeons: Mostly fix missing stair nodes

This commit is contained in:
Paramat 2018-04-25 00:44:49 +01:00 committed by GitHub
parent d6272fc15f
commit 454f80a0f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -431,8 +431,10 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
VMANIP_FLAG_DUNGEON_UNTOUCHABLE, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
MapNode(dp.c_wall), MapNode(dp.c_wall),
0); 0);
makeHole(p); makeFill(p, dp.holesize, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
makeHole(p - dir); MapNode(CONTENT_AIR), VMANIP_FLAG_DUNGEON_INSIDE);
makeFill(p - dir, dp.holesize, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
MapNode(CONTENT_AIR), VMANIP_FLAG_DUNGEON_INSIDE);
// TODO: fix stairs code so it works 100% // TODO: fix stairs code so it works 100%
// (quite difficult) // (quite difficult)
@ -451,16 +453,21 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
v3s16 swv = (dir.Z != 0) ? v3s16(1, 0, 0) : v3s16(0, 0, 1); v3s16 swv = (dir.Z != 0) ? v3s16(1, 0, 0) : v3s16(0, 0, 1);
for (u16 st = 0; st < stair_width; st++) { for (u16 st = 0; st < stair_width; st++) {
if (make_stairs == -1) {
u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z); u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
if (vm->m_area.contains(ps + v3s16(-dir.X, -1, -dir.Z)) && if (vm->m_area.contains(ps + v3s16(-dir.X, -1, -dir.Z)) &&
vm->m_data[vi].getContent() == dp.c_wall) vm->m_data[vi].getContent() == dp.c_wall) {
vm->m_flags[vi] |= VMANIP_FLAG_DUNGEON_UNTOUCHABLE;
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir); vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
}
vi = vm->m_area.index(ps.X, ps.Y, ps.Z); } else if (make_stairs == 1) {
if (vm->m_area.contains(ps) && u32 vi = vm->m_area.index(ps.X, ps.Y - 1, ps.Z);
vm->m_data[vi].getContent() == dp.c_wall) if (vm->m_area.contains(ps + v3s16(0, -1, 0)) &&
vm->m_data[vi].getContent() == dp.c_wall) {
vm->m_flags[vi] |= VMANIP_FLAG_DUNGEON_UNTOUCHABLE;
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir); vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
}
}
ps += swv; ps += swv;
} }
} }