summaryrefslogtreecommitdiffstats
path: root/source/cRedstone.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 03:36:05 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 03:36:05 +0100
commit6df50b40ee16d4c40ffc0067695b58d27e1afac8 (patch)
tree3415cc89713c6ca6d0ca2e878ff8d0a88502da1f /source/cRedstone.cpp
parentChange SetBlock to FastSetBlock in cRedstone.cpp and grass will now grow if any one hit block is above it. (diff)
downloadcuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar.gz
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar.bz2
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar.lz
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar.xz
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.tar.zst
cuberite-6df50b40ee16d4c40ffc0067695b58d27e1afac8.zip
Diffstat (limited to '')
-rw-r--r--source/cRedstone.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/source/cRedstone.cpp b/source/cRedstone.cpp
index 1d865373b..111c012e2 100644
--- a/source/cRedstone.cpp
+++ b/source/cRedstone.cpp
@@ -1,4 +1,5 @@
#include "cRedstone.h"
+#include "cPiston.h"
#include "cRoot.h"
#include "cWorld.h"
#include "BlockID.h"
@@ -62,23 +63,32 @@ void cRedstone::ChangeRedstoneTorch( int fillx, int filly, int fillz, bool added
void cRedstone::LightRedstone( int fillx, int filly, int fillz, char metadata)
{
- //cWorld* World = cRoot::Get()->GetWorld();
- if ( ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz) != metadata ) ) {
- m_World->FastSetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata );
- LightRedstone(fillx-1,filly,fillz,metadata);
- LightRedstone(fillx+1,filly,fillz,metadata);
- LightRedstone(fillx,filly,fillz-1,metadata);
- LightRedstone(fillx,filly,fillz+1,metadata);
+ if ( ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_STICKY_PISTON ) || ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_PISTON ) ) {
+ printf("rsPiston 1\n");
+ cPiston Piston(m_World);
+ if (metadata > 0) {
+ printf("rsPiston 2\n");
+ Piston.ExtendPiston(fillx, filly, fillz);
+ } else {
+ printf("rsPiston 3\n");
+ Piston.RetractPiston(fillx, filly, fillz);
+ }
+ } else if ( ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz) != metadata ) ) {
+ m_World->FastSetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata );
+ LightRedstone(fillx-1,filly,fillz,metadata);
+ LightRedstone(fillx+1,filly,fillz,metadata);
+ LightRedstone(fillx,filly,fillz-1,metadata);
+ LightRedstone(fillx,filly,fillz+1,metadata);
- LightRedstone(fillx-1,filly-1,fillz,metadata);
- LightRedstone(fillx+1,filly-1,fillz,metadata);
- LightRedstone(fillx,filly-1,fillz-1,metadata);
- LightRedstone(fillx,filly-1,fillz+1,metadata);
+ LightRedstone(fillx-1,filly-1,fillz,metadata);
+ LightRedstone(fillx+1,filly-1,fillz,metadata);
+ LightRedstone(fillx,filly-1,fillz-1,metadata);
+ LightRedstone(fillx,filly-1,fillz+1,metadata);
- LightRedstone(fillx-1,filly+1,fillz,metadata);
- LightRedstone(fillx+1,filly+1,fillz,metadata);
- LightRedstone(fillx,filly+1,fillz-1,metadata);
- LightRedstone(fillx,filly+1,fillz+1,metadata);
- }
+ LightRedstone(fillx-1,filly+1,fillz,metadata);
+ LightRedstone(fillx+1,filly+1,fillz,metadata);
+ LightRedstone(fillx,filly+1,fillz-1,metadata);
+ LightRedstone(fillx,filly+1,fillz+1,metadata);
+ }
}