Reworked cable connections (#3334)

* Reworked cable connections

Added enums for cable variants and sizes.
Rules for connections between a cable and another cable or grid member
are much more simple without any exceptions for certain combinations.
1/ Connections are rendered as the lowest type between cores.
2/ Each type uses are core for clear separation.
3/ The core will always be on the cable with the higher order.
This commit is contained in:
yueh
2018-05-27 21:34:28 +02:00
committed by GitHub
parent 2894a7caa0
commit 3c4a0cae11
8 changed files with 201 additions and 36 deletions
@@ -1157,9 +1157,6 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( cable != null )
{
final boolean isSmart = cable.getCableConnectionType() == AECableType.SMART || cable.getCableConnectionType() == AECableType.DENSE_SMART;
final boolean isDense = cable.getCableConnectionType() == AECableType.DENSE_COVERED || cable.getCableConnectionType() == AECableType.DENSE_SMART;
renderState.setCableColor( cable.getCableColor() );
renderState.setCableType( cable.getCableConnectionType() );
renderState.setCoreType( CableCoreType.fromCableType( cable.getCableConnectionType() ) );
@@ -1184,11 +1181,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( adjacentTe instanceof IGridHost )
{
if( !( adjacentTe instanceof IPartHost ) || isDense )
{
IGridHost gridHost = (IGridHost) adjacentTe;
connectionType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
}
final IGridHost gridHost = (IGridHost) adjacentTe;
final AECableType adjacentType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
connectionType = AECableType.min( connectionType, adjacentType );
}
// Check if the adjacent TE is a cable bus or not
@@ -1205,7 +1201,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
// adjacent tile requires it
for( EnumFacing facing : EnumFacing.values() )
{
int channels = isSmart ? cable.getChannelsOnSide( facing ) : 0;
int channels = cable.getCableConnectionType().isSmart() ? cable.getChannelsOnSide( facing ) : 0;
renderState.getChannelsOnSide().put( facing, channels );
}
}