diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-08-14 12:36:16 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-08-14 12:36:16 +0200 |
commit | 7803bde6b67440c6483d677551f60f1708b8cb2d (patch) | |
tree | 37633d9140fd33909aaedc4eeb190bc603e06c54 | |
parent | Added some old contributors. (diff) | |
parent | YET ANOTHER ERROR >:( (diff) | |
download | cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar.gz cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar.bz2 cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar.lz cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar.xz cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.tar.zst cuberite-7803bde6b67440c6483d677551f60f1708b8cb2d.zip |
-rw-r--r-- | source/Blocks/BlockTorch.h | 1 | ||||
-rw-r--r-- | source/Piston.cpp | 26 |
2 files changed, 25 insertions, 2 deletions
diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h index 99c1a7b75..3a50cab77 100644 --- a/source/Blocks/BlockTorch.h +++ b/source/Blocks/BlockTorch.h @@ -103,7 +103,6 @@ public: virtual bool DoesAllowBlockOnTop(void) override { return true; - //was false } diff --git a/source/Piston.cpp b/source/Piston.cpp index d179d70b6..161f2b38c 100644 --- a/source/Piston.cpp +++ b/source/Piston.cpp @@ -12,8 +12,14 @@ #include "Server.h" #include "Blocks/BlockHandler.h" +#ifdef _WIN32 +#include <windows.h> +#else +#include <unistd.h> +#endif +//Athar from http://www.cplusplus.com/forum/unices/60161/ helped with the sleep code. extern bool g_BlockPistonBreakable[]; @@ -122,6 +128,12 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) AddDir(extx, exty, extz, pistonMeta & 7, 1) + #ifdef _WIN32 + Sleep(100); + #else + usleep(static_cast<useconds_t>(100)*1000); + #endif + m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7); } @@ -142,7 +154,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 +178,23 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) // These cannot be moved by the sticky piston, bail out return; } + #ifdef _WIN32 + Sleep(100); + #else + usleep(static_cast<useconds_t>(100)*1000); + #endif + m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); } else { + #ifdef _WIN32 + Sleep(100); + #else + usleep(static_cast<useconds_t>(100)*1000); + #endif + m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0); } } |