summaryrefslogtreecommitdiffstats
path: root/source/Piston.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 17:34:26 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 17:34:26 +0200
commit9ec248eaa09a6e575a6bd5f79028dda3ef982bdf (patch)
tree4dcd68a15ddef1de13bdd8564bbf6391a14c8a46 /source/Piston.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadcuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar.gz
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar.bz2
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar.lz
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar.xz
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.tar.zst
cuberite-9ec248eaa09a6e575a6bd5f79028dda3ef982bdf.zip
Diffstat (limited to 'source/Piston.cpp')
-rw-r--r--source/Piston.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/Piston.cpp b/source/Piston.cpp
index d179d70b6..f5aaabf00 100644
--- a/source/Piston.cpp
+++ b/source/Piston.cpp
@@ -122,6 +122,14 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz )
AddDir(extx, exty, extz, pistonMeta & 7, 1)
+ #ifdef _WIN32 // Pause for 0.1 seconds to allow client animation to run
+ #include <windows.h>
+ Sleep(100);
+ #else
+ #include <unistd.h>
+ usleep(100 * 1000); // takes microseconds
+ #endif
+
m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7);
}
@@ -142,7 +150,7 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz )
m_World->BroadcastBlockAction(pistx, pisty, pistz, 1, pistonMeta & ~(8), E_BLOCK_PISTON);
m_World->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f);
m_World->FastSetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8));
-
+
AddDir(pistx, pisty, pistz, pistonMeta & 7, 1)
if (m_World->GetBlock(pistx, pisty, pistz) != E_BLOCK_PISTON_EXTENSION)
{
@@ -166,11 +174,27 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz )
// These cannot be moved by the sticky piston, bail out
return;
}
+ #ifdef _WIN32
+ #include <windows.h>
+ Sleep(100);
+ #else
+ #include <unistd.h>
+ usleep(100 * 1000); // takes microseconds
+ #endif
+
m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta);
m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0);
}
else
{
+ #ifdef _WIN32
+ #include <windows.h>
+ Sleep(100);
+ #else
+ #include <unistd.h>
+ usleep(100 * 1000); // takes microseconds
+ #endif
+
m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0);
}
}