1
0
This commit is contained in:
Tiger Wang 2013-08-13 16:34:26 +01:00
parent 0ac24a98e4
commit 9ec248eaa0

View File

@ -122,6 +122,14 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz )
AddDir(extx, exty, extz, pistonMeta & 7, 1) 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); 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->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->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f);
m_World->FastSetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8)); m_World->FastSetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8));
AddDir(pistx, pisty, pistz, pistonMeta & 7, 1) AddDir(pistx, pisty, pistz, pistonMeta & 7, 1)
if (m_World->GetBlock(pistx, pisty, pistz) != E_BLOCK_PISTON_EXTENSION) 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 // These cannot be moved by the sticky piston, bail out
return; 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(pistx, pisty, pistz, tempblock, tempmeta);
m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0);
} }
else 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); m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0);
} }
} }