diff options
-rw-r--r-- | source/Piston.cpp | 26 |
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); } } |