summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp4
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockID.h8
-rw-r--r--source/Generating/MineShafts.cpp55
4 files changed, 60 insertions, 9 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 79b857a82..da51018d1 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/31/13 20:59:24.
+** Generated automatically by tolua++-1.0.92 on 03/31/13 21:21:48.
*/
#ifndef __cplusplus
@@ -23264,6 +23264,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL);
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_NORMAL",E_META_GOLDEN_APPLE_NORMAL);
tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_ENCHANTED",E_META_GOLDEN_APPLE_ENCHANTED);
+ tolua_constant(tolua_S,"E_META_TRACKS_X",E_META_TRACKS_X);
+ tolua_constant(tolua_S,"E_META_TRACKS_Z",E_META_TRACKS_Z);
tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK);
tolua_constant(tolua_S,"E_META_DYE_RED",E_META_DYE_RED);
tolua_constant(tolua_S,"E_META_DYE_GREEN",E_META_DYE_GREEN);
diff --git a/source/Bindings.h b/source/Bindings.h
index e8e84f093..b92bd1cfb 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/31/13 20:59:25.
+** Generated automatically by tolua++-1.0.92 on 03/31/13 21:21:49.
*/
/* Exported function */
diff --git a/source/BlockID.h b/source/BlockID.h
index 5110c86ad..927b75865 100644
--- a/source/BlockID.h
+++ b/source/BlockID.h
@@ -473,8 +473,6 @@ enum
-
-
enum
{
// E_ITEM_COAL metas:
@@ -484,7 +482,11 @@ enum
// E_ITEM_GOLDEN_APPLE metas:
E_META_GOLDEN_APPLE_NORMAL = 0,
E_META_GOLDEN_APPLE_ENCHANTED = 1,
-
+
+ // E_ITEM_MINECART_TRACKS metas:
+ E_META_TRACKS_X = 1,
+ E_META_TRACKS_Z = 0,
+
// E_ITEM_DYE metas:
E_META_DYE_BLACK = 0,
E_META_DYE_RED = 1,
diff --git a/source/Generating/MineShafts.cpp b/source/Generating/MineShafts.cpp
index d3fda194a..3d59d5fe7 100644
--- a/source/Generating/MineShafts.cpp
+++ b/source/Generating/MineShafts.cpp
@@ -131,6 +131,7 @@ protected:
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
int m_SpawnerPosition; ///< If <0, no spawner; otherwise an offset from m_BoundingBox's p1.x or p1.z, depenging on m_Direction
+ bool m_HasTracks; ///< If true, random tracks will be placed on the floor
cMineShaftCorridor(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
@@ -144,6 +145,9 @@ protected:
/// Places a chest, if the corridor has one
void PlaceChest(cChunkDesc & a_ChunkDesc);
+
+ /// If this corridor has tracks, places them randomly
+ void PlaceTracks(cChunkDesc & a_ChunkDesc);
} ;
@@ -505,6 +509,7 @@ cMineShaftCorridor::cMineShaftCorridor(
m_HasFullBeam[i] = (rnd % 4) < 3; // 75 % chance of full beam
rnd >>= 2;
}
+ m_HasTracks = ((rnd % 4) < 2); // 50 % chance of tracks
rnd = a_Noise.IntNoise3DInt(a_BoundingBox.p1.z, a_BoundingBox.p1.x, a_BoundingBox.p1.y) / 7;
int ChestCheck = rnd % 250;
@@ -630,13 +635,17 @@ void cMineShaftCorridor::ProcessChunk(cChunkDesc & a_ChunkDesc)
{
int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width;
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
+ BLOCKTYPE FillBlock = (m_SpawnerPosition >= 0) ? E_BLOCK_COBWEB : E_BLOCK_AIR;
cCuboid RelBoundingBox(m_BoundingBox);
RelBoundingBox.Move(-BlockX, 0, -BlockZ);
RelBoundingBox.p1.y += 1;
- BLOCKTYPE FillBlock = (m_SpawnerPosition >= 0) ? E_BLOCK_COBWEB : E_BLOCK_AIR;
+ RelBoundingBox.p2.y -= 1;
a_ChunkDesc.FillRelCuboid(RelBoundingBox, FillBlock, 0);
- RelBoundingBox.p1.y -= 1;
- RelBoundingBox.p2.y = RelBoundingBox.p1.y;
+ RelBoundingBox.p2.y += 1;
+ RelBoundingBox.p1.y = RelBoundingBox.p2.y;
+ a_ChunkDesc.RandomFillRelCuboid(RelBoundingBox, FillBlock, 0, BlockX ^ BlockZ + BlockX, 8000);
+ RelBoundingBox.p1.y = m_BoundingBox.p1.y;
+ RelBoundingBox.p2.y = m_BoundingBox.p1.y;
a_ChunkDesc.FloorRelCuboid(RelBoundingBox, E_BLOCK_PLANKS, 0);
switch (m_Direction)
{
@@ -711,8 +720,9 @@ void cMineShaftCorridor::ProcessChunk(cChunkDesc & a_ChunkDesc)
} // case dirZ?
} // for i
- // Place the chest, if present:
PlaceChest(a_ChunkDesc);
+ PlaceTracks(a_ChunkDesc);
+ // TODO: Place spawner (must be after Tracks!
}
@@ -768,6 +778,43 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
+void cMineShaftCorridor::PlaceTracks(cChunkDesc & a_ChunkDesc)
+{
+ if (!m_HasTracks)
+ {
+ return;
+ }
+ cCuboid Box(m_BoundingBox);
+ Box.Move(-a_ChunkDesc.GetChunkX() * cChunkDef::Width, 1, -a_ChunkDesc.GetChunkZ() * cChunkDef::Width);
+ Box.p2.y = Box.p1.y;
+ Box.p1.x += 1;
+ Box.p2.x -= 1;
+ Box.p1.z += 1;
+ Box.p2.z -= 1;
+ NIBBLETYPE Meta = 0;
+ switch (m_Direction)
+ {
+ case dirXM:
+ case dirXP:
+ {
+ Meta = E_META_TRACKS_X;
+ break;
+ }
+
+ case dirZM:
+ case dirZP:
+ {
+ Meta = E_META_TRACKS_Z;
+ break;
+ }
+ } // switch (direction)
+ a_ChunkDesc.RandomFillRelCuboid(Box, E_BLOCK_MINECART_TRACKS, Meta, a_ChunkDesc.GetChunkX() + a_ChunkDesc.GetChunkZ(), 6000);
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cMineShaftCrossing: