mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Revert back to exact speed - doesn't eject fast enough on higher speeds
This commit is contained in:
parent
242b99b19b
commit
5b036d7f5b
@ -119,14 +119,6 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
this.numCompressedItemsAfterFirstItem = 0;
|
this.numCompressedItemsAfterFirstItem = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether this path can accept a new item
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
canAcceptItem() {
|
|
||||||
return this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to accept the item
|
* Tries to accept the item
|
||||||
* @param {BaseItem} item
|
* @param {BaseItem} item
|
||||||
@ -135,15 +127,10 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
tryAcceptItem(item, extraProgress = 0) {
|
tryAcceptItem(item, extraProgress = 0) {
|
||||||
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
|
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
|
||||||
// So, since we already need one tick to accept this item we will add this directly.
|
// So, since we already need one tick to accept this item we will add this directly.
|
||||||
// this means we are moving it forwards twice in one tick, but otherwise belts won't be full :(
|
|
||||||
const beltProgressPerTick =
|
|
||||||
this.root.hubGoals.getBeltBaseSpeed() *
|
|
||||||
this.root.dynamicTickrate.deltaSeconds *
|
|
||||||
globalConfig.itemSpacingOnBelts;
|
|
||||||
|
|
||||||
// First, compute how much progress we can make *at max*
|
// First, compute how much progress we can make *at max*
|
||||||
const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts);
|
const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts);
|
||||||
const initialProgress = Math.min(maxProgress, beltProgressPerTick + extraProgress);
|
const initialProgress = Math.min(maxProgress, extraProgress);
|
||||||
|
|
||||||
this.items.unshift([this.spacingToFirstItem - initialProgress, item]);
|
this.items.unshift([this.spacingToFirstItem - initialProgress, item]);
|
||||||
this.spacingToFirstItem = initialProgress;
|
this.spacingToFirstItem = initialProgress;
|
||||||
|
Loading…
Reference in New Issue
Block a user