1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-18 22:09:20 +00:00

clean up, get rid of magic number

This commit is contained in:
Keterr 2020-11-25 14:33:51 -07:00
parent 713c5e71d4
commit ff8114d72c

View File

@ -159,10 +159,16 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
continue;
}
const maxProgress = Math.min(
1.0,
sourceSlot.cachedBeltPath ? sourceSlot.cachedBeltPath.spacingToFirstItem * 1.45 : 1.0
);
let maxProgress = 1.0;
// Check if there's an item blocking the ejector
const destPath = sourceSlot.cachedBeltPath;
if (destPath) {
maxProgress = Math.min(
1.0,
sourceSlot.cachedBeltPath.spacingToFirstItem / globalConfig.itemSpacingOnBelts
);
}
// Advance items on the slot
sourceSlot.progress = Math.min(
@ -183,7 +189,6 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
}
// Check if we are ejecting to a belt path
const destPath = sourceSlot.cachedBeltPath;
if (destPath) {
// Try passing the item over
if (destPath.tryAcceptItem(item)) {