summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-09 04:04:56 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-09 04:04:56 +0100
commit9e77db8e3d4f8e046c1db26d9889f440e761dc38 (patch)
tree3c4bf05ff03d0d93bd3b98cabbd7e1e0ac8a5913
parentRedstone clocks now work. even one clocks. torches don't update themselves when placed yet, but redstone wire updates the torch. Fixed a bug with piston animations. (diff)
downloadcuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar.gz
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar.bz2
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar.lz
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar.xz
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.tar.zst
cuberite-9e77db8e3d4f8e046c1db26d9889f440e761dc38.zip
-rw-r--r--VC2010/MCServer.sln1
-rw-r--r--source/cRedstone.cpp49
-rw-r--r--source/cWorld.cpp10
3 files changed, 44 insertions, 16 deletions
diff --git a/VC2010/MCServer.sln b/VC2010/MCServer.sln
index 79a5670f1..4f9effab0 100644
--- a/VC2010/MCServer.sln
+++ b/VC2010/MCServer.sln
@@ -3,6 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcxproj", "{D8FE2186-4BF0-4B89-913F-6C26818E5AC5}"
ProjectSection(ProjectDependencies) = postProject
+ {4571CE2D-9E18-452F-90D6-94AE8E2406F4} = {4571CE2D-9E18-452F-90D6-94AE8E2406F4}
{ADBF25B9-7192-4E54-B35E-8EC47CA5EF86} = {ADBF25B9-7192-4E54-B35E-8EC47CA5EF86}
{2B4BD5C6-91C0-4A74-939F-B28737FB0DC6} = {2B4BD5C6-91C0-4A74-939F-B28737FB0DC6}
EndProjectSection
diff --git a/source/cRedstone.cpp b/source/cRedstone.cpp
index 1a981e654..21b1eb416 100644
--- a/source/cRedstone.cpp
+++ b/source/cRedstone.cpp
@@ -63,6 +63,7 @@ char before;
m_Metadata = 0;
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
+ m_Direction = 4;
break;
}
case E_BLOCK_REDSTONE_WIRE: //special case for redstone wire.
@@ -75,6 +76,18 @@ char before;
CalculatetRedstone( fillx, filly, fillz+1 );
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
+
+ m_Direction = 4;
+ CalculatetRedstone( fillx+1, filly+1, fillz );
+ CalculatetRedstone( fillx-1, filly+1, fillz );
+ CalculatetRedstone( fillx, filly+1, fillz+1 );
+ CalculatetRedstone( fillx, filly+1, fillz-1 );
+
+ m_Direction = 4;
+ CalculatetRedstone( fillx+1, filly-1, fillz );
+ CalculatetRedstone( fillx-1, filly-1, fillz );
+ CalculatetRedstone( fillx, filly-1, fillz+1 );
+ CalculatetRedstone( fillx, filly-1, fillz-1 );
break;
}
}
@@ -206,6 +219,18 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
CalculatetRedstone( fillx, filly, fillz+1 );
m_Direction = 3;
CalculatetRedstone( fillx, filly, fillz-1 );
+
+ m_Direction = 4;
+ CalculatetRedstone( fillx+1, filly+1, fillz );
+ CalculatetRedstone( fillx-1, filly+1, fillz );
+ CalculatetRedstone( fillx, filly+1, fillz+1 );
+ CalculatetRedstone( fillx, filly+1, fillz-1 );
+
+ m_Direction = 5;
+ CalculatetRedstone( fillx+1, filly-1, fillz );
+ CalculatetRedstone( fillx-1, filly-1, fillz );
+ CalculatetRedstone( fillx, filly-1, fillz+1 );
+ CalculatetRedstone( fillx, filly-1, fillz-1 );
}
} else { //default, check item for torch attached to it. If meta > 0 then turn that torch off, otherwise turn it on. This change needs to be passed to the next world tick.
@@ -215,40 +240,40 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
//check for torch to north with meta 4 //turn off
//check for torch above with meta 5 //turn off
if ( (int)m_World->GetBlock( fillx, filly, fillz ) != E_BLOCK_AIR ) {
-
+ if (m_Direction < 4) { //redstone wire can only power blocks on the same plane or directly below
if ( (int)m_Metadata > 0 ) { //wire powered
//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->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->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->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->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->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);
@@ -262,35 +287,35 @@ 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->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->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->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->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->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);
@@ -301,6 +326,8 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
}
+ }
+
}
}
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index ce5f2ed7a..3457f47dd 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -457,14 +457,14 @@ void cWorld::Tick(float a_Dt)
state = *cii;cii++;
//printf ("%i, %i, %i, %i\n",tempX,tempY,tempZ,state) ;
- if ( (state == 00000) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_OFF ) ) {
- FastSetBlock( tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_OFF, (int)GetBlockMeta( tempX, tempY, tempZ ) );
- cRedstone Redstone(this);
- Redstone.ChangeRedstone( tempX, tempY, tempZ, false );
- } else if ( (state == 11111) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_ON ) ) {
+ if ( (state == 11111) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_OFF ) ) {
FastSetBlock( tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_ON, (int)GetBlockMeta( tempX, tempY, tempZ ) );
cRedstone Redstone(this);
Redstone.ChangeRedstone( tempX, tempY, tempZ, true );
+ } else if ( (state == 00000) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_ON ) ) {
+ FastSetBlock( tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_OFF, (int)GetBlockMeta( tempX, tempY, tempZ ) );
+ cRedstone Redstone(this);
+ Redstone.ChangeRedstone( tempX, tempY, tempZ, false );
}
}