1
0

Properly fixed piston bugs

This commit is contained in:
Tiger Wang 2013-11-22 23:15:59 +00:00
parent e40b384547
commit 6a051b7cd8
2 changed files with 12 additions and 5 deletions

View File

@ -15,7 +15,7 @@
/// Number of ticks that the piston extending / retracting waits before setting the block
const int PISTON_TICK_DELAY = 5;
const int PISTON_TICK_DELAY = 6;
@ -140,9 +140,11 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz)
return;
}
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));
AddDir(pistx, pisty, pistz, pistonMeta, 1);
// Retract the extension, pull block if appropriate
if (IsSticky(pistonBlock))

View File

@ -431,8 +431,6 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl
if (m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) != 0) // A powered wire
{
//SetBlockPowered(a_BlockX, a_BlockY - 1, a_BlockZ, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_WIRE); // No matter what, block underneath gets powered
switch (GetWireDirection(a_BlockX, a_BlockY, a_BlockZ))
{
case REDSTONE_NONE:
@ -496,7 +494,10 @@ void cRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_BlockY, int
{
// We do this so that the repeater can continually update block power status (without being affected by it's own block type, which would happen if the block powering code was in an IF statement)
bool IsOn = false;
if (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON) { IsOn = true; }
if (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON)
{
IsOn = true;
}
NIBBLETYPE a_Meta = m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
@ -533,7 +534,10 @@ void cRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_BlockY, int
}
else
{
if (IsOn) { m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_REPEATER_OFF, a_Meta); }
if (IsOn)
{
m_World.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_REPEATER_OFF, a_Meta);
}
}
return;
}
@ -1060,6 +1064,7 @@ void cRedstoneSimulator::SetAllDirsAsPowered(int a_BlockX, int a_BlockY, int a_B
{ 0, 0, 1 },
{ 0, 0,-1 },
{ 0, 1, 0 },
{ 0,-1, 0 }
};
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)