diff options
author | Mattes D <github@xoft.cz> | 2013-12-08 18:07:34 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2013-12-08 18:07:34 +0100 |
commit | 6f23d2ec94b30e355edc63c2de464d40ff3d0ed8 (patch) | |
tree | 3127fecd22be0f755e81c384c72a171e52987458 /src/Piston.cpp | |
parent | Removed unused ToLua files. (diff) | |
parent | Fixed binding generation and VS2013 compile (diff) | |
download | cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar.gz cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar.bz2 cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar.lz cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar.xz cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.tar.zst cuberite-6f23d2ec94b30e355edc63c2de464d40ff3d0ed8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Piston.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Piston.cpp b/src/Piston.cpp index 63ffbad0b..b15e7d95e 100644 --- a/src/Piston.cpp +++ b/src/Piston.cpp @@ -15,7 +15,7 @@ /// Number of ticks that the piston extending / retracting waits before setting the block -const int PISTON_TICK_DELAY = 6; +const int PISTON_TICK_DELAY = 1; @@ -113,7 +113,7 @@ void cPiston::ExtendPiston(int pistx, int pisty, int pistz) AddDir(pistx, pisty, pistz, pistonMeta, -1); // "pist" now at piston body, "ext" at future extension - m_World->SetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8); + m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8); m_World->QueueSetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0), PISTON_TICK_DELAY); } @@ -126,6 +126,7 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz) BLOCKTYPE pistonBlock; NIBBLETYPE pistonMeta; m_World->GetBlockTypeMeta(pistx, pisty, pistz, pistonBlock, pistonMeta); + if (!IsExtended(pistonMeta)) { // Already retracted, bail out @@ -141,16 +142,16 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz) } AddDir(pistx, pisty, pistz, pistonMeta, -1); - m_World->BroadcastBlockAction(pistx, pisty, pistz, 1, pistonMeta & ~(8), pistonBlock); - m_World->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f); m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8)); + m_World->BroadcastBlockAction(pistx, pisty, pistz, 1, pistonMeta & ~(8), pistonBlock); + m_World->BroadcastSoundEffect("tile.piston.in", pistx * 8, pisty * 8, pistz * 8, 0.5f, 0.7f); AddDir(pistx, pisty, pistz, pistonMeta, 1); // Retract the extension, pull block if appropriate if (IsSticky(pistonBlock)) { int tempx = pistx, tempy = pisty, tempz = pistz; - AddDir( tempx, tempy, tempz, pistonMeta, 1); + AddDir(tempx, tempy, tempz, pistonMeta, 1); BLOCKTYPE tempBlock; NIBBLETYPE tempMeta; m_World->GetBlockTypeMeta(tempx, tempy, tempz, tempBlock, tempMeta); |