aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-04-25 00:44:49 +0100
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commitebfdb21624d07cb3bb99d1c5e288aa9587aef453 (patch)
tree4cf61371b7f53016fc8c1bde291a2fd94726e64b
parent0088fa6db4111c20b48c7f0ff894fee779fe221b (diff)
downloadminetest-ebfdb21624d07cb3bb99d1c5e288aa9587aef453.tar.gz
minetest-ebfdb21624d07cb3bb99d1c5e288aa9587aef453.tar.bz2
minetest-ebfdb21624d07cb3bb99d1c5e288aa9587aef453.zip
Dungeons: Mostly fix missing stair nodes
-rw-r--r--src/dungeongen.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp
index 6cef3f88d..f8f3df56f 100644
--- a/src/dungeongen.cpp
+++ b/src/dungeongen.cpp
@@ -431,8 +431,10 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
MapNode(dp.c_wall),
0);
- makeHole(p);
- makeHole(p - dir);
+ makeFill(p, dp.holesize, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
+ 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%
// (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);
for (u16 st = 0; st < stair_width; st++) {
- 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)) &&
- vm->m_data[vi].getContent() == dp.c_wall)
- vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
-
- vi = vm->m_area.index(ps.X, ps.Y, ps.Z);
- if (vm->m_area.contains(ps) &&
- vm->m_data[vi].getContent() == dp.c_wall)
- vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
-
+ if (make_stairs == -1) {
+ 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)) &&
+ 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);
+ }
+ } else if (make_stairs == 1) {
+ u32 vi = vm->m_area.index(ps.X, ps.Y - 1, ps.Z);
+ 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);
+ }
+ }
ps += swv;
}
}