1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 10:11:50 +00:00

remove cap on startProgress to help fix high speeds - item ejector is still limited to 1 item/tick though

This commit is contained in:
Sense101 2022-01-20 22:47:11 +00:00
parent 10e9d2cf8b
commit e3dc236286
3 changed files with 12 additions and 8 deletions

View File

@ -134,12 +134,15 @@ export class BeltPath extends BasicSerializableObject {
*/ */
tryAcceptItem(item, startProgress = 0) { tryAcceptItem(item, startProgress = 0) {
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) { if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
// First, compute how much progress we can make *at max* // *Never* cap start progress, or if an item moves more than a belt in a tick, it breaks
// instead return false if the start progress is too much
const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts); const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts);
const initialProgress = Math.min(maxProgress, startProgress); if (startProgress > maxProgress) {
return false;
}
this.items.unshift([this.spacingToFirstItem - initialProgress, item]); this.items.unshift([this.spacingToFirstItem - startProgress, item]);
this.spacingToFirstItem = initialProgress; this.spacingToFirstItem = startProgress;
if (G_IS_DEV && globalConfig.debug.checkBeltPaths) { if (G_IS_DEV && globalConfig.debug.checkBeltPaths) {
this.debug_checkIntegrity("accept-item"); this.debug_checkIntegrity("accept-item");

View File

@ -98,10 +98,11 @@ export class ItemAcceptorComponent extends Component {
return false; return false;
} }
// if the start progress is bigger than 0.5, the remainder should get passed on to the ejector
this.inputs.set(slotIndex, { this.inputs.set(slotIndex, {
item, item,
direction, direction,
animProgress: Math.min(0.5, startProgress), animProgress: startProgress,
}); });
return true; return true;
} }

View File

@ -43,9 +43,9 @@ export class FilterSystem extends GameSystemWithFilter {
* *
* @param {Entity} entity * @param {Entity} entity
* @param {BaseItem} item * @param {BaseItem} item
* @param {number} extraProgress * @param {number} startProgress
*/ */
tryAcceptItem(entity, item, extraProgress) { tryAcceptItem(entity, item, startProgress) {
const network = entity.components.WiredPins.slots[0].linkedNetwork; const network = entity.components.WiredPins.slots[0].linkedNetwork;
if (!network || !network.hasValue()) { if (!network || !network.hasValue()) {
// Filter is not connected // Filter is not connected
@ -72,7 +72,7 @@ export class FilterSystem extends GameSystemWithFilter {
// Actually accept item // Actually accept item
listToCheck.push({ listToCheck.push({
item, item,
extraProgress, extraProgress: startProgress,
}); });
return true; return true;
} }