1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 02:01:51 +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) {
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 initialProgress = Math.min(maxProgress, startProgress);
if (startProgress > maxProgress) {
return false;
}
this.items.unshift([this.spacingToFirstItem - initialProgress, item]);
this.spacingToFirstItem = initialProgress;
this.items.unshift([this.spacingToFirstItem - startProgress, item]);
this.spacingToFirstItem = startProgress;
if (G_IS_DEV && globalConfig.debug.checkBeltPaths) {
this.debug_checkIntegrity("accept-item");

View File

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

View File

@ -43,9 +43,9 @@ export class FilterSystem extends GameSystemWithFilter {
*
* @param {Entity} entity
* @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;
if (!network || !network.hasValue()) {
// Filter is not connected
@ -72,7 +72,7 @@ export class FilterSystem extends GameSystemWithFilter {
// Actually accept item
listToCheck.push({
item,
extraProgress,
extraProgress: startProgress,
});
return true;
}