1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-16 19:51:50 +00:00

only show ejector belt if connected

This commit is contained in:
EmeraldBlock 2021-11-24 21:44:40 -06:00
parent a239e405c9
commit b2a8224ad3

View File

@ -44,13 +44,18 @@ export class EjectorBeltSystem extends GameSystemWithFilter {
const staticComp = entity.components.StaticMapEntity; const staticComp = entity.components.StaticMapEntity;
for (let i = 0; i < ejectorComp.slots.length; ++i) { for (let i = 0; i < ejectorComp.slots.length; ++i) {
// Extract underlay parameters // Extract underlay parameters
const { pos, direction, beltLength } = ejectorComp.slots[i]; const { pos, direction, beltLength, cachedTargetEntity } = ejectorComp.slots[i];
// skips both missing and 0 belt lengths // skips both missing and 0 belt lengths
if (!beltLength) { if (!beltLength) {
continue; continue;
} }
// check if connected
if (!cachedTargetEntity) {
continue;
}
const transformedPos = staticComp.localTileToWorld(pos); const transformedPos = staticComp.localTileToWorld(pos);
const destX = transformedPos.x * globalConfig.tileSize; const destX = transformedPos.x * globalConfig.tileSize;
const destY = transformedPos.y * globalConfig.tileSize; const destY = transformedPos.y * globalConfig.tileSize;