diff --git a/src/js/changelog.js b/src/js/changelog.js index 3d3ba951..c0ef3e66 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -5,6 +5,7 @@ export const CHANGELOG = [ entries: [ "Fix item readers and some other buildings slowing up belts, especially if they stalled (inspired by Keterr's fix)", "Added the ability to edit constant signals by left clicking them", + "Prevent items from being rendered on each other when a belt stalls (inspired by Keterr)", "You can now add markers in the wire layer (partially by daanbreur)", "Allow to cycle backwards in the toolbar with SHIFT + Tab (idea by EmeraldBlock)", "Allow to cycle variants backwards with SHIFT + T", diff --git a/src/js/game/systems/item_ejector.js b/src/js/game/systems/item_ejector.js index 56535111..6bbb42ce 100644 --- a/src/js/game/systems/item_ejector.js +++ b/src/js/game/systems/item_ejector.js @@ -328,6 +328,21 @@ export class ItemEjectorSystem extends GameSystemWithFilter { continue; } + // Limit the progress to the maximum available space on the next belt (also see #1000) + let progress = slot.progress; + const nextBeltPath = slot.cachedBeltPath; + if (nextBeltPath) { + progress = Math.min( + progress, + nextBeltPath.spacingToFirstItem / globalConfig.itemSpacingOnBelts + ); + } + + // Skip if the item would barely be visible + if (progress < 0.05) { + continue; + } + const realPosition = staticComp.localTileToWorld(slot.pos); if (!chunk.tileSpaceRectangle.containsPoint(realPosition.x, realPosition.y)) { // Not within this chunk @@ -337,8 +352,8 @@ export class ItemEjectorSystem extends GameSystemWithFilter { const realDirection = staticComp.localDirectionToWorld(slot.direction); const realDirectionVector = enumDirectionToVector[realDirection]; - const tileX = realPosition.x + 0.5 + realDirectionVector.x * 0.5 * slot.progress; - const tileY = realPosition.y + 0.5 + realDirectionVector.y * 0.5 * slot.progress; + const tileX = realPosition.x + 0.5 + realDirectionVector.x * 0.5 * progress; + const tileY = realPosition.y + 0.5 + realDirectionVector.y * 0.5 * progress; const worldX = tileX * globalConfig.tileSize; const worldY = tileY * globalConfig.tileSize;