1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-16 03:31:52 +00:00

Changed calculation of connected

This commit is contained in:
DJ1TJOO 2021-11-26 19:05:49 +01:00
parent cc067d3d5a
commit 623da3decd

View File

@ -192,32 +192,34 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
const worldDirectionVector = enumDirectionToVector[worldDirection]; const worldDirectionVector = enumDirectionToVector[worldDirection];
// Figure out if there is anything connected at the top // Figure out if there is anything connected at the top
let connectedTop = this.checkIsAcceptorConnected( let connectedTop = false;
transformedPos.add(worldDirectionVector),
enumInvertedDirections[worldDirection]
);
const ejectorComp = entity.components.ItemEjector; const ejectorComp = entity.components.ItemEjector;
if (ejectorComp) { if (ejectorComp) {
const ejectorSlot = ejectorComp.findMatchingSlot( const ejectorSlot = ejectorComp.findMatchingSlot(
underlayTile.pos, underlayTile.pos,
enumInvertedDirections[underlayTile.direction] enumInvertedDirections[underlayTile.direction]
); );
if (!ejectorSlot) connectedTop = false;
} else { if (ejectorSlot) {
connectedTop = false; connectedTop = this.checkIsAcceptorConnected(
transformedPos.add(worldDirectionVector),
enumInvertedDirections[worldDirection]
);
}
} }
// Figure out if there is anything connected at the bottom // Figure out if there is anything connected at the bottom
let connectedBottom = this.checkIsEjectorConnected( let connectedBottom = false;
transformedPos.sub(worldDirectionVector),
worldDirection
);
const acceptorComp = entity.components.ItemAcceptor; const acceptorComp = entity.components.ItemAcceptor;
if (acceptorComp) { if (acceptorComp) {
const acceptorSlot = acceptorComp.findMatchingSlot(underlayTile.pos, underlayTile.direction); const acceptorSlot = acceptorComp.findMatchingSlot(underlayTile.pos, underlayTile.direction);
if (!acceptorSlot) connectedBottom = false;
} else { if (acceptorSlot) {
connectedBottom = false; connectedBottom = this.checkIsEjectorConnected(
transformedPos.sub(worldDirectionVector),
worldDirection
);
}
} }
let flag = enumClippedBeltUnderlayType.none; let flag = enumClippedBeltUnderlayType.none;