mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Prevent items from being rendered on each other when a belt stalls, closes #1000
This commit is contained in:
parent
203cd88ad9
commit
01733c48a3
@ -5,6 +5,7 @@ export const CHANGELOG = [
|
|||||||
entries: [
|
entries: [
|
||||||
"Fix item readers and some other buildings slowing up belts, especially if they stalled (inspired by Keterr's fix)",
|
"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",
|
"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)",
|
"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 backwards in the toolbar with SHIFT + Tab (idea by EmeraldBlock)",
|
||||||
"Allow to cycle variants backwards with SHIFT + T",
|
"Allow to cycle variants backwards with SHIFT + T",
|
||||||
|
@ -328,6 +328,21 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
continue;
|
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);
|
const realPosition = staticComp.localTileToWorld(slot.pos);
|
||||||
if (!chunk.tileSpaceRectangle.containsPoint(realPosition.x, realPosition.y)) {
|
if (!chunk.tileSpaceRectangle.containsPoint(realPosition.x, realPosition.y)) {
|
||||||
// Not within this chunk
|
// Not within this chunk
|
||||||
@ -337,8 +352,8 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
const realDirection = staticComp.localDirectionToWorld(slot.direction);
|
const realDirection = staticComp.localDirectionToWorld(slot.direction);
|
||||||
const realDirectionVector = enumDirectionToVector[realDirection];
|
const realDirectionVector = enumDirectionToVector[realDirection];
|
||||||
|
|
||||||
const tileX = realPosition.x + 0.5 + realDirectionVector.x * 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 * slot.progress;
|
const tileY = realPosition.y + 0.5 + realDirectionVector.y * 0.5 * progress;
|
||||||
|
|
||||||
const worldX = tileX * globalConfig.tileSize;
|
const worldX = tileX * globalConfig.tileSize;
|
||||||
const worldY = tileY * globalConfig.tileSize;
|
const worldY = tileY * globalConfig.tileSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user