21 #include "../Cuboid.h"
22 #include "../BlockEntities/ChestEntity.h"
23 #include "../BlockEntities/MobSpawnerEntity.h"
29 class cMineShaft
abstract
56 m_ParentSystem(a_ParentSystem),
62 m_ParentSystem(a_ParentSystem),
64 m_BoundingBox(a_BoundingBox)
68 virtual ~cMineShaft() {}
71 bool DoesIntersect(
const cCuboid & a_Other)
78 virtual void AppendBranches(
int a_RecursionLevel,
cNoise & a_Noise) = 0;
81 virtual void ProcessChunk(
cChunkDesc & a_ChunkDesc) = 0;
120 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
136 const cCuboid & a_BoundingBox,
int a_NumSegments, eDirection a_Direction,
173 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
208 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
220 eDirection a_Direction,
254 int a_GridX,
int a_GridZ,
int a_OriginX,
int a_OriginZ,
255 int a_GridSize,
int a_MaxSystemSize,
cNoise & a_Noise,
256 int a_ProbLevelCorridor,
int a_ProbLevelCrossing,
int a_ProbLevelStaircase
265 int a_BlockX,
int a_BlockY,
int a_BlockZ,
266 cMineShaft::eDirection a_Direction,
cNoise & a_Noise,
285 int a_GridX,
int a_GridZ,
int a_OriginX,
int a_OriginZ,
286 int a_GridSize,
int a_MaxSystemSize,
cNoise & a_Noise,
287 int a_ProbLevelCorridor,
int a_ProbLevelCrossing,
int a_ProbLevelStaircase
289 Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
290 m_GridSize(a_GridSize),
292 m_ProbLevelCorridor(a_ProbLevelCorridor),
293 m_ProbLevelCrossing(a_ProbLevelCrossing),
294 m_ProbLevelStaircase(a_ProbLevelStaircase + 1),
305 {Start->m_BoundingBox.p1.x - a_MaxSystemSize / 2, 2, Start->m_BoundingBox.p1.z - a_MaxSystemSize / 2},
306 {Start->m_BoundingBox.p2.x + a_MaxSystemSize / 2, 50, Start->m_BoundingBox.p2.z + a_MaxSystemSize / 2}
309 Start->AppendBranches(0, a_Noise);
313 ASSERT((*itr)->m_BoundingBox.IsSorted());
323 for (cMineShafts::iterator itr = m_MineShafts.begin(), end = m_MineShafts.end(); itr != end; ++itr)
327 m_MineShafts.clear();
336 for (cMineShafts::const_iterator itr = m_MineShafts.begin(), end = m_MineShafts.end(); itr != end; ++itr)
338 (*itr)->ProcessChunk(a_Chunk);
347 int a_PivotX,
int a_PivotY,
int a_PivotZ,
348 cMineShaft::eDirection a_Direction,
cNoise & a_Noise,
352 if (a_RecursionLevel > m_MaxRecursion)
375 m_MineShafts.push_back(Next);
376 Next->AppendBranches(a_RecursionLevel + 1, a_Noise);
392 for (cMineShafts::const_iterator itr = m_MineShafts.begin(), end = m_MineShafts.end(); itr != end; ++itr)
394 if ((*itr)->DoesIntersect(a_BoundingBox))
410 Super(a_Parent, mskDirtRoom)
419 m_BoundingBox.
p2.
x = m_BoundingBox.
p1.
x + 10 + (rnd % 8);
422 m_BoundingBox.
p2.
z = m_BoundingBox.
p1.
z + 10 + (rnd % 8);
424 m_BoundingBox.
p1.
y = 20;
425 m_BoundingBox.
p2.
y = 24 + rnd % 8;
434 int Height = m_BoundingBox.
DifY() - 3;
435 for (
int x = m_BoundingBox.
p1.
x + 1; x < m_BoundingBox.
p2.
x; x += 4)
437 int rnd = a_Noise.
IntNoise3DInt(x, a_RecursionLevel, m_BoundingBox.
p1.
z) / 7;
438 m_ParentSystem.
AppendBranch(x, m_BoundingBox.
p1.
y + (rnd % Height), m_BoundingBox.
p1.
z - 1, dirZM, a_Noise, a_RecursionLevel);
440 m_ParentSystem.
AppendBranch(x, m_BoundingBox.
p1.
y + (rnd % Height), m_BoundingBox.
p2.
z + 1, dirZP, a_Noise, a_RecursionLevel);
443 for (
int z = m_BoundingBox.
p1.
z + 1; z < m_BoundingBox.
p2.
z; z += 4)
445 int rnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x, a_RecursionLevel, z) / 13;
446 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x - 1, m_BoundingBox.
p1.
y + (rnd % Height), z, dirXM, a_Noise, a_RecursionLevel);
448 m_ParentSystem.
AppendBranch(m_BoundingBox.
p2.
x + 1, m_BoundingBox.
p1.
y + (rnd % Height), z, dirXP, a_Noise, a_RecursionLevel);
463 (m_BoundingBox.
p2.
x < BlockX) ||
464 (m_BoundingBox.
p2.
z < BlockZ)
472 int MinX = std::max(BlockX, m_BoundingBox.
p1.
x) - BlockX;
474 int MinZ = std::max(BlockZ, m_BoundingBox.
p1.
z) - BlockZ;
478 for (
int z = MinZ; z < MaxZ; z++)
480 for (
int x = MinX; x < MaxX; x++)
482 for (
int y = m_BoundingBox.
p1.
y + 1; y < m_BoundingBox.
p2.
y; y++)
503 const cCuboid & a_BoundingBox,
int a_NumSegments, eDirection a_Direction,
506 Super(a_ParentSystem, mskCorridor, a_BoundingBox),
507 m_NumSegments(a_NumSegments),
508 m_Direction(a_Direction),
510 m_SpawnerPosition(-1)
513 for (
int i = 0; i < a_NumSegments; i++)
521 int ChestCheck = rnd % 250;
523 int SpawnerCheck = rnd % 250;
529 if ((a_NumSegments < 4) && (SpawnerCheck < a_ParentSystem.
m_ChanceSpawner))
541 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
545 cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
546 BoundingBox.
p2.
y += 3;
547 int rnd = a_Noise.
IntNoise3DInt(a_PivotX, a_PivotY +
static_cast<int>(a_ParentSystem.
m_MineShafts.size()), a_PivotZ) / 7;
551 case dirXP: BoundingBox.
p2.
x += NumSegments * 5 - 1; BoundingBox.
p1.
z -= 1; BoundingBox.
p2.
z += 1;
break;
552 case dirXM: BoundingBox.
p1.
x -= NumSegments * 5 - 1; BoundingBox.
p1.
z -= 1; BoundingBox.
p2.
z += 1;
break;
553 case dirZP: BoundingBox.
p2.
z += NumSegments * 5 - 1; BoundingBox.
p1.
x -= 1; BoundingBox.
p2.
x += 1;
break;
554 case dirZM: BoundingBox.
p1.
z -= NumSegments * 5 - 1; BoundingBox.
p1.
x -= 1; BoundingBox.
p2.
x += 1;
break;
556 if (!a_ParentSystem.
CanAppend(BoundingBox))
560 return new cMineShaftCorridor(a_ParentSystem, BoundingBox, NumSegments, a_Direction, a_Noise);
569 int Outerrnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x, m_BoundingBox.
p1.
y + a_RecursionLevel, m_BoundingBox.
p1.
z) / 7;
571 int OuterHeight = m_BoundingBox.
p1.
y + ((Outerrnd % 4) + ((Outerrnd >> 3) % 3)) / 2;
576 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x - 1, OuterHeight, m_BoundingBox.
p1.
z + 1, dirXM, a_Noise, a_RecursionLevel);
579 int rnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x + i + 10, m_BoundingBox.
p1.
y + a_RecursionLevel, m_BoundingBox.
p1.
z) / 11;
580 int Height = m_BoundingBox.
p1.
y + ((rnd % 4) + ((rnd >> 3) % 3)) / 2;
583 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + Ofs, Height, m_BoundingBox.
p1.
z - 1, dirZM, a_Noise, a_RecursionLevel);
584 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + Ofs, Height, m_BoundingBox.
p2.
z + 1, dirZP, a_Noise, a_RecursionLevel);
591 m_ParentSystem.
AppendBranch(m_BoundingBox.
p2.
x + 1, OuterHeight, m_BoundingBox.
p1.
z + 1, dirXP, a_Noise, a_RecursionLevel);
594 int rnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x + i + 10, m_BoundingBox.
p1.
y + a_RecursionLevel, m_BoundingBox.
p1.
z) / 11;
595 int Height = m_BoundingBox.
p1.
y + ((rnd % 4) + ((rnd >> 3) % 3)) / 2;
598 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + Ofs, Height, m_BoundingBox.
p1.
z - 1, dirZM, a_Noise, a_RecursionLevel);
599 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + Ofs, Height, m_BoundingBox.
p2.
z + 1, dirZP, a_Noise, a_RecursionLevel);
606 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + 1, OuterHeight, m_BoundingBox.
p1.
z - 1, dirZM, a_Noise, a_RecursionLevel);
609 int rnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x + i + 10, m_BoundingBox.
p1.
y + a_RecursionLevel, m_BoundingBox.
p1.
z) / 11;
610 int Height = m_BoundingBox.
p1.
y + ((rnd % 4) + ((rnd >> 3) % 3)) / 2;
613 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x - 1, Height, m_BoundingBox.
p1.
z + Ofs, dirXM, a_Noise, a_RecursionLevel);
614 m_ParentSystem.
AppendBranch(m_BoundingBox.
p2.
x + 1, Height, m_BoundingBox.
p1.
z + Ofs, dirXP, a_Noise, a_RecursionLevel);
621 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + 1, OuterHeight, m_BoundingBox.
p2.
z + 1, dirZP, a_Noise, a_RecursionLevel);
624 int rnd = a_Noise.
IntNoise3DInt(m_BoundingBox.
p1.
x + i + 10, m_BoundingBox.
p1.
y + a_RecursionLevel, m_BoundingBox.
p1.
z) / 11;
625 int Height = m_BoundingBox.
p1.
y + ((rnd % 4) + ((rnd >> 3) % 3)) / 2;
628 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x - 1, Height, m_BoundingBox.
p1.
z + Ofs, dirXM, a_Noise, a_RecursionLevel);
629 m_ParentSystem.
AppendBranch(m_BoundingBox.
p2.
x + 1, Height, m_BoundingBox.
p1.
z + Ofs, dirXP, a_Noise, a_RecursionLevel);
644 cCuboid RelBoundingBox(m_BoundingBox);
645 RelBoundingBox.
Move({-BlockX, 0, -BlockZ});
646 RelBoundingBox.
p1.
y += 1;
647 RelBoundingBox.
p2.
y -= 1;
660 RelBoundingBox.
p1.
y = m_BoundingBox.
p1.
y;
661 RelBoundingBox.
p2.
y = m_BoundingBox.
p1.
y;
668 int y1 = m_BoundingBox.
p1.
y + 1;
669 int y2 = m_BoundingBox.
p1.
y + 2;
670 int y3 = m_BoundingBox.
p1.
y + 3;
671 int z1 = m_BoundingBox.
p1.
z - BlockZ;
672 int z2 = m_BoundingBox.
p2.
z - BlockZ;
675 int x = m_BoundingBox.
p1.
x + i * 5 + 2 - BlockX;
703 int y1 = m_BoundingBox.
p1.
y + 1;
704 int y2 = m_BoundingBox.
p1.
y + 2;
705 int y3 = m_BoundingBox.
p1.
y + 3;
706 int x1 = m_BoundingBox.
p1.
x - BlockX;
707 int x2 = m_BoundingBox.
p2.
x - BlockX;
710 int z = m_BoundingBox.
p1.
z + i * 5 + 2 - BlockZ;
781 z = m_BoundingBox.
p1.
z - BlockZ;
789 x = m_BoundingBox.
p1.
x - BlockX;
807 int NumSlots = 3 + ((Noise.
IntNoise3DInt(x, m_BoundingBox.
p1.
y, z) / 11) % 4);
914 int x = m_BoundingBox.
p1.
x + i * 5 + 1 - BlockX;
949 int z = m_BoundingBox.
p1.
z + i * 5 + 1 - BlockZ;
979 Super(a_ParentSystem, mskCrossing, a_BoundingBox)
989 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
993 cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
994 int rnd = a_Noise.
IntNoise3DInt(a_PivotX, a_PivotY +
static_cast<int>(a_ParentSystem.
m_MineShafts.size()), a_PivotZ) / 7;
995 BoundingBox.
p2.
y += 3;
999 BoundingBox.
p2.
y += 4;
1004 BoundingBox.
p1.
y -= 4;
1005 BoundingBox.
p2.
y -= 4;
1008 switch (a_Direction)
1010 case dirXP: BoundingBox.
p2.
x += 4; BoundingBox.
p1.
z -= 2; BoundingBox.
p2.
z += 2;
break;
1011 case dirXM: BoundingBox.
p1.
x -= 4; BoundingBox.
p1.
z -= 2; BoundingBox.
p2.
z += 2;
break;
1012 case dirZP: BoundingBox.
p2.
z += 4; BoundingBox.
p1.
x -= 2; BoundingBox.
p2.
x += 2;
break;
1013 case dirZM: BoundingBox.
p1.
z -= 4; BoundingBox.
p1.
x -= 2; BoundingBox.
p2.
x += 2;
break;
1015 if (!a_ParentSystem.
CanAppend(BoundingBox))
1045 for (
size_t i = 0; i <
ARRAYCOUNT(Exits); i++)
1047 if (m_BoundingBox.
p1.
y + Exits[i].y >= m_BoundingBox.
p2.
y)
1053 int Height = m_BoundingBox.
p1.
y + Exits[i].y;
1054 m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + Exits[i].x, Height, m_BoundingBox.
p1.
z + Exits[i].z, Exits[i].dir, a_Noise, a_RecursionLevel);
1067 box.
Move({-BlockX, 0, -BlockZ});
1073 int Floor = box.
p1.
y + 1;
1074 int Ceil = box.
p2.
y;
1087 int Mid = Floor + 2;
1115 const cCuboid & a_BoundingBox,
1116 eDirection a_Direction,
1119 Super(a_ParentSystem, mskStaircase, a_BoundingBox),
1120 m_Direction(a_Direction),
1131 int a_PivotX,
int a_PivotY,
int a_PivotZ, eDirection a_Direction,
1135 int rnd = a_Noise.
IntNoise3DInt(a_PivotX, a_PivotY +
static_cast<int>(a_ParentSystem.
m_MineShafts.size()), a_PivotZ) / 7;
1137 switch (a_Direction)
1141 Box.
Assign({a_PivotX - 7, a_PivotY - 1, a_PivotZ - 1}, {a_PivotX, a_PivotY + 6, a_PivotZ + 1});
1146 Box.
Assign({a_PivotX, a_PivotY - 1, a_PivotZ - 1}, {a_PivotX + 7, a_PivotY + 6, a_PivotZ + 1});
1151 Box.
Assign({a_PivotX - 1, a_PivotY - 1, a_PivotZ - 7}, {a_PivotX + 1, a_PivotY + 6, a_PivotZ});
1156 Box.
Assign({a_PivotX - 1, a_PivotY - 1, a_PivotZ}, {a_PivotX + 1, a_PivotY + 6, a_PivotZ + 7});
1164 Box.
Move({0, -4, 0});
1182 case dirXM: m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x - 1, Height, m_BoundingBox.
p1.
z + 1, dirXM, a_Noise, a_RecursionLevel);
break;
1183 case dirXP: m_ParentSystem.
AppendBranch(m_BoundingBox.
p2.
x + 1, Height, m_BoundingBox.
p1.
z + 1, dirXP, a_Noise, a_RecursionLevel);
break;
1184 case dirZM: m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + 1, Height, m_BoundingBox.
p1.
z - 1, dirZM, a_Noise, a_RecursionLevel);
break;
1185 case dirZP: m_ParentSystem.
AppendBranch(m_BoundingBox.
p1.
x + 1, Height, m_BoundingBox.
p2.
z + 1, dirZP, a_Noise, a_RecursionLevel);
break;
1198 RelB.
Move({-BlockX, 0, -BlockZ});
1223 Box.
Assign({RelB.
p2.
x - 2, SFloor + InitAdd, RelB.
p1.
z}, {RelB.
p2.
x - 2, SFloor + 3 + InitAdd, RelB.
p2.
z});
1224 for (
int i = 0; i < 4; i++)
1228 Box.
Move({-1, Add, 0});
1239 Box.
Assign({RelB.
p1.
x + 2, SFloor + InitAdd, RelB.
p1.
z}, {RelB.
p1.
x + 2, SFloor + 3 + InitAdd, RelB.
p2.
z});
1240 for (
int i = 0; i < 4; i++)
1244 Box.
Move({1, Add, 0});
1255 Box.
Assign({RelB.
p1.
x, SFloor + InitAdd, RelB.
p2.
z - 2}, {RelB.
p2.
x, SFloor + 3 + InitAdd, RelB.
p2.
z - 2});
1256 for (
int i = 0; i < 4; i++)
1260 Box.
Move({0, Add, -1});
1271 Box.
Assign({RelB.
p1.
x, SFloor + InitAdd, RelB.
p1.
z + 2}, {RelB.
p2.
x, SFloor + 3 + InitAdd, RelB.
p1.
z + 2});
1272 for (
int i = 0; i < 4; i++)
1276 Box.
Move({0, Add, 1});
1292 int a_Seed,
int a_GridSize,
int a_MaxOffset,
int a_MaxSystemSize,
1293 int a_ChanceCorridor,
int a_ChanceCrossing,
int a_ChanceStaircase
1295 Super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
1296 m_GridSize(a_GridSize),
1297 m_MaxSystemSize(a_MaxSystemSize),
1298 m_ProbLevelCorridor(
std::max(0, a_ChanceCorridor)),
1299 m_ProbLevelCrossing(
std::max(0, a_ChanceCorridor + a_ChanceCrossing)),
1300 m_ProbLevelStaircase(
std::max(0, a_ChanceCorridor + a_ChanceCrossing + a_ChanceStaircase))
@ E_BLOCK_MINECART_TRACKS
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
std::vector< cMineShaft * > cMineShafts
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
BLOCKTYPE GetBlockType() const
cItemGrid & GetContents(void)
Returns the ItemGrid used for storing the contents.
void SetEntity(eMonsterType a_EntityType)
void Assign(Vector3i a_Point1, Vector3i a_Point2)
void Move(Vector3i a_Offset)
Moves the cuboid by the specified offset.
bool IsCompletelyInside(const cCuboid &a_Outer) const
Returns true if this cuboid is completely inside the specified cuboid (in all 6 coords).
bool DoesIntersect(const cCuboid &a_Other) const
Returns true if the cuboids have at least one voxel in common.
cBlockEntity * GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
Returns the block entity at the specified coords.
void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
void RandomFillRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_RandomSeed, int a_ChanceOutOf10k)
Fills the relative cuboid with specified block with a random chance; allows cuboid out of range of th...
void FillRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Fills the relative cuboid with specified block; allows cuboid out of range of this chunk.
void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
void FloorRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air,...
BLOCKTYPE GetBlockType(int a_RelX, int a_RelY, int a_RelZ) const
Generates structures in a semi-random grid.
std::shared_ptr< cStructure > cStructurePtr
cNoise m_Noise
The noise used for generating grid offsets.
Represents a single structure that occupies the grid point.
int m_OriginX
The origin (the coords for which the structure is generated)
virtual void AppendBranches(int a_RecursionLevel, cNoise &a_Noise) override
cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem &a_Parent, cNoise &a_Noise)
virtual void ProcessChunk(cChunkDesc &a_ChunkDesc) override
bool m_HasFullBeam[MAX_SEGMENTS]
If true, segment at that index has a full beam support (planks in the top center block)
int m_ChestPosition
If <0, no chest; otherwise an offset from m_BoundingBox's p1.x or p1.z, depenging on m_Direction.
void PlaceSpawner(cChunkDesc &a_ChunkDesc)
If this corridor has a spawner, places the spawner.
cMineShaftCorridor(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, const cCuboid &a_BoundingBox, int a_NumSegments, eDirection a_Direction, cNoise &a_Noise)
bool m_HasTracks
If true, random tracks will be placed on the floor.
void PlaceTorches(cChunkDesc &a_ChunkDesc)
Randomly places torches around the central beam block.
virtual void AppendBranches(int a_RecursionLevel, cNoise &a_Noise) override
void PlaceTracks(cChunkDesc &a_ChunkDesc)
If this corridor has tracks, places them randomly.
static cMineShaft * CreateAndFit(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction, cNoise &a_Noise)
Creates a new Corridor attached to the specified pivot point and direction.
void PlaceChest(cChunkDesc &a_ChunkDesc)
Places a chest, if the corridor has one.
int m_SpawnerPosition
If <0, no spawner; otherwise an offset from m_BoundingBox's p1.x or p1.z, depenging on m_Direction.
virtual void ProcessChunk(cChunkDesc &a_ChunkDesc) override
static const int MAX_SEGMENTS
static cMineShaft * CreateAndFit(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction, cNoise &a_Noise)
Creates a new Crossing attached to the specified pivot point and direction.
virtual void AppendBranches(int a_RecursionLevel, cNoise &a_Noise) override
cMineShaftCrossing(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, const cCuboid &a_BoundingBox)
virtual void ProcessChunk(cChunkDesc &a_ChunkDesc) override
static cMineShaft * CreateAndFit(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction, cNoise &a_Noise)
Creates a new Staircase attached to the specified pivot point and direction.
virtual void AppendBranches(int a_RecursionLevel, cNoise &a_Noise) override
virtual void ProcessChunk(cChunkDesc &a_ChunkDesc) override
cMineShaftStaircase(cStructGenMineShafts::cMineShaftSystem &a_ParentSystem, const cCuboid &a_BoundingBox, eDirection a_Direction, eSlope a_Slope)
int m_ProbLevelCorridor
Probability level of a branch object being the corridor.
virtual void DrawIntoChunk(cChunkDesc &a_Chunk) override
Draws self into the specified chunk.
cMineShaftSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxSystemSize, cNoise &a_Noise, int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase)
Creates and generates the entire system.
int m_ChanceTorch
Chance [0 .. 10k] for a torch appearing attached to a corridor's beam.
int m_ChanceChest
Chance [0 .. 250] that a corridor has a chest in it.
virtual ~cMineShaftSystem() override
void AppendBranch(int a_BlockX, int a_BlockY, int a_BlockZ, cMineShaft::eDirection a_Direction, cNoise &a_Noise, int a_RecursionLevel)
Creates new cMineShaft descendant connected at the specified point, heading the specified direction,...
int m_ChanceSpawner
Chance [0 .. 250] that a corridor has a spawner in it.
bool CanAppend(const cCuboid &a_BoundingBox)
Returns true if none of the objects in m_MineShafts intersect with the specified bounding box and the...
cCuboid m_BoundingBox
Bounding box into which all of the components need to fit.
cMineShafts m_MineShafts
List of cMineShaft descendants that comprise this system.
int m_GridSize
Maximum offset of the dirtroom from grid center, * 2, in each direction.
int m_MaxRecursion
Maximum recursion level (initialized from cStructGenMineShafts::m_MaxRecursion)
int m_ProbLevelStaircase
Probability level of a branch object being the staircase, minus Crossing.
int m_ProbLevelCrossing
Probability level of a branch object being the crossing, minus Corridor.
int m_ProbLevelCrossing
Probability level of a branch object being the crossing, minus Corridor.
int m_ProbLevelStaircase
Probability level of a branch object being the staircase, minus Crossing.
int m_GridSize
Average spacing of the systems.
friend class cMineShaftDirtRoom
int m_ProbLevelCorridor
Probability level of a branch object being the corridor.
int m_MaxSystemSize
Maximum blcok size of a mineshaft system.
virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override
Create a new structure at the specified gridpoint.
cStructGenMineShafts(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize, int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase)
Used to store loot probability tables.
void GenerateRandomLootWithBooks(const cLootProbab *a_LootProbabs, size_t a_CountLootProbabs, int a_NumSlots, int a_Seed)
Generates random loot from the specified loot probability table, with a chance of enchanted books add...
int IntNoise3DInt(int a_X, int a_Y, int a_Z) const
int IntNoise2DInt(int a_X, int a_Y) const