Fixed piston power checking
This commit is contained in:
parent
67308e4337
commit
ae4371a733
@ -1489,41 +1489,36 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
|
|||||||
{
|
{
|
||||||
// Pistons cannot be powered through their front face; this function verifies that a source meets this requirement
|
// Pistons cannot be powered through their front face; this function verifies that a source meets this requirement
|
||||||
|
|
||||||
int OldX = a_RelBlockX, OldY = a_RelBlockY, OldZ = a_RelBlockZ;
|
|
||||||
eBlockFace Face = cBlockPistonHandler::MetaDataToDirection(a_Meta);
|
eBlockFace Face = cBlockPistonHandler::MetaDataToDirection(a_Meta);
|
||||||
int BlockX = (m_Chunk->GetPosX() * cChunkDef::Width) + a_RelBlockX;
|
int BlockX = m_Chunk->GetPosX() * cChunkDef::Width + a_RelBlockX;
|
||||||
int BlockZ = (m_Chunk->GetPosZ() * cChunkDef::Width) + a_RelBlockZ;
|
int BlockZ = m_Chunk->GetPosZ() * cChunkDef::Width + a_RelBlockZ;
|
||||||
|
|
||||||
for (PoweredBlocksList::const_iterator itr = m_PoweredBlocks->begin(); itr != m_PoweredBlocks->end(); ++itr)
|
for (PoweredBlocksList::const_iterator itr = m_PoweredBlocks->begin(); itr != m_PoweredBlocks->end(); ++itr)
|
||||||
{
|
{
|
||||||
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
|
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
|
||||||
|
|
||||||
AddFaceDirection(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Face);
|
AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face);
|
||||||
|
|
||||||
if (!itr->a_SourcePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
|
if (!itr->a_SourcePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
a_RelBlockX = OldX;
|
AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face, true);
|
||||||
a_RelBlockY = OldY;
|
|
||||||
a_RelBlockZ = OldZ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LinkedBlocksList::const_iterator itr = m_LinkedPoweredBlocks->begin(); itr != m_LinkedPoweredBlocks->end(); ++itr)
|
for (LinkedBlocksList::const_iterator itr = m_LinkedPoweredBlocks->begin(); itr != m_LinkedPoweredBlocks->end(); ++itr)
|
||||||
{
|
{
|
||||||
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
|
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
|
||||||
|
|
||||||
AddFaceDirection(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Face);
|
AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face);
|
||||||
|
|
||||||
if (!itr->a_MiddlePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
|
if (!itr->a_MiddlePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
a_RelBlockX = OldX;
|
AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face, true);
|
||||||
a_RelBlockY = OldY;
|
|
||||||
a_RelBlockZ = OldZ;
|
|
||||||
}
|
}
|
||||||
return false; // Source was in front of the piston's front face
|
return false; // Source was in front of the piston's front face
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user