summaryrefslogtreecommitdiffstats
path: root/src/Generating/DungeonRoomsFinisher.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-10-15 22:10:14 +0200
committerSTRWarrior <niels.breuker@hotmail.nl>2014-10-15 22:10:14 +0200
commit3f0d4fe250288a97845bdc4ce8f4f20e00fee728 (patch)
tree127b057774755f691b9730f87c19e38c0f826b67 /src/Generating/DungeonRoomsFinisher.cpp
parentAdded loot to dungeons. (diff)
downloadcuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar.gz
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar.bz2
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar.lz
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar.xz
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.tar.zst
cuberite-3f0d4fe250288a97845bdc4ce8f4f20e00fee728.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/DungeonRoomsFinisher.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/Generating/DungeonRoomsFinisher.cpp b/src/Generating/DungeonRoomsFinisher.cpp
index de3a426a1..68c040fbe 100644
--- a/src/Generating/DungeonRoomsFinisher.cpp
+++ b/src/Generating/DungeonRoomsFinisher.cpp
@@ -180,6 +180,12 @@ protected:
static const cLootProbab LootProbab[] =
{
// Item, MinAmount, MaxAmount, Weight
+ { cItem(E_ITEM_GOLDEN_APPLE), 1, 1, 1 },
+ { cItem(E_ITEM_DIAMOND_HORSE_ARMOR), 1, 1, 1 },
+ { cItem(E_ITEM_GOLD_HORSE_ARMOR), 1, 1, 2 },
+ { cItem(E_ITEM_13_DISC), 1, 1, 4 },
+ { cItem(E_ITEM_CAT_DISC), 1, 1, 4 },
+ { cItem(E_ITEM_IRON_HORSE_ARMOR), 1, 1, 5 },
{ cItem(E_ITEM_IRON), 1, 4, 10 },
{ cItem(E_ITEM_WHEAT), 1, 4, 10 },
{ cItem(E_ITEM_GUNPOWDER), 1, 4, 10 },
@@ -189,11 +195,6 @@ protected:
{ cItem(E_ITEM_BUCKET), 1, 1, 10 },
{ cItem(E_ITEM_BREAD), 1, 1, 10 },
{ cItem(E_ITEM_NAME_TAG), 1, 1, 10 },
- { cItem(E_ITEM_IRON_HORSE_ARMOR), 1, 1, 5 },
- { cItem(E_ITEM_13_DISC), 1, 1, 4 },
- { cItem(E_ITEM_CAT_DISC), 1, 1, 4 },
- { cItem(E_ITEM_GOLD_HORSE_ARMOR), 1, 1, 2 },
- { cItem(E_ITEM_DIAMOND_HORSE_ARMOR), 1, 1, 1 },
} ;
cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ);
@@ -209,6 +210,9 @@ protected:
// cGridStructGen::cStructure override:
virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) override
{
+ int CenterX = (m_StartX + m_EndX) / 2 - a_ChunkDesc.GetChunkX() * cChunkDef::Width;
+ int CenterZ = (m_StartZ + m_EndZ) / 2 - a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
+
if (
(m_EndX < a_ChunkDesc.GetChunkX() * cChunkDef::Width) ||
(m_StartX >= a_ChunkDesc.GetChunkX() * cChunkDef::Width + cChunkDef::Width) ||
@@ -219,6 +223,12 @@ protected:
// The chunk is not intersecting the room at all, bail out
return;
}
+
+ if (!cBlockInfo::CanBeTerraformed(a_ChunkDesc.GetBlockType(CenterX, m_FloorHeight + 1, CenterZ)))
+ {
+ return;
+ }
+
int b = m_FloorHeight + 1; // Bottom
int t = m_FloorHeight + 1 + ROOM_HEIGHT; // Top
ReplaceCuboidRandom(a_ChunkDesc, m_StartX, m_FloorHeight, m_StartZ, m_EndX + 1, b, m_EndZ + 1, E_BLOCK_MOSSY_COBBLESTONE, E_BLOCK_COBBLESTONE); // Floor
@@ -235,8 +245,6 @@ protected:
TryPlaceChest(a_ChunkDesc, m_Chest2);
// Place the spawner:
- int CenterX = (m_StartX + m_EndX) / 2 - a_ChunkDesc.GetChunkX() * cChunkDef::Width;
- int CenterZ = (m_StartZ + m_EndZ) / 2 - a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
if (
(CenterX >= 0) && (CenterX < cChunkDef::Width) &&
(CenterZ >= 0) && (CenterZ < cChunkDef::Width)