summaryrefslogtreecommitdiffstats
path: root/source/cPiston.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-05 19:28:19 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-05 19:28:19 +0100
commitf32b5aafe824ab1d865ea0df8698ce45ccd1ca8b (patch)
treeba5f6257f478321730c3b7fd4097844920f5e853 /source/cPiston.cpp
parentdang finicky OS installs. >.> Bug fixes to make sure this compiles is more than two OS's. (diff)
downloadcuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar.gz
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar.bz2
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar.lz
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar.xz
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.tar.zst
cuberite-f32b5aafe824ab1d865ea0df8698ce45ccd1ca8b.zip
Diffstat (limited to '')
-rw-r--r--source/cPiston.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/cPiston.cpp b/source/cPiston.cpp
new file mode 100644
index 000000000..966c96c5b
--- /dev/null
+++ b/source/cPiston.cpp
@@ -0,0 +1,50 @@
+#include "cPiston.h"
+#include "cRoot.h"
+#include "cWorld.h"
+#include "BlockID.h"
+
+cPiston::cPiston( cWorld* a_World )
+ :m_World ( a_World )
+{
+
+}
+//Todo: All piston stuff below.
+void cPiston::ExtendPiston( int pistx, int pisty, int pistz )
+{
+ cWorld* World = cRoot::Get()->GetWorld();
+ char metadata = World->GetBlockMeta( pistx, pisty, pistz);
+
+
+ if ( ( (int)World->GetBlock( pistx, pisty, pistz ) == E_BLOCK_STICKY_PISTON ) || ( (int)World->GetBlock( pistx, pisty, pistz ) == E_BLOCK_PISTON ) ) {
+ //find direction piston is facing base on meta.
+ //verify piston is not already extended.
+ //check all 16 blocks in front of it for the first airblock
+ //if there's and air block move those found blocks by 1 and insert E_BLOCK_PISTON_EXTENSION in the spot infront of the piston facing right direction
+
+ }
+
+}
+
+void cPiston::RetractPiston( int pistx, int pisty, int pistz )
+{
+ cWorld* World = cRoot::Get()->GetWorld();
+ char metadata = World->GetBlockMeta( pistx, pisty, pistz);
+
+ if ( (int)World->GetBlock( pistx, pisty, pistz ) == E_BLOCK_PISTON ) {
+ //find direction piston is facing base on meta.
+ //verify piston is extended.
+ //check block in front to see if it's an E_BLOCK_PISTON_EXTENSION
+ //delete that block
+ //set piston meta to unextended
+ }
+
+ if ( (int)World->GetBlock( pistx, pisty, pistz ) == E_BLOCK_STICKY_PISTON ) {
+ //find direction piston is facing base on meta.
+ //verify piston is extended.
+ //check block in front to see if it's an E_BLOCK_PISTON_EXTENSION
+ //delete that block
+ //move block one more in front of it to postion E_BLOCK_PISTON_EXTENSION was facing.
+ //set piston meta to unextended
+ }
+
+}