1
0
Fork 0

Fix the connexion to the side of the repeater

This commit is contained in:
Marc_Bornand 2020-05-02 22:15:46 +02:00 committed by Tiger Wang
parent 942403de2b
commit 055c9ef90e
1 changed files with 25 additions and 3 deletions

View File

@ -14,12 +14,34 @@ class cRedstoneWireHandler:
public:
inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block)
inline static bool IsDirectlyConnectingMechanism(cWorld & a_World, BLOCKTYPE a_Block, Vector3i a_QueryPosition, Vector3i a_Offset)
{
switch (a_Block)
{
case E_BLOCK_REDSTONE_REPEATER_ON:
case E_BLOCK_REDSTONE_REPEATER_OFF:
if ((a_World.GetBlockMeta(a_QueryPosition) & 0x1) == 1)
{
if (a_Offset.x == 0)
{
return false;
}
else
{
return true;
}
}
else
{
if (a_Offset.z == 0)
{
return false;
}
else
{
return true;
}
}
case E_BLOCK_ACTIVE_COMPARATOR:
case E_BLOCK_INACTIVE_COMPARATOR:
case E_BLOCK_REDSTONE_TORCH_OFF:
@ -72,14 +94,14 @@ public:
a_Meta++;
}
if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_QueryBlockType))
if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_World, a_QueryBlockType, a_QueryPosition, a_QueryPosition - a_Position))
{
Vector3i PotentialOffset;
bool FoundOneBorderingMechanism = false;
for (const auto & Offset : StaticAppend(GetRelativeLaterals(), GetTerracingConnectionOffsets(a_World, a_Position)))
{
if (IsDirectlyConnectingMechanism(a_World.GetBlock(Offset + a_Position)))
if (IsDirectlyConnectingMechanism(a_World, a_World.GetBlock(Offset + a_Position), a_QueryPosition, Offset))
{
if (FoundOneBorderingMechanism)
{