summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-10 18:03:35 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-10 18:03:35 +0100
commit9f3f60c666dfb3c9cf1d80d5e518ade0191985ed (patch)
tree9361bd2f00b5e3875ad837fc790dde098910720a /source
parentMade block action sanity checks more robust, water buckets, lava buckets and empty buckets should all now work. (diff)
downloadcuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar.gz
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar.bz2
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar.lz
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar.xz
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.tar.zst
cuberite-9f3f60c666dfb3c9cf1d80d5e518ade0191985ed.zip
Diffstat (limited to 'source')
-rw-r--r--source/cRedstone.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/cRedstone.cpp b/source/cRedstone.cpp
index 21b1eb416..c022a5756 100644
--- a/source/cRedstone.cpp
+++ b/source/cRedstone.cpp
@@ -46,6 +46,8 @@ char before;
switch (Block)//these blocks won't trigger the normal calculaton because they are affected by the redstone around them. So we check each possible channel around them instead.
{
+ case E_BLOCK_REDSTONE_TORCH_ON:
+ case E_BLOCK_REDSTONE_TORCH_OFF:
case E_BLOCK_AIR:
case E_BLOCK_PISTON_EXTENSION:
case E_BLOCK_PISTON:
@@ -63,7 +65,8 @@ char before;
m_Metadata = 0;
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
- m_Direction = 4;
+ m_Metadata = 0;
+ CalculatetRedstone( fillx, filly-1, fillz );
break;
}
case E_BLOCK_REDSTONE_WIRE: //special case for redstone wire.
@@ -76,6 +79,8 @@ char before;
CalculatetRedstone( fillx, filly, fillz+1 );
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
+ m_Metadata = 0;
+ CalculatetRedstone( fillx, filly-1, fillz );
m_Direction = 4;
CalculatetRedstone( fillx+1, filly+1, fillz );
@@ -83,7 +88,7 @@ char before;
CalculatetRedstone( fillx, filly+1, fillz+1 );
CalculatetRedstone( fillx, filly+1, fillz-1 );
- m_Direction = 4;
+ m_Direction = 5;
CalculatetRedstone( fillx+1, filly-1, fillz );
CalculatetRedstone( fillx-1, filly-1, fillz );
CalculatetRedstone( fillx, filly-1, fillz+1 );
@@ -191,6 +196,7 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
CalculatetRedstone(fillx,filly,fillz+1);
}
+
} else if ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_OFF ) { //if the torch is off
//printf("found torch off\n");
// no need to change meta here.
@@ -219,6 +225,7 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
CalculatetRedstone( fillx, filly, fillz+1 );
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
+ CalculatetRedstone( fillx, filly-1, fillz ); //check one block below //similar to same plane
m_Direction = 4;
CalculatetRedstone( fillx+1, filly+1, fillz );
@@ -245,35 +252,30 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
//printf("bird: %i dog: %i \n",(int)m_World->GetBlock( fillx, filly+1, fillz ),(int)m_World->GetBlockMeta( fillx, filly+1, fillz));
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) == 1 ) ) { //east
- //m_World->FastSetBlock( fillx+1, filly, fillz, E_BLOCK_REDSTONE_TORCH_OFF, m_World->GetBlockMeta( fillx+1, filly, fillz) );
m_World->m_RSList.push_back(fillx+1);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz);
m_World->m_RSList.push_back(00000);
}
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) == 2 ) ) { //west
- //m_World->FastSetBlock( fillx-1, filly, fillz, E_BLOCK_REDSTONE_TORCH_OFF, m_World->GetBlockMeta( fillx-1, filly, fillz) );
m_World->m_RSList.push_back(fillx-1);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz);
m_World->m_RSList.push_back(00000);
}
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_TORCH_ON) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) == 3 ) ) { //south
- //m_World->FastSetBlock( fillx, filly, fillz+1, E_BLOCK_REDSTONE_TORCH_OFF, m_World->GetBlockMeta( fillx, filly, fillz+1) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz+1);
m_World->m_RSList.push_back(00000);
}
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_TORCH_ON) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) == 4 ) ) { //north
- //m_World->FastSetBlock( fillx, filly, fillz-1, E_BLOCK_REDSTONE_TORCH_OFF, m_World->GetBlockMeta( fillx, filly, fillz-1) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz-1);
m_World->m_RSList.push_back(00000);
}
if ( ( (int)m_World->GetBlock( fillx, filly+1, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) && ( (int)m_World->GetBlockMeta( fillx, filly+1, fillz) == 5 ) ) { //top
- //m_World->FastSetBlock( fillx, filly+1, fillz, E_BLOCK_REDSTONE_TORCH_OFF, m_World->GetBlockMeta( fillx, filly+1, fillz) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly+1);
m_World->m_RSList.push_back(fillz);
@@ -287,35 +289,30 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
//printf("echo: %i cruiser: %i \n",(int)m_World->GetBlock( fillx, filly+1, fillz ),(int)m_World->GetBlockMeta( fillx, filly+1, fillz));
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_OFF) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) == 1 ) ) { //east
- //m_World->FastSetBlock( fillx+1, filly, fillz, E_BLOCK_REDSTONE_TORCH_ON, m_World->GetBlockMeta( fillx+1, filly, fillz) );
m_World->m_RSList.push_back(fillx+1);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz);
m_World->m_RSList.push_back(11111);
}
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_OFF) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) == 2 ) ) { //west
- //m_World->FastSetBlock( fillx-1, filly, fillz, E_BLOCK_REDSTONE_TORCH_ON, m_World->GetBlockMeta( fillx-1, filly, fillz) );
m_World->m_RSList.push_back(fillx-1);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz);
m_World->m_RSList.push_back(11111);
}
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_TORCH_OFF) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) == 3 ) ) { //south
- //m_World->FastSetBlock( fillx, filly, fillz+1, E_BLOCK_REDSTONE_TORCH_ON, m_World->GetBlockMeta( fillx, filly, fillz+1) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz+1);
m_World->m_RSList.push_back(11111);;
}
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_TORCH_OFF) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) == 4 ) ) { //north
- //m_World->FastSetBlock( fillx, filly, fillz-1, E_BLOCK_REDSTONE_TORCH_ON, m_World->GetBlockMeta( fillx, filly, fillz-1) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly);
m_World->m_RSList.push_back(fillz-1);
m_World->m_RSList.push_back(11111);
}
if ( ( (int)m_World->GetBlock( fillx, filly+1, fillz ) == E_BLOCK_REDSTONE_TORCH_OFF) && ( (int)m_World->GetBlockMeta( fillx, filly+1, fillz) == 5 ) ) { //top
- //m_World->FastSetBlock( fillx, filly+1, fillz, E_BLOCK_REDSTONE_TORCH_ON, m_World->GetBlockMeta( fillx, filly+1, fillz) );
m_World->m_RSList.push_back(fillx);
m_World->m_RSList.push_back(filly+1);
m_World->m_RSList.push_back(fillz);
@@ -339,9 +336,14 @@ bool cRedstone::IsBlockPowered( int fillx, int filly, int fillz )
{
if ( (int)m_World->GetBlock( fillx, filly-1, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) { return true; }
+ if ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) { return true; }
+ if ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_ON) { return true; }
+ if ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_TORCH_ON) { return true; }
+ if ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_TORCH_ON) { return true; }
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) > 0 ) ) { return true; }
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) > 0 ) ) { return true; }
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) > 0 ) ) { return true; }
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) > 0 ) ) { return true; }
+ if ( ( (int)m_World->GetBlock( fillx, filly+1, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly+1, fillz) > 0 ) ) { return true; }
return false;
} \ No newline at end of file